summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp89
-rw-r--r--noncore/settings/aqpkg/mainwin.h15
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp51
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h7
4 files changed, 145 insertions, 17 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 3c72f2b..4e9cc12 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -32,32 +32,37 @@ MainWindow :: MainWindow( QWidget *p, char *name )
32{ 32{
33#ifdef QWS 33#ifdef QWS
34 showMaximized(); 34 showMaximized();
35#endif 35#endif
36 36
37 setCaption( "AQPkg - Package Manager" ); 37 setCaption( "AQPkg - Package Manager" );
38 38
39 // Create our menu 39 // Create our menu
40 QPopupMenu *help = new QPopupMenu( this ); 40 help = new QPopupMenu( this );
41 41 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G );
42 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H );
43 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); 42 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
44 43
45 QPopupMenu *settings = new QPopupMenu( this ); 44 settings = new QPopupMenu( this );
46 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); 45 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
47 46
48 QPopupMenu *edit = new QPopupMenu( this ); 47 edit = new QPopupMenu( this );
49 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F ); 48 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I );
50 edit->insertItem( "&Find Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_R ); 49 edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N );
51 50
51 filter = new QPopupMenu( this );
52 mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U );
53 mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S );
54 mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P );
55
52 // Create the main menu 56 // Create the main menu
53 QMenuBar *menu = menuBar(); //new QMenuBar( this ); 57 menu = menuBar(); //new QMenuBar( this );
54 menu->insertItem( "&Settings", settings ); 58 menu->insertItem( "&Settings", settings );
55 menu->insertItem( "&Edit", edit ); 59 menu->insertItem( "&Edit", edit );
60 menu->insertItem( "&Filter", filter );
56 menu->insertItem( "&Help", help ); 61 menu->insertItem( "&Help", help );
57 62
58 mgr = new DataManager(); 63 mgr = new DataManager();
59 mgr->loadServers(); 64 mgr->loadServers();
60 65
61 stack = new QWidgetStack( this ); 66 stack = new QWidgetStack( this );
62 67
63 networkPkgWindow = new NetworkPackageManager( mgr, stack ); 68 networkPkgWindow = new NetworkPackageManager( mgr, stack );
@@ -104,8 +109,76 @@ void MainWindow :: repeatSearchForPackage()
104{ 109{
105 networkPkgWindow->searchForPackage( true ); 110 networkPkgWindow->searchForPackage( true );
106} 111}
107 112
108void MainWindow :: displayAbout() 113void MainWindow :: displayAbout()
109{ 114{
110 QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); 115 QMessageBox::about( this, "About AQPkg", VERSION_TEXT );
111} 116}
117
118
119void MainWindow :: filterUninstalledPackages()
120{
121 bool val;
122 if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) )
123 {
124 val = false;
125 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
126 }
127 else
128 {
129 val = true;
130 filter->setItemChecked( mnuShowUninstalledPkgsId, true );
131 }
132
133 filter->setItemChecked( mnuShowInstalledPkgsId, false );
134 networkPkgWindow->showOnlyInstalledPackages( false );
135 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
136 networkPkgWindow->showUpgradedPackages( false );
137
138 networkPkgWindow->showOnlyUninstalledPackages( val );
139
140}
141
142void MainWindow :: filterInstalledPackages()
143{
144 bool val;
145 if ( filter->isItemChecked( mnuShowInstalledPkgsId ) )
146 {
147 val = false;
148 filter->setItemChecked( mnuShowInstalledPkgsId, false );
149 }
150 else
151 {
152 val = true;
153 filter->setItemChecked( mnuShowInstalledPkgsId, true );
154 }
155
156 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
157 networkPkgWindow->showOnlyUninstalledPackages( false );
158 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
159 networkPkgWindow->showUpgradedPackages( false );
160
161 networkPkgWindow->showOnlyInstalledPackages( val );
162}
163
164void MainWindow :: filterUpgradedPackages()
165{
166 bool val;
167 if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) )
168 {
169 val = false;
170 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
171 }
172 else
173 {
174 val = true;
175 filter->setItemChecked( mnuShowUpgradedPkgsId, true );
176 }
177
178 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
179 networkPkgWindow->showOnlyUninstalledPackages( false );
180 filter->setItemChecked( mnuShowInstalledPkgsId, false );
181 networkPkgWindow->showOnlyInstalledPackages( false );
182
183 networkPkgWindow->showUpgradedPackages( val );
184}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 267233f..7b6e0ba 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -31,20 +31,33 @@ class MainWindow :public QMainWindow
31public: 31public:
32 32
33 MainWindow( QWidget *p = 0, char *name = 0 ); 33 MainWindow( QWidget *p = 0, char *name = 0 );
34 ~MainWindow(); 34 ~MainWindow();
35 35
36private: 36private:
37 DataManager *mgr; 37 DataManager *mgr;
38 38
39 QMenuBar *menu;
40 QPopupMenu *help;
41 QPopupMenu *settings;
42 QPopupMenu *edit;
43 QPopupMenu *filter;
39 QWidgetStack *stack; 44 QWidgetStack *stack;
40 NetworkPackageManager *networkPkgWindow; 45
46 NetworkPackageManager *networkPkgWindow;
47
48 int mnuShowUninstalledPkgsId;
49 int mnuShowInstalledPkgsId;
50 int mnuShowUpgradedPkgsId;
41 51
42public slots: 52public slots:
43 void setDocument( const QString &doc ); 53 void setDocument( const QString &doc );
44 void displayHelp(); 54 void displayHelp();
45 void searchForPackage(); 55 void searchForPackage();
46 void repeatSearchForPackage(); 56 void repeatSearchForPackage();
47 void displayAbout(); 57 void displayAbout();
48 void displaySettings(); 58 void displaySettings();
59 void filterUninstalledPackages();
60 void filterInstalledPackages();
61 void filterUpgradedPackages();
49}; 62};
50#endif 63#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 76c7a9c..d43c6ac 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -51,40 +51,40 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
51 dataMgr = dataManager; 51 dataMgr = dataManager;
52 52
53#ifdef QWS 53#ifdef QWS
54 // read download directory from config file 54 // read download directory from config file
55 Config cfg( "aqpkg" ); 55 Config cfg( "aqpkg" );
56 cfg.setGroup( "settings" ); 56 cfg.setGroup( "settings" );
57 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 57 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
58 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 58 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
59
59#endif 60#endif
61
62 showUninstalledPkgs = false;
63 showInstalledPkgs = false;
64 showUpgradedPkgs = false;
60 65
61 66
62 initGui(); 67 initGui();
63 setupConnections(); 68 setupConnections();
64 69
65 updateData(); 70 updateData();
66// progressDlg = 0;
67// timerId = startTimer( 100 );
68} 71}
69 72
70NetworkPackageManager::~NetworkPackageManager() 73NetworkPackageManager::~NetworkPackageManager()
71{ 74{
72} 75}
73 76
74void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 77void NetworkPackageManager :: timerEvent ( QTimerEvent * )
75{ 78{
76 killTimer( timerId ); 79 killTimer( timerId );
77 80
78// showProgressDialog();
79 // Add server names to listbox 81 // Add server names to listbox
80 updateData(); 82 updateData();
81
82// progressDlg->hide();
83} 83}
84 84
85void NetworkPackageManager :: updateData() 85void NetworkPackageManager :: updateData()
86{ 86{
87 serversList->clear(); 87 serversList->clear();
88 packagesList->clear(); 88 packagesList->clear();
89 89
90 90
@@ -218,19 +218,36 @@ void NetworkPackageManager :: serverSelected( int )
218 218
219 vector<Package> &list = s->getPackageList(); 219 vector<Package> &list = s->getPackageList();
220 vector<Package>::iterator it; 220 vector<Package>::iterator it;
221 for ( it = list.begin() ; it != list.end() ; ++it ) 221 for ( it = list.begin() ; it != list.end() ; ++it )
222 { 222 {
223 223
224 QString text = ""; 224 QString text = "";
225 225
226 // If the local server, only display installed packages 226 // Apply show only uninstalled packages filter
227 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 227 if ( showUninstalledPkgs && it->isInstalled() )
228 continue; 228 continue;
229
230 // Apply show only installed packages filter
231 if ( showInstalledPkgs && !it->isInstalled() )
232 continue;
233
234 // Apply show only new installed packages filter
235 if ( showUpgradedPkgs )
236 {
237 if ( !it->isInstalled() ||
238 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
239 continue;
240 }
241
242 // If the local server, only display installed packages
243 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
244 continue;
245
229 246
230 text += it->getPackageName(); 247 text += it->getPackageName();
231 if ( it->isInstalled() ) 248 if ( it->isInstalled() )
232 { 249 {
233 text += " (installed)"; 250 text += " (installed)";
234 251
235 // If a different version of package is available, postfix it with an * 252 // If a different version of package is available, postfix it with an *
236 if ( it->getVersion() != it->getInstalledVersion() ) 253 if ( it->getVersion() != it->getInstalledVersion() )
@@ -764,8 +781,26 @@ void NetworkPackageManager :: searchForPackage( bool findNext )
764 cout << "matched " << item->text() << endl; 781 cout << "matched " << item->text() << endl;
765 packagesList->ensureItemVisible( item ); 782 packagesList->ensureItemVisible( item );
766 packagesList->setCurrentItem( item ); 783 packagesList->setCurrentItem( item );
767 break; 784 break;
768 } 785 }
769 } 786 }
770 } 787 }
771} 788}
789
790void NetworkPackageManager :: showOnlyUninstalledPackages( bool val )
791{
792 showUninstalledPkgs = val;
793 serverSelected( -1 );
794}
795
796void NetworkPackageManager :: showOnlyInstalledPackages( bool val )
797{
798 showInstalledPkgs = val;
799 serverSelected( -1 );
800}
801
802void NetworkPackageManager :: showUpgradedPackages( bool val )
803{
804 showUpgradedPkgs = val;
805 serverSelected( -1 );
806}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 66a8903..937c9b4 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -36,31 +36,38 @@ public:
36 /** construtor */ 36 /** construtor */
37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); 37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0);
38 /** destructor */ 38 /** destructor */
39 ~NetworkPackageManager(); 39 ~NetworkPackageManager();
40 40
41 void selectLocalPackage( const QString &pkg ); 41 void selectLocalPackage( const QString &pkg );
42 void updateData(); 42 void updateData();
43 void searchForPackage( bool findNext ); 43 void searchForPackage( bool findNext );
44 void showOnlyUninstalledPackages( bool val );
45 void showOnlyInstalledPackages( bool val );
46 void showUpgradedPackages( bool val );
47
44private: 48private:
45 DataManager *dataMgr; 49 DataManager *dataMgr;
46 50
47 QComboBox *serversList; 51 QComboBox *serversList;
48 QListView *packagesList; 52 QListView *packagesList;
49 QPushButton *update; 53 QPushButton *update;
50 QPushButton *upgrade; 54 QPushButton *upgrade;
51 QPushButton *download; 55 QPushButton *download;
52 QPushButton *apply; 56 QPushButton *apply;
53 57
54 ProgressDlg *progressDlg; 58 ProgressDlg *progressDlg;
55 QString currentlySelectedServer; 59 QString currentlySelectedServer;
56 QString lastSearchText; 60 QString lastSearchText;
57 61
58 bool showJumpTo; 62 bool showJumpTo;
63 bool showUninstalledPkgs;
64 bool showInstalledPkgs;
65 bool showUpgradedPkgs;
59 int timerId; 66 int timerId;
60 67
61 void timerEvent ( QTimerEvent * ); 68 void timerEvent ( QTimerEvent * );
62 69
63 void initGui(); 70 void initGui();
64 void setupConnections(); 71 void setupConnections();
65 void showProgressDialog( char *initialText ); 72 void showProgressDialog( char *initialText );
66 void downloadSelectedPackages(); 73 void downloadSelectedPackages();