summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp42
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
@@ -313,7 +313,7 @@ void MainWindow::installLocalPackage( const QString &ipkFile )
313{ 313{
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
319 // Display widget 319 // Display widget
@@ -410,17 +410,17 @@ void MainWindow::slotUpgrade()
410void MainWindow::slotDownload() 410void 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());
416 item != 0 ; 416 item != 0 ;
417 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 417 item = static_cast<QCheckListItem *>(item->nextSibling()) )
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" ) );
426 return; 426 return;
@@ -457,9 +457,9 @@ void MainWindow::slotDownload()
457 457
458void MainWindow::slotApply() 458void 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());
465 item != 0 ; 465 item != 0 ;
@@ -480,15 +480,11 @@ void MainWindow::slotApply()
480 tr( "Remove" ), tr( "Upgrade" ), this ); 480 tr( "Remove" ), tr( "Upgrade" ), this );
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 }
494 else 490 else
@@ -499,31 +495,25 @@ void MainWindow::slotApply()
499 tr( "Remove" ), tr( "Reinstall" ), this ); 495 tr( "Remove" ), tr( "Reinstall" ), this );
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 }
513 } 505 }
514 else 506 else
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 }
522 } 512 }
523 } 513 }
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" ) );
529 return; 519 return;
@@ -531,13 +521,13 @@ void MainWindow::slotApply()
531 521
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
543 // Create package manager output widget 533 // Create package manager output widget