author | drw <drw> | 2003-04-26 22:42:19 (UTC) |
---|---|---|
committer | drw <drw> | 2003-04-26 22:42:19 (UTC) |
commit | 98a9291263e167b8882ac916330e7215ebd884b4 (patch) (unidiff) | |
tree | 882a909e9381ab4cc97e77377fd61361d7f21eab /noncore/settings/aqpkg/installdlgimpl.cpp | |
parent | 64c48b637c1bd1bef679bff500f3e0ce5365358d (diff) | |
download | opie-98a9291263e167b8882ac916330e7215ebd884b4.zip opie-98a9291263e167b8882ac916330e7215ebd884b4.tar.gz opie-98a9291263e167b8882ac916330e7215ebd884b4.tar.bz2 |
1. Fix for bug #872 - reduce CPU useage while ipkg is doing its thing 2. Re-enable setDocument function for identifying local ipks
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 94 |
1 files changed, 79 insertions, 15 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 76d0a80..896e370 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -46,13 +46,13 @@ | |||
46 | #include "global.h" | 46 | #include "global.h" |
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | MAXLINES = 100, | 49 | MAXLINES = 100, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title ) | 52 | InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) |
53 | : QWidget( 0, 0, 0 ) | 53 | : QWidget( 0, 0, 0 ) |
54 | { | 54 | { |
55 | setCaption( title ); | 55 | setCaption( title ); |
56 | init( TRUE ); | 56 | init( TRUE ); |
57 | 57 | ||
58 | pIpkg = 0; | 58 | pIpkg = 0; |
@@ -103,34 +103,33 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da | |||
103 | InstallData *newitem = new InstallData(); | 103 | InstallData *newitem = new InstallData(); |
104 | 104 | ||
105 | newitem->option = item->option; | 105 | newitem->option = item->option; |
106 | newitem->packageName = item->packageName; | 106 | newitem->packageName = item->packageName; |
107 | newitem->destination = item->destination; | 107 | newitem->destination = item->destination; |
108 | newitem->recreateLinks = item->recreateLinks; | 108 | newitem->recreateLinks = item->recreateLinks; |
109 | packages.append( newitem ); | ||
109 | 110 | ||
110 | if ( item->option == "I" ) | 111 | if ( item->option == "I" ) |
111 | { | 112 | { |
112 | installList.append( newitem ); | ||
113 | install.append( QString( " %1\n" ).arg( item->packageName ) ); | 113 | install.append( QString( " %1\n" ).arg( item->packageName ) ); |
114 | } | 114 | } |
115 | else if ( item->option == "D" ) | 115 | else if ( item->option == "D" ) |
116 | { | 116 | { |
117 | removeList.append( newitem ); | ||
118 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); | 117 | remove.append( QString( " %1\n" ).arg( item->packageName ) ); |
119 | } | 118 | } |
120 | else if ( item->option == "U" || item->option == "R" ) | 119 | else if ( item->option == "U" || item->option == "R" ) |
121 | { | 120 | { |
122 | updateList.append( newitem ); | ||
123 | QString type; | 121 | QString type; |
124 | if ( item->option == "R" ) | 122 | if ( item->option == "R" ) |
125 | type = tr( "(ReInstall)" ); | 123 | type = tr( "(ReInstall)" ); |
126 | else | 124 | else |
127 | type = tr( "(Upgrade)" ); | 125 | type = tr( "(Upgrade)" ); |
128 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); | 126 | upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); |
129 | } | 127 | } |
130 | } | 128 | } |
129 | |||
131 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); | 130 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
132 | 131 | ||
133 | displayAvailableSpace( destination->currentText() ); | 132 | displayAvailableSpace( destination->currentText() ); |
134 | } | 133 | } |
135 | 134 | ||
136 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) | 135 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) |
@@ -265,12 +264,13 @@ void InstallDlgImpl :: installSelected() | |||
265 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); | 264 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); |
266 | 265 | ||
267 | if ( pIpkg ) | 266 | if ( pIpkg ) |
268 | { | 267 | { |
269 | output->setText( "" ); | 268 | output->setText( "" ); |
270 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 269 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
270 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); | ||
271 | pIpkg->runIpkg(); | 271 | pIpkg->runIpkg(); |
272 | } | 272 | } |
273 | else | 273 | else |
274 | { | 274 | { |
275 | output->setText( "" ); | 275 | output->setText( "" ); |
276 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 276 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
@@ -286,14 +286,19 @@ void InstallDlgImpl :: installSelected() | |||
286 | cfg.setGroup( "settings" ); | 286 | cfg.setGroup( "settings" ); |
287 | cfg.writeEntry( "dest", dest ); | 287 | cfg.writeEntry( "dest", dest ); |
288 | #endif | 288 | #endif |
289 | 289 | ||
290 | pIpkg = new Ipkg; | 290 | pIpkg = new Ipkg; |
291 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 291 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
292 | connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); | ||
293 | |||
294 | firstPackage = TRUE; | ||
295 | ipkgFinished(); | ||
292 | 296 | ||
293 | // First run through the remove list, then the install list then the upgrade list | 297 | // First run through the remove list, then the install list then the upgrade list |
298 | /* | ||
294 | pIpkg->setOption( "remove" ); | 299 | pIpkg->setOption( "remove" ); |
295 | QListIterator<InstallData> it( removeList ); | 300 | QListIterator<InstallData> it( removeList ); |
296 | InstallData *idata; | 301 | InstallData *idata; |
297 | for ( ; it.current(); ++it ) | 302 | for ( ; it.current(); ++it ) |
298 | { | 303 | { |
299 | idata = it.current(); | 304 | idata = it.current(); |
@@ -339,24 +344,14 @@ void InstallDlgImpl :: installSelected() | |||
339 | pIpkg->setFlags( tmpFlags, infoLevel ); | 344 | pIpkg->setFlags( tmpFlags, infoLevel ); |
340 | pIpkg->runIpkg(); | 345 | pIpkg->runIpkg(); |
341 | } | 346 | } |
342 | 347 | ||
343 | delete pIpkg; | 348 | delete pIpkg; |
344 | pIpkg = 0; | 349 | pIpkg = 0; |
350 | */ | ||
345 | } | 351 | } |
346 | |||
347 | btnOptions->setEnabled( true ); | ||
348 | // btnInstall->setEnabled( true ); | ||
349 | btnInstall->setText( tr( "Close" ) ); | ||
350 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
351 | |||
352 | btnOptions->setText( tr( "Save output" ) ); | ||
353 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
354 | |||
355 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | ||
356 | displayAvailableSpace( destination->currentText() ); | ||
357 | } | 352 | } |
358 | 353 | ||
359 | 354 | ||
360 | void InstallDlgImpl :: displayText(const QString &text ) | 355 | void InstallDlgImpl :: displayText(const QString &text ) |
361 | { | 356 | { |
362 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); | 357 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
@@ -397,6 +392,75 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | |||
397 | space = tr( "Unknown" ); | 392 | space = tr( "Unknown" ); |
398 | 393 | ||
399 | if ( txtAvailableSpace ) | 394 | if ( txtAvailableSpace ) |
400 | txtAvailableSpace->setText( space ); | 395 | txtAvailableSpace->setText( space ); |
401 | } | 396 | } |
402 | 397 | ||
398 | void InstallDlgImpl :: ipkgFinished() | ||
399 | { | ||
400 | InstallData *item; | ||
401 | if ( firstPackage ) | ||
402 | item = packages.first(); | ||
403 | else | ||
404 | { | ||
405 | // Create symlinks if necessary before moving on to next package | ||
406 | pIpkg->createSymLinks(); | ||
407 | |||
408 | item = packages.next(); | ||
409 | } | ||
410 | |||
411 | firstPackage = FALSE; | ||
412 | if ( item ) | ||
413 | { | ||
414 | pIpkg->setPackage( item->packageName ); | ||
415 | int tmpFlags = flags; | ||
416 | |||
417 | if ( item->option == "I" ) | ||
418 | { | ||
419 | pIpkg->setOption( "install" ); | ||
420 | Destination *d = dataMgr->getDestination( destination->currentText() ); | ||
421 | pIpkg->setDestination( d->getDestinationName() ); | ||
422 | pIpkg->setDestinationDir( d->getDestinationPath() ); | ||
423 | |||
424 | if ( d->linkToRoot() ) | ||
425 | tmpFlags |= MAKE_LINKS; | ||
426 | } | ||
427 | else if ( item->option == "D" ) | ||
428 | { | ||
429 | pIpkg->setOption( "remove" ); | ||
430 | pIpkg->setDestination( item->destination->getDestinationName() ); | ||
431 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | ||
432 | |||
433 | if ( item->destination->linkToRoot() ) | ||
434 | tmpFlags |= MAKE_LINKS; | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | if ( item->option == "R" ) | ||
439 | pIpkg->setOption( "reinstall" ); | ||
440 | else | ||
441 | pIpkg->setOption( "upgrade" ); | ||
442 | |||
443 | pIpkg->setDestination( item->destination->getDestinationName() ); | ||
444 | pIpkg->setDestinationDir( item->destination->getDestinationPath() ); | ||
445 | pIpkg->setPackage( item->packageName ); | ||
446 | |||
447 | tmpFlags |= FORCE_REINSTALL; | ||
448 | if ( item->destination->linkToRoot() && item->recreateLinks ) | ||
449 | tmpFlags |= MAKE_LINKS; | ||
450 | } | ||
451 | pIpkg->setFlags( tmpFlags, infoLevel ); | ||
452 | pIpkg->runIpkg(); | ||
453 | } | ||
454 | else | ||
455 | { | ||
456 | btnOptions->setEnabled( true ); | ||
457 | btnInstall->setText( tr( "Close" ) ); | ||
458 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
459 | |||
460 | btnOptions->setText( tr( "Save output" ) ); | ||
461 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
462 | |||
463 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | ||
464 | displayAvailableSpace( destination->currentText() ); | ||
465 | } | ||
466 | } \ No newline at end of file | ||