summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 459a75b..8a5b90c 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -303,25 +303,25 @@ void MainWindow::searchForPackage( const QString &text )
303 { 303 {
304 m_packageList.ensureItemVisible( item ); 304 m_packageList.ensureItemVisible( item );
305 m_packageList.setCurrentItem( item ); 305 m_packageList.setCurrentItem( item );
306 break; 306 break;
307 } 307 }
308 } 308 }
309 } 309 }
310} 310}
311 311
312void MainWindow::installLocalPackage( const QString &ipkFile ) 312void 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" ),
316 OPackage::Install, 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
320 m_widgetStack.addWidget( dlg, 3 ); 320 m_widgetStack.addWidget( dlg, 3 );
321 m_widgetStack.raiseWidget( dlg ); 321 m_widgetStack.raiseWidget( dlg );
322} 322}
323 323
324void MainWindow::setDocument( const QString &ipkFile ) 324void MainWindow::setDocument( const QString &ipkFile )
325{ 325{
326 QString file = ipkFile; 326 QString file = ipkFile;
327 DocLnk lnk( ipkFile ); 327 DocLnk lnk( ipkFile );
@@ -377,37 +377,37 @@ void MainWindow::slotStatusText( const QString &status )
377{ 377{
378 m_statusText.setText( status ); 378 m_statusText.setText( status );
379} 379}
380 380
381void MainWindow::slotStatusBar( int currStep ) 381void MainWindow::slotStatusBar( int currStep )
382{ 382{
383 m_statusBar.setProgress( currStep ); 383 m_statusBar.setProgress( currStep );
384} 384}
385 385
386void MainWindow::slotUpdate() 386void MainWindow::slotUpdate()
387{ 387{
388 // Create package manager output widget 388 // Create package manager output widget
389 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, 389 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ),
390 OPackage::Update ); 390 OPackage::Update );
391 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 391 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
392 392
393 // Display widget 393 // Display widget
394 m_widgetStack.addWidget( dlg, 3 ); 394 m_widgetStack.addWidget( dlg, 3 );
395 m_widgetStack.raiseWidget( dlg ); 395 m_widgetStack.raiseWidget( dlg );
396} 396}
397 397
398void MainWindow::slotUpgrade() 398void MainWindow::slotUpgrade()
399{ 399{
400 // Create package manager output widget 400 // Create package manager output widget
401 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, 401 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ),
402 OPackage::Upgrade ); 402 OPackage::Upgrade );
403 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 403 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
404 404
405 // Display widget 405 // Display widget
406 m_widgetStack.addWidget( dlg, 3 ); 406 m_widgetStack.addWidget( dlg, 3 );
407 m_widgetStack.raiseWidget( dlg ); 407 m_widgetStack.raiseWidget( dlg );
408} 408}
409 409
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; 413 QStringList workingPackages;
@@ -436,25 +436,25 @@ void MainWindow::slotDownload()
436 if ( ok && !text.isEmpty() ) 436 if ( ok && !text.isEmpty() )
437 workingDir = text; // user entered something and pressed ok 437 workingDir = text; // user entered something and pressed ok
438 else 438 else
439 return; // user entered nothing or pressed cancel 439 return; // user entered nothing or pressed cancel
440 440
441 // Store download directory in config file 441 // Store download directory in config file
442 m_config.writeEntry( "DownloadDir", workingDir ); 442 m_config.writeEntry( "DownloadDir", workingDir );
443 443
444 // Get starting directory 444 // Get starting directory
445 QDir::setCurrent( workingDir ); 445 QDir::setCurrent( workingDir );
446 446
447 // Create package manager output widget 447 // Create package manager output widget
448 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, 448 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ),
449 OPackage::Download, workingPackages ); 449 OPackage::Download, workingPackages );
450 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 450 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
451 451
452 // Display widget 452 // Display widget
453 m_widgetStack.addWidget( dlg, 3 ); 453 m_widgetStack.addWidget( dlg, 3 );
454 m_widgetStack.raiseWidget( dlg ); 454 m_widgetStack.raiseWidget( dlg );
455 } 455 }
456} 456}
457 457
458void MainWindow::slotApply() 458void MainWindow::slotApply()
459{ 459{
460 QStringList removeList; 460 QStringList removeList;
@@ -511,36 +511,33 @@ void MainWindow::slotApply()
511 } 511 }
512 } 512 }
513 } 513 }
514 514
515 // If nothing is selected, display message and exit 515 // If nothing is selected, display message and exit
516 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) 516 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() )
517 { 517 {
518 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" ) );
519 return; 519 return;
520 } 520 }
521 521
522 // Send command only if there are packages to process 522 // Send command only if there are packages to process
523 OPackage::Command removeCmd = OPackage::NotDefined; 523 OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove
524 if ( !removeList.isEmpty() ) 524 : OPackage::NotDefined;
525 removeCmd = OPackage::Remove; 525 OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install
526 OPackage::Command installCmd = OPackage::NotDefined; 526 : OPackage::NotDefined;
527 if ( !installList.isEmpty() ) 527 OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade
528 installCmd = OPackage::Install; 528 : OPackage::NotDefined;
529 OPackage::Command upgradeCmd = OPackage::NotDefined;
530 if ( !upgradeList.isEmpty() )
531 upgradeCmd = OPackage::Upgrade;
532 529
533 // Create package manager output widget 530 // Create package manager output widget
534 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), !installList.isEmpty(), 531 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ),
535 removeCmd, removeList, 532 removeCmd, removeList,
536 installCmd, installList, 533 installCmd, installList,
537 upgradeCmd, upgradeList ); 534 upgradeCmd, upgradeList );
538 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 535 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
539 536
540 // Display widget 537 // Display widget
541 m_widgetStack.addWidget( dlg, 3 ); 538 m_widgetStack.addWidget( dlg, 3 );
542 m_widgetStack.raiseWidget( dlg ); 539 m_widgetStack.raiseWidget( dlg );
543} 540}
544 541
545void MainWindow::slotInstallLocal() 542void MainWindow::slotInstallLocal()
546{ 543{