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
@@ -39,18 +39,23 @@ MainWindow :: MainWindow( QWidget *p, char *name )
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 );
@@ -111 +116,69 @@ void MainWindow :: displayAbout()
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
@@ -38,4 +38,14 @@ private:
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
@@ -48,2 +58,5 @@ public slots:
48 void displaySettings(); 58 void displaySettings();
59 void filterUninstalledPackages();
60 void filterInstalledPackages();
61 void filterUpgradedPackages();
49}; 62};
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
@@ -58,3 +58,8 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
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
@@ -65,4 +70,2 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
65 updateData(); 70 updateData();
66// progressDlg = 0;
67// timerId = startTimer( 100 );
68} 71}
@@ -77,7 +80,4 @@ void NetworkPackageManager :: timerEvent ( QTimerEvent * )
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}
@@ -225,5 +225,22 @@ void NetworkPackageManager :: serverSelected( int )
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
@@ -771 +788,19 @@ void NetworkPackageManager :: searchForPackage( bool findNext )
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
@@ -43,2 +43,6 @@ public:
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:
@@ -58,2 +62,5 @@ private:
58 bool showJumpTo; 62 bool showJumpTo;
63 bool showUninstalledPkgs;
64 bool showInstalledPkgs;
65 bool showUpgradedPkgs;
59 int timerId; 66 int timerId;