Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 88 |
1 files changed, 61 insertions, 27 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 6f528a1..ed5bf75 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -204,6 +204,24 @@ void NetworkPackageManager :: serverSelected( int ) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 206 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
207 | |||
208 | if ( it->isInstalled() ) | ||
209 | { | ||
210 | QString destName = ""; | ||
211 | if ( it->getLocalPackage() ) | ||
212 | { | ||
213 | if ( it->getLocalPackage()->getInstalledTo() ) | ||
214 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | if ( it->getInstalledTo() ) | ||
219 | destName = it->getInstalledTo()->getDestinationName(); | ||
220 | } | ||
221 | if ( destName != "" ) | ||
222 | new QCheckListItem( item, QString( "Installed To - " ) + destName ); | ||
223 | } | ||
224 | |||
207 | if ( !it->isPackageStoredLocally() ) | 225 | if ( !it->isPackageStoredLocally() ) |
208 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); | 226 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); |
209 | else | 227 | else |
@@ -255,20 +273,13 @@ void NetworkPackageManager :: updateServer() | |||
255 | // First, write out ipkg_conf file so that ipkg can use it | 273 | // First, write out ipkg_conf file so that ipkg can use it |
256 | dataMgr->writeOutIpkgConf(); | 274 | dataMgr->writeOutIpkgConf(); |
257 | 275 | ||
258 | // if ( serverName == LOCAL_SERVER ) | 276 | QString option = "update"; |
259 | // ; | 277 | QString dummy = ""; |
260 | // else if ( serverName == LOCAL_IPKGS ) | 278 | Ipkg ipkg; |
261 | // ; | 279 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
262 | // else | 280 | ipkg.setOption( option ); |
263 | { | 281 | |
264 | QString option = "update"; | 282 | ipkg.runIpkg( ); |
265 | QString dummy = ""; | ||
266 | Ipkg ipkg; | ||
267 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | ||
268 | ipkg.setOption( option ); | ||
269 | |||
270 | ipkg.runIpkg( ); | ||
271 | } | ||
272 | 283 | ||
273 | // Reload data | 284 | // Reload data |
274 | dataMgr->reloadServerData( serversList->currentText() ); | 285 | dataMgr->reloadServerData( serversList->currentText() ); |
@@ -394,7 +405,7 @@ void NetworkPackageManager :: downloadPackage() | |||
394 | 405 | ||
395 | void NetworkPackageManager :: applyChanges() | 406 | void NetworkPackageManager :: applyChanges() |
396 | { | 407 | { |
397 | // Disable buttons to stop silly people clicking lots on them :) | 408 | stickyOption = ""; |
398 | 409 | ||
399 | // First, write out ipkg_conf file so that ipkg can use it | 410 | // First, write out ipkg_conf file so that ipkg can use it |
400 | dataMgr->writeOutIpkgConf(); | 411 | dataMgr->writeOutIpkgConf(); |
@@ -402,15 +413,15 @@ void NetworkPackageManager :: applyChanges() | |||
402 | // Now for each selected item | 413 | // Now for each selected item |
403 | // deal with it | 414 | // deal with it |
404 | 415 | ||
405 | vector<QString> workingPackages; | 416 | vector<InstallData> workingPackages; |
406 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 417 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
407 | item != 0 ; | 418 | item != 0 ; |
408 | item = (QCheckListItem *)item->nextSibling() ) | 419 | item = (QCheckListItem *)item->nextSibling() ) |
409 | { | 420 | { |
410 | if ( item->isOn() ) | 421 | if ( item->isOn() ) |
411 | { | 422 | { |
412 | QString p = dealWithItem( item ); | 423 | InstallData data = dealWithItem( item ); |
413 | workingPackages.push_back( p ); | 424 | workingPackages.push_back( data ); |
414 | } | 425 | } |
415 | } | 426 | } |
416 | 427 | ||
@@ -437,7 +448,7 @@ void NetworkPackageManager :: applyChanges() | |||
437 | // If not installed - install | 448 | // If not installed - install |
438 | // If installed and different version available - upgrade | 449 | // If installed and different version available - upgrade |
439 | // If installed and version up to date - remove | 450 | // If installed and version up to date - remove |
440 | QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | 451 | InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) |
441 | { | 452 | { |
442 | QString name = item->text(); | 453 | QString name = item->text(); |
443 | int pos = name.find( "*" ); | 454 | int pos = name.find( "*" ); |
@@ -458,10 +469,25 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
458 | QString option; | 469 | QString option; |
459 | QString dest = "root"; | 470 | QString dest = "root"; |
460 | if ( !p->isInstalled() ) | 471 | if ( !p->isInstalled() ) |
461 | return QString( "I" ) + name; | 472 | { |
473 | InstallData item; | ||
474 | item.option = "I"; | ||
475 | item.packageName = name; | ||
476 | return item; | ||
477 | } | ||
462 | else | 478 | else |
463 | { | 479 | { |
464 | if ( p->getVersion() == p->getInstalledVersion() ) | 480 | InstallData item; |
481 | item.option = "D"; | ||
482 | item.packageName = name; | ||
483 | if ( p->getInstalledTo() ) | ||
484 | item.destination = p->getInstalledTo(); | ||
485 | else | ||
486 | item.destination = p->getLocalPackage()->getInstalledTo(); | ||
487 | |||
488 | // Sticky option not implemented yet, but will eventually allow | ||
489 | // the user to say something like 'remove all' | ||
490 | if ( stickyOption == "" ) | ||
465 | { | 491 | { |
466 | QString msgtext; | 492 | QString msgtext; |
467 | msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); | 493 | msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); |
@@ -469,18 +495,26 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
469 | msgtext, "Remove", "ReInstall" ) ) | 495 | msgtext, "Remove", "ReInstall" ) ) |
470 | { | 496 | { |
471 | case 0: // Try again or Enter | 497 | case 0: // Try again or Enter |
472 | return QString( "D" ) + name; | 498 | item.option = "D"; |
473 | break; | 499 | break; |
474 | case 1: // Quit or Escape | 500 | case 1: // Quit or Escape |
475 | return QString( "U" ) + name; | 501 | item.option = "U"; |
476 | break; | 502 | break; |
477 | } | 503 | } |
478 | |||
479 | // User hit cancel (on dlg - assume remove) | ||
480 | return QString( "D" ) + name; | ||
481 | } | 504 | } |
482 | else | 505 | else |
483 | return QString( "U" ) + name; | 506 | { |
507 | // item.option = stickyOption; | ||
508 | } | ||
509 | |||
510 | // Check if we are reinstalling the same version | ||
511 | if ( p->getVersion() != p->getInstalledVersion() ) | ||
512 | item.recreateLinks = true; | ||
513 | else | ||
514 | item.recreateLinks = false; | ||
515 | |||
516 | // User hit cancel (on dlg - assume remove) | ||
517 | return item; | ||
484 | } | 518 | } |
485 | } | 519 | } |
486 | 520 | ||