-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index d84fb4b..9acaaf1 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -385,96 +385,105 @@ void NetworkPackageManager :: downloadPackage() | |||
385 | item != 0 ; | 385 | item != 0 ; |
386 | item = (QCheckListItem *)item->nextSibling() ) | 386 | item = (QCheckListItem *)item->nextSibling() ) |
387 | { | 387 | { |
388 | if ( item->isOn() ) | 388 | if ( item->isOn() ) |
389 | { | 389 | { |
390 | QString name = item->text(); | 390 | QString name = item->text(); |
391 | int pos = name.find( "*" ); | 391 | int pos = name.find( "*" ); |
392 | name.truncate( pos ); | 392 | name.truncate( pos ); |
393 | 393 | ||
394 | // if (there is a (installed), remove it | 394 | // if (there is a (installed), remove it |
395 | pos = name.find( "(installed)" ); | 395 | pos = name.find( "(installed)" ); |
396 | if ( pos > 0 ) | 396 | if ( pos > 0 ) |
397 | name.truncate( pos - 1 ); | 397 | name.truncate( pos - 1 ); |
398 | 398 | ||
399 | Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); | 399 | Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); |
400 | QFile f( p->getFilename() ); | 400 | QFile f( p->getFilename() ); |
401 | f.remove(); | 401 | f.remove(); |
402 | } | 402 | } |
403 | } | 403 | } |
404 | } | 404 | } |
405 | 405 | ||
406 | dataMgr->reloadServerData( LOCAL_IPKGS ); | 406 | dataMgr->reloadServerData( LOCAL_IPKGS ); |
407 | serverSelected( -1 ); | 407 | serverSelected( -1 ); |
408 | } | 408 | } |
409 | 409 | ||
410 | 410 | ||
411 | void NetworkPackageManager :: applyChanges() | 411 | void NetworkPackageManager :: applyChanges() |
412 | { | 412 | { |
413 | stickyOption = ""; | 413 | stickyOption = ""; |
414 | 414 | ||
415 | // First, write out ipkg_conf file so that ipkg can use it | 415 | // First, write out ipkg_conf file so that ipkg can use it |
416 | dataMgr->writeOutIpkgConf(); | 416 | dataMgr->writeOutIpkgConf(); |
417 | 417 | ||
418 | // Now for each selected item | 418 | // Now for each selected item |
419 | // deal with it | 419 | // deal with it |
420 | 420 | ||
421 | vector<InstallData> workingPackages; | 421 | vector<InstallData> workingPackages; |
422 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 422 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
423 | item != 0 ; | 423 | item != 0 ; |
424 | item = (QCheckListItem *)item->nextSibling() ) | 424 | item = (QCheckListItem *)item->nextSibling() ) |
425 | { | 425 | { |
426 | if ( item->isOn() ) | 426 | if ( item->isOn() ) |
427 | { | 427 | { |
428 | InstallData data = dealWithItem( item ); | 428 | InstallData data = dealWithItem( item ); |
429 | workingPackages.push_back( data ); | 429 | workingPackages.push_back( data ); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | if ( workingPackages.size() == 0 ) | ||
434 | { | ||
435 | // Nothing to do | ||
436 | QMessageBox::information( this, "Nothing to do", | ||
437 | "No packages selected", "OK" ); | ||
438 | |||
439 | return; | ||
440 | } | ||
441 | |||
433 | // do the stuff | 442 | // do the stuff |
434 | InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); | 443 | InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); |
435 | dlg.showDlg(); | 444 | dlg.showDlg(); |
436 | 445 | ||
437 | // Reload data | 446 | // Reload data |
438 | dataMgr->reloadServerData( LOCAL_SERVER ); | 447 | dataMgr->reloadServerData( LOCAL_SERVER ); |
439 | 448 | ||
440 | dataMgr->reloadServerData( serversList->currentText() ); | 449 | dataMgr->reloadServerData( serversList->currentText() ); |
441 | serverSelected(-1); | 450 | serverSelected(-1); |
442 | 451 | ||
443 | #ifdef QWS | 452 | #ifdef QWS |
444 | // Finally let the main system update itself | 453 | // Finally let the main system update itself |
445 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 454 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
446 | QString lf = QString::null; | 455 | QString lf = QString::null; |
447 | e << lf; | 456 | e << lf; |
448 | #endif | 457 | #endif |
449 | } | 458 | } |
450 | 459 | ||
451 | // decide what to do - either remove, upgrade or install | 460 | // decide what to do - either remove, upgrade or install |
452 | // Current rules: | 461 | // Current rules: |
453 | // If not installed - install | 462 | // If not installed - install |
454 | // If installed and different version available - upgrade | 463 | // If installed and different version available - upgrade |
455 | // If installed and version up to date - remove | 464 | // If installed and version up to date - remove |
456 | InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | 465 | InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) |
457 | { | 466 | { |
458 | QString name = item->text(); | 467 | QString name = item->text(); |
459 | int pos = name.find( "*" ); | 468 | int pos = name.find( "*" ); |
460 | name.truncate( pos ); | 469 | name.truncate( pos ); |
461 | 470 | ||
462 | // if (there is a (installed), remove it | 471 | // if (there is a (installed), remove it |
463 | pos = name.find( "(installed)" ); | 472 | pos = name.find( "(installed)" ); |
464 | if ( pos > 0 ) | 473 | if ( pos > 0 ) |
465 | name.truncate( pos - 1 ); | 474 | name.truncate( pos - 1 ); |
466 | 475 | ||
467 | // Get package | 476 | // Get package |
468 | Server *s = dataMgr->getServer( serversList->currentText() ); | 477 | Server *s = dataMgr->getServer( serversList->currentText() ); |
469 | Package *p = s->getPackage( name ); | 478 | Package *p = s->getPackage( name ); |
470 | 479 | ||
471 | // If the package has a filename then it is a local file | 480 | // If the package has a filename then it is a local file |
472 | if ( p->isPackageStoredLocally() ) | 481 | if ( p->isPackageStoredLocally() ) |
473 | name = p->getFilename(); | 482 | name = p->getFilename(); |
474 | QString option; | 483 | QString option; |
475 | QString dest = "root"; | 484 | QString dest = "root"; |
476 | if ( !p->isInstalled() ) | 485 | if ( !p->isInstalled() ) |
477 | { | 486 | { |
478 | InstallData item; | 487 | InstallData item; |
479 | item.option = "I"; | 488 | item.option = "I"; |
480 | item.packageName = name; | 489 | item.packageName = name; |