summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp52
1 files changed, 31 insertions, 21 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 991cc81..807bddd 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,72 +1,72 @@
1/* 1/*
2                This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5             .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++=   -.     .`     .: 20++= -. .` .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "mainwindow.h" 30#include "mainwindow.h"
31#include "installdlg.h" 31#include "installdlg.h"
32#include "filterdlg.h" 32#include "filterdlg.h"
33#include "promptdlg.h" 33#include "promptdlg.h"
34#include "entrydlg.h" 34#include "entrydlg.h"
35#include "packageinfodlg.h" 35#include "packageinfodlg.h"
36 36
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qaction.h> 41#include <qaction.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qlineedit.h> 44#include <qlineedit.h>
45#include <qmenubar.h> 45#include <qmenubar.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47#include <qpopupmenu.h> 47#include <qpopupmenu.h>
48#include <qtimer.h> 48#include <qtimer.h>
49#include <qtoolbar.h> 49#include <qtoolbar.h>
50#include <qwhatsthis.h> 50#include <qwhatsthis.h>
51 51
52MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) 52MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
53 : QMainWindow( parent, name, WStyle_ContextHelp ) 53 : QMainWindow( parent, name, WStyle_ContextHelp )
54 , m_config( "packman" ) 54 , m_config( "packman" )
55 , m_packman( &m_config, this ) 55 , m_packman( &m_config, this )
56 , m_menuBar( this ) 56 , m_menuBar( this )
57 , m_toolBar( this ) 57 , m_toolBar( this )
58 , m_findBar( this ) 58 , m_findBar( this )
59 , m_widgetStack( this ) 59 , m_widgetStack( this )
60 , m_packageList( this ) 60 , m_packageList( this )
61 , m_statusWidget( this ) 61 , m_statusWidget( this )
62 , m_statusText( &m_statusWidget ) 62 , m_statusText( &m_statusWidget )
63 , m_statusBar( &m_statusWidget ) 63 , m_statusBar( &m_statusWidget )
64 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 64 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
65 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 65 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
66 , m_iconNull( m_iconUpdated.size() ) 66 , m_iconNull( m_iconUpdated.size() )
67 , m_filterName( QString::null ) 67 , m_filterName( QString::null )
68 , m_filterServer( QString::null ) 68 , m_filterServer( QString::null )
69 , m_filterDest( QString::null ) 69 , m_filterDest( QString::null )
70 , m_filterStatus( OPackageManager::NotDefined ) 70 , m_filterStatus( OPackageManager::NotDefined )
71 , m_filterCategory( QString::null ) 71 , m_filterCategory( QString::null )
72 72
@@ -486,96 +486,106 @@ void MainWindow::slotApply()
486 installList->append( item->text() ); 486 installList->append( item->text() );
487 } 487 }
488 } 488 }
489 } 489 }
490 } 490 }
491 491
492 // If nothing is selected, display message and exit 492 // If nothing is selected, display message and exit
493 if ( !removeList && !installList && !upgradeList ) 493 if ( !removeList && !installList && !upgradeList )
494 { 494 {
495 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 495 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
496 return; 496 return;
497 } 497 }
498 498
499 // Send command only if there are packages to process 499 // Send command only if there are packages to process
500 OPackage::Command removeCmd = OPackage::NotDefined; 500 OPackage::Command removeCmd = OPackage::NotDefined;
501 if ( removeList && !removeList->isEmpty() ) 501 if ( removeList && !removeList->isEmpty() )
502 removeCmd = OPackage::Remove; 502 removeCmd = OPackage::Remove;
503 OPackage::Command installCmd = OPackage::NotDefined; 503 OPackage::Command installCmd = OPackage::NotDefined;
504 if ( installList && !installList->isEmpty() ) 504 if ( installList && !installList->isEmpty() )
505 installCmd = OPackage::Install; 505 installCmd = OPackage::Install;
506 OPackage::Command upgradeCmd = OPackage::NotDefined; 506 OPackage::Command upgradeCmd = OPackage::NotDefined;
507 if ( upgradeList && !upgradeList->isEmpty() ) 507 if ( upgradeList && !upgradeList->isEmpty() )
508 upgradeCmd = OPackage::Upgrade; 508 upgradeCmd = OPackage::Upgrade;
509 509
510 // Create package manager output widget 510 // Create package manager output widget
511 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 511 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
512 removeCmd, removeList, 512 removeCmd, removeList,
513 installCmd, installList, 513 installCmd, installList,
514 upgradeCmd, upgradeList ); 514 upgradeCmd, upgradeList );
515 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 515 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
516 516
517 // Display widget 517 // Display widget
518 m_widgetStack.addWidget( dlg, 3 ); 518 m_widgetStack.addWidget( dlg, 3 );
519 m_widgetStack.raiseWidget( dlg ); 519 m_widgetStack.raiseWidget( dlg );
520} 520}
521 521
522void MainWindow::slotCloseDlg() 522void MainWindow::slotCloseDlg()
523{ 523{
524 // Close install dialog 524 // Close install dialog
525 delete m_widgetStack.visibleWidget(); 525 delete m_widgetStack.visibleWidget();
526 526
527 // Reload package list 527 // Reload package list
528 initPackageInfo(); 528 initPackageInfo();
529 529
530 // Update Opie launcher links 530 // Update Opie launcher links
531 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 531 QCopEnvelope e("QPE/System", "linkChanged(QString)");
532 QString lf = QString::null; 532 QString lf = QString::null;
533 e << lf; 533 e << lf;
534
535 // Reapply any filters previously set
536 if ( m_actionShowNotInstalled->isOn() )
537 slotShowNotInstalled();
538 else if ( m_actionShowInstalled->isOn() )
539 slotShowInstalled();
540 else if ( m_actionShowUpdated->isOn() )
541 slotShowUpdated();
542 else if ( m_actionFilter->isOn() )
543 slotFilter( true );
534} 544}
535 545
536void MainWindow::slotConfigure() 546void MainWindow::slotConfigure()
537{ 547{
538 if ( m_packman.configureDlg( false ) ) 548 if ( m_packman.configureDlg( false ) )
539 { 549 {
540 if ( PromptDlg::ask( tr( "Config updated" ), 550 if ( PromptDlg::ask( tr( "Config updated" ),
541 tr( "The configuration has been updated. Do you want to update server and package information now?" ), 551 tr( "The configuration has been updated. Do you want to update server and package information now?" ),
542 tr( "Yes" ), tr( "No" ), this ) == 1 ) 552 tr( "Yes" ), tr( "No" ), this ) == 1 )
543 { 553 {
544 // Update package list and reload package info 554 // Update package list and reload package info
545 slotUpdate(); 555 slotUpdate();
546 } 556 }
547 } 557 }
548} 558}
549 559
550void MainWindow::slotShowNotInstalled() 560void MainWindow::slotShowNotInstalled()
551{ 561{
552 OPackageList *packageList; 562 OPackageList *packageList;
553 if ( m_actionShowNotInstalled->isOn() ) 563 if ( m_actionShowNotInstalled->isOn() )
554 { 564 {
555 m_actionShowInstalled->setOn( false ); 565 m_actionShowInstalled->setOn( false );
556 m_actionShowUpdated->setOn( false ); 566 m_actionShowUpdated->setOn( false );
557 m_actionFilter->setOn( false ); 567 m_actionFilter->setOn( false );
558 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 568 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
559 OPackageManager::NotInstalled, QString::null ); 569 OPackageManager::NotInstalled, QString::null );
560 } 570 }
561 else 571 else
562 packageList = m_packman.packages(); 572 packageList = m_packman.packages();
563 573
564 if ( packageList ) 574 if ( packageList )
565 { 575 {
566 loadPackageList( packageList, true ); 576 loadPackageList( packageList, true );
567 delete packageList; 577 delete packageList;
568 } 578 }
569} 579}
570 580
571void MainWindow::slotShowInstalled() 581void MainWindow::slotShowInstalled()
572{ 582{
573 OPackageList *packageList; 583 OPackageList *packageList;
574 if ( m_actionShowInstalled->isOn() ) 584 if ( m_actionShowInstalled->isOn() )
575 { 585 {
576 m_actionShowNotInstalled->setOn( false ); 586 m_actionShowNotInstalled->setOn( false );
577 m_actionShowUpdated->setOn( false ); 587 m_actionShowUpdated->setOn( false );
578 m_actionFilter->setOn( false ); 588 m_actionFilter->setOn( false );
579 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 589 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
580 OPackageManager::Installed, QString::null ); 590 OPackageManager::Installed, QString::null );
581 } 591 }