summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp254
1 files changed, 127 insertions, 127 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index ea2c47f..d927a36 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -1,6 +1,6 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> 4 =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
5             .=l. Dan Williams <drw@handhelds.org> 5             .=l. Dan Williams <drw@handhelds.org>
6           .>+-= 6           .>+-=
@@ -29,8 +29,8 @@
29 29
30#include <stdio.h> 30#include <stdio.h>
31 31
32#include <opie/ofiledialog.h> 32#include <opie2/ofiledialog.h>
33 33
34#ifdef QWS 34#ifdef QWS
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/fileselector.h> 36#include <qpe/fileselector.h>
@@ -58,7 +58,7 @@
58#include "global.h" 58#include "global.h"
59 59
60enum { 60enum {
61 MAXLINES = 100, 61 MAXLINES = 100,
62}; 62};
63 63
64InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) 64InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title )
@@ -66,7 +66,7 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
66{ 66{
67 setCaption( title ); 67 setCaption( title );
68 init( TRUE ); 68 init( TRUE );
69 69
70 pIpkg = 0; 70 pIpkg = 0;
71 upgradePackages = false; 71 upgradePackages = false;
72 dataMgr = dataManager; 72 dataMgr = dataManager;
@@ -81,14 +81,14 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
81 flags = cfg.readNumEntry( "installFlags", 0 ); 81 flags = cfg.readNumEntry( "installFlags", 0 );
82 infoLevel = cfg.readNumEntry( "infoLevel", 1 ); 82 infoLevel = cfg.readNumEntry( "infoLevel", 1 );
83#else 83#else
84 flags = 0; 84 flags = 0;
85#endif 85#endif
86 86
87 // Output text is read only 87 // Output text is read only
88 output->setReadOnly( true ); 88 output->setReadOnly( true );
89 //QFont f( "helvetica" ); 89// QFont f( "helvetica" );
90 //f.setPointSize( 10 ); 90// f.setPointSize( 10 );
91 //output->setFont( f ); 91// output->setFont( f );
92 92
93 93
94 // setup destination data 94 // setup destination data
@@ -104,44 +104,44 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
104 104
105 destination->setCurrentItem( defIndex ); 105 destination->setCurrentItem( defIndex );
106 106
107 QListIterator<InstallData> it( packageList ); 107 QListIterator<InstallData> it( packageList );
108 // setup package data 108 // setup package data
109 QString remove = tr( "Remove\n" ); 109 QString remove = tr( "Remove\n" );
110 QString install = tr( "Install\n" ); 110 QString install = tr( "Install\n" );
111 QString upgrade = tr( "Upgrade\n" ); 111 QString upgrade = tr( "Upgrade\n" );
112 for ( ; it.current(); ++it ) 112 for ( ; it.current(); ++it )
113 { 113 {
114 InstallData *item = it.current(); 114 InstallData *item = it.current();
115 InstallData *newitem = new InstallData(); 115 InstallData *newitem = new InstallData();
116 116
117 newitem->option = item->option; 117 newitem->option = item->option;
118 newitem->packageName = item->packageName; 118 newitem->packageName = item->packageName;
119 newitem->destination = item->destination; 119 newitem->destination = item->destination;
120 newitem->recreateLinks = item->recreateLinks; 120 newitem->recreateLinks = item->recreateLinks;
121 packages.append( newitem ); 121 packages.append( newitem );
122 122
123 if ( item->option == "I" ) 123 if ( item->option == "I" )
124 { 124 {
125 install.append( QString( " %1\n" ).arg( item->packageName ) ); 125 install.append( QString( " %1\n" ).arg( item->packageName ) );
126 } 126 }
127 else if ( item->option == "D" ) 127 else if ( item->option == "D" )
128 { 128 {
129 remove.append( QString( " %1\n" ).arg( item->packageName ) ); 129 remove.append( QString( " %1\n" ).arg( item->packageName ) );
130 } 130 }
131 else if ( item->option == "U" || item->option == "R" ) 131 else if ( item->option == "U" || item->option == "R" )
132 { 132 {
133 QString type; 133 QString type;
134 if ( item->option == "R" ) 134 if ( item->option == "R" )
135 type = tr( "(ReInstall)" ); 135 type = tr( "(ReInstall)" );
136 else 136 else
137 type = tr( "(Upgrade)" ); 137 type = tr( "(Upgrade)" );
138 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); 138 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
139 } 139 }
140 } 140 }
141 141
142 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); 142 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
143 143
144 displayAvailableSpace( destination->currentText() ); 144 displayAvailableSpace( destination->currentText() );
145} 145}
146 146
147InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) 147InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title )
@@ -162,7 +162,7 @@ InstallDlgImpl::~InstallDlgImpl()
162 162
163void InstallDlgImpl :: init( bool displayextrainfo ) 163void InstallDlgImpl :: init( bool displayextrainfo )
164{ 164{
165 QGridLayout *layout = new QGridLayout( this ); 165 QGridLayout *layout = new QGridLayout( this );
166 layout->setSpacing( 4 ); 166 layout->setSpacing( 4 );
167 layout->setMargin( 4 ); 167 layout->setMargin( 4 );
168 168
@@ -185,7 +185,7 @@ void InstallDlgImpl :: init( bool displayextrainfo )
185 destination = 0x0; 185 destination = 0x0;
186 txtAvailableSpace = 0x0; 186 txtAvailableSpace = 0x0;
187 } 187 }
188 188
189 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 189 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
190 GroupBox2->layout()->setSpacing( 0 ); 190 GroupBox2->layout()->setSpacing( 0 );
191 GroupBox2->layout()->setMargin( 4 ); 191 GroupBox2->layout()->setMargin( 4 );
@@ -198,7 +198,7 @@ void InstallDlgImpl :: init( bool displayextrainfo )
198 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); 198 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this );
199 layout->addWidget( btnInstall, 3, 0 ); 199 layout->addWidget( btnInstall, 3, 0 );
200 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); 200 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
201 201
202 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 202 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
203 layout->addWidget( btnOptions, 3, 1 ); 203 layout->addWidget( btnOptions, 3, 1 );
204 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); 204 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
@@ -232,8 +232,8 @@ void InstallDlgImpl :: optionsSelected()
232 map.insert(tr( "Text" ), text ); 232 map.insert(tr( "Text" ), text );
233 text << "*"; 233 text << "*";
234 map.insert( tr( "All" ), text ); 234 map.insert( tr( "All" ), text );
235 235
236 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 236 QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
237 if( !filename.isEmpty() ) 237 if( !filename.isEmpty() )
238 { 238 {
239 QString currentFileName = QFileInfo( filename ).fileName(); 239 QString currentFileName = QFileInfo( filename ).fileName();
@@ -257,7 +257,7 @@ void InstallDlgImpl :: installSelected()
257 pIpkg->abort(); 257 pIpkg->abort();
258 displayText( tr( "**** Process Aborted ****" ) ); 258 displayText( tr( "**** Process Aborted ****" ) );
259 } 259 }
260 260
261 btnInstall->setText( tr( "Close" ) ); 261 btnInstall->setText( tr( "Close" ) );
262 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 262 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
263 return; 263 return;
@@ -267,7 +267,7 @@ void InstallDlgImpl :: installSelected()
267 emit reloadData( this ); 267 emit reloadData( this );
268 return; 268 return;
269 } 269 }
270 270
271 // Disable buttons 271 // Disable buttons
272 btnOptions->setEnabled( false ); 272 btnOptions->setEnabled( false );
273// btnInstall->setEnabled( false ); 273// btnInstall->setEnabled( false );
@@ -291,7 +291,7 @@ void InstallDlgImpl :: installSelected()
291 int instFlags = flags; 291 int instFlags = flags;
292 if ( d->linkToRoot() ) 292 if ( d->linkToRoot() )
293 instFlags |= MAKE_LINKS; 293 instFlags |= MAKE_LINKS;
294 294
295#ifdef QWS 295#ifdef QWS
296 // Save settings 296 // Save settings
297 Config cfg( "aqpkg" ); 297 Config cfg( "aqpkg" );
@@ -303,12 +303,12 @@ void InstallDlgImpl :: installSelected()
303 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 303 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
304 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 304 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
305 305
306 firstPackage = TRUE; 306 firstPackage = TRUE;
307 ipkgFinished(); 307 ipkgFinished();
308 308
309 // First run through the remove list, then the install list then the upgrade list 309 // First run through the remove list, then the install list then the upgrade list
310/* 310/*
311 pIpkg->setOption( "remove" ); 311 pIpkg->setOption( "remove" );
312 QListIterator<InstallData> it( removeList ); 312 QListIterator<InstallData> it( removeList );
313 InstallData *idata; 313 InstallData *idata;
314 for ( ; it.current(); ++it ) 314 for ( ; it.current(); ++it )
@@ -321,7 +321,7 @@ void InstallDlgImpl :: installSelected()
321 int tmpFlags = flags; 321 int tmpFlags = flags;
322 if ( idata->destination->linkToRoot() ) 322 if ( idata->destination->linkToRoot() )
323 tmpFlags |= MAKE_LINKS; 323 tmpFlags |= MAKE_LINKS;
324 324
325 pIpkg->setFlags( tmpFlags, infoLevel ); 325 pIpkg->setFlags( tmpFlags, infoLevel );
326 pIpkg->runIpkg(); 326 pIpkg->runIpkg();
327 } 327 }
@@ -400,77 +400,77 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text )
400 } 400 }
401 else 401 else
402 space = tr( "Unknown" ); 402 space = tr( "Unknown" );
403 403
404 if ( txtAvailableSpace ) 404 if ( txtAvailableSpace )
405 txtAvailableSpace->setText( space ); 405 txtAvailableSpace->setText( space );
406} 406}
407 407
408void InstallDlgImpl :: ipkgFinished() 408void InstallDlgImpl :: ipkgFinished()
409{ 409{
410 InstallData *item; 410 InstallData *item;
411 if ( firstPackage ) 411 if ( firstPackage )
412 item = packages.first(); 412 item = packages.first();
413 else 413 else
414 { 414 {
415 // Create symlinks if necessary before moving on to next package 415 // Create symlinks if necessary before moving on to next package
416 pIpkg->createSymLinks(); 416 pIpkg->createSymLinks();
417 417
418 item = packages.next(); 418 item = packages.next();
419 } 419 }
420 420
421 firstPackage = FALSE; 421 firstPackage = FALSE;
422 if ( item ) 422 if ( item )
423 { 423 {
424 pIpkg->setPackage( item->packageName ); 424 pIpkg->setPackage( item->packageName );
425 int tmpFlags = flags; 425 int tmpFlags = flags;
426 426
427 if ( item->option == "I" ) 427 if ( item->option == "I" )
428 { 428 {
429 pIpkg->setOption( "install" ); 429 pIpkg->setOption( "install" );
430 Destination *d = dataMgr->getDestination( destination->currentText() ); 430 Destination *d = dataMgr->getDestination( destination->currentText() );
431 pIpkg->setDestination( d->getDestinationName() ); 431 pIpkg->setDestination( d->getDestinationName() );
432 pIpkg->setDestinationDir( d->getDestinationPath() ); 432 pIpkg->setDestinationDir( d->getDestinationPath() );
433 433
434 if ( d->linkToRoot() ) 434 if ( d->linkToRoot() )
435 tmpFlags |= MAKE_LINKS; 435 tmpFlags |= MAKE_LINKS;
436 } 436 }
437 else if ( item->option == "D" ) 437 else if ( item->option == "D" )
438 { 438 {
439 pIpkg->setOption( "remove" ); 439 pIpkg->setOption( "remove" );
440 pIpkg->setDestination( item->destination->getDestinationName() ); 440 pIpkg->setDestination( item->destination->getDestinationName() );
441 pIpkg->setDestinationDir( item->destination->getDestinationPath() ); 441 pIpkg->setDestinationDir( item->destination->getDestinationPath() );
442 442
443 if ( item->destination->linkToRoot() ) 443 if ( item->destination->linkToRoot() )
444 tmpFlags |= MAKE_LINKS; 444 tmpFlags |= MAKE_LINKS;
445 } 445 }
446 else 446 else
447 { 447 {
448 if ( item->option == "R" ) 448 if ( item->option == "R" )
449 pIpkg->setOption( "reinstall" ); 449 pIpkg->setOption( "reinstall" );
450 else 450 else
451 pIpkg->setOption( "upgrade" ); 451 pIpkg->setOption( "upgrade" );
452 452
453 pIpkg->setDestination( item->destination->getDestinationName() ); 453 pIpkg->setDestination( item->destination->getDestinationName() );
454 pIpkg->setDestinationDir( item->destination->getDestinationPath() ); 454 pIpkg->setDestinationDir( item->destination->getDestinationPath() );
455 pIpkg->setPackage( item->packageName ); 455 pIpkg->setPackage( item->packageName );
456 456
457 tmpFlags |= FORCE_REINSTALL; 457 tmpFlags |= FORCE_REINSTALL;
458 if ( item->destination->linkToRoot() && item->recreateLinks ) 458 if ( item->destination->linkToRoot() && item->recreateLinks )
459 tmpFlags |= MAKE_LINKS; 459 tmpFlags |= MAKE_LINKS;
460 } 460 }
461 pIpkg->setFlags( tmpFlags, infoLevel ); 461 pIpkg->setFlags( tmpFlags, infoLevel );
462 pIpkg->runIpkg(); 462 pIpkg->runIpkg();
463 } 463 }
464 else 464 else
465 { 465 {
466 btnOptions->setEnabled( true ); 466 btnOptions->setEnabled( true );
467 btnInstall->setText( tr( "Close" ) ); 467 btnInstall->setText( tr( "Close" ) );
468 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 468 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
469 469
470 btnOptions->setText( tr( "Save output" ) ); 470 btnOptions->setText( tr( "Save output" ) );
471 btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); 471 btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
472 472
473 if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) 473 if ( destination && destination->currentText() != 0 && destination->currentText() != "" )
474 displayAvailableSpace( destination->currentText() ); 474 displayAvailableSpace( destination->currentText() );
475 } 475 }
476} 476}