Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 349094d..5e15874 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -314,5 +314,5 @@ void MainWindow::installLocalPackage( const QString &ipkFile ) | |||
314 | // Install selected file | 314 | // Install selected file |
315 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, | 315 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, |
316 | OPackage::Install, new QStringList( ipkFile ) ); | 316 | OPackage::Install, ipkFile ); |
317 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 317 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
318 | 318 | ||
@@ -411,5 +411,5 @@ void MainWindow::slotDownload() | |||
411 | { | 411 | { |
412 | // Retrieve list of packages selected for download (if any) | 412 | // Retrieve list of packages selected for download (if any) |
413 | QStringList *workingPackages = new QStringList(); | 413 | QStringList workingPackages; |
414 | 414 | ||
415 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 415 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
@@ -418,8 +418,8 @@ void MainWindow::slotDownload() | |||
418 | { | 418 | { |
419 | if ( item->isOn() ) | 419 | if ( item->isOn() ) |
420 | workingPackages->append( item->text() ); | 420 | workingPackages.append( item->text() ); |
421 | } | 421 | } |
422 | 422 | ||
423 | if ( workingPackages->isEmpty() ) | 423 | if ( workingPackages.isEmpty() ) |
424 | { | 424 | { |
425 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 425 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
@@ -458,7 +458,7 @@ void MainWindow::slotDownload() | |||
458 | void MainWindow::slotApply() | 458 | void MainWindow::slotApply() |
459 | { | 459 | { |
460 | QStringList *removeList = 0x0; | 460 | QStringList removeList; |
461 | QStringList *installList = 0x0; | 461 | QStringList installList; |
462 | QStringList *upgradeList = 0x0; | 462 | QStringList upgradeList; |
463 | 463 | ||
464 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 464 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
@@ -481,13 +481,9 @@ void MainWindow::slotApply() | |||
481 | if ( answer == 1 ) // Remove | 481 | if ( answer == 1 ) // Remove |
482 | { | 482 | { |
483 | if ( !removeList ) | 483 | removeList.append( item->text() ); |
484 | removeList = new QStringList(); | ||
485 | removeList->append( item->text() ); | ||
486 | } | 484 | } |
487 | else if ( answer == 2 ) // Upgrade | 485 | else if ( answer == 2 ) // Upgrade |
488 | { | 486 | { |
489 | if ( !upgradeList ) | 487 | upgradeList.append( item->text() ); |
490 | upgradeList = new QStringList(); | ||
491 | upgradeList->append( item->text() ); | ||
492 | } | 488 | } |
493 | } | 489 | } |
@@ -500,13 +496,9 @@ void MainWindow::slotApply() | |||
500 | if ( answer == 1 ) // Remove | 496 | if ( answer == 1 ) // Remove |
501 | { | 497 | { |
502 | if ( !removeList ) | 498 | removeList.append( item->text() ); |
503 | removeList = new QStringList(); | ||
504 | removeList->append( item->text() ); | ||
505 | } | 499 | } |
506 | else if ( answer == 2 ) // Reinstall | 500 | else if ( answer == 2 ) // Reinstall |
507 | { | 501 | { |
508 | if ( !installList ) | 502 | installList.append( item->text() ); |
509 | installList = new QStringList(); | ||
510 | installList->append( item->text() ); | ||
511 | } | 503 | } |
512 | } | 504 | } |
@@ -515,7 +507,5 @@ void MainWindow::slotApply() | |||
515 | { | 507 | { |
516 | // Install package | 508 | // Install package |
517 | if ( !installList ) | 509 | installList.append( item->text() ); |
518 | installList = new QStringList(); | ||
519 | installList->append( item->text() ); | ||
520 | } | 510 | } |
521 | } | 511 | } |
@@ -524,5 +514,5 @@ void MainWindow::slotApply() | |||
524 | 514 | ||
525 | // If nothing is selected, display message and exit | 515 | // If nothing is selected, display message and exit |
526 | if ( !removeList && !installList && !upgradeList ) | 516 | if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) |
527 | { | 517 | { |
528 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 518 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
@@ -532,11 +522,11 @@ void MainWindow::slotApply() | |||
532 | // Send command only if there are packages to process | 522 | // Send command only if there are packages to process |
533 | OPackage::Command removeCmd = OPackage::NotDefined; | 523 | OPackage::Command removeCmd = OPackage::NotDefined; |
534 | if ( removeList && !removeList->isEmpty() ) | 524 | if ( !removeList.isEmpty() ) |
535 | removeCmd = OPackage::Remove; | 525 | removeCmd = OPackage::Remove; |
536 | OPackage::Command installCmd = OPackage::NotDefined; | 526 | OPackage::Command installCmd = OPackage::NotDefined; |
537 | if ( installList && !installList->isEmpty() ) | 527 | if ( !installList.isEmpty() ) |
538 | installCmd = OPackage::Install; | 528 | installCmd = OPackage::Install; |
539 | OPackage::Command upgradeCmd = OPackage::NotDefined; | 529 | OPackage::Command upgradeCmd = OPackage::NotDefined; |
540 | if ( upgradeList && !upgradeList->isEmpty() ) | 530 | if ( !upgradeList.isEmpty() ) |
541 | upgradeCmd = OPackage::Upgrade; | 531 | upgradeCmd = OPackage::Upgrade; |
542 | 532 | ||