author | andyq <andyq> | 2002-11-09 15:39:15 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-09 15:39:15 (UTC) |
commit | 5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9 (patch) (unidiff) | |
tree | 3a43ab203aa57960151ba11a091aefaebbf1a566 /noncore/settings/aqpkg/mainwin.cpp | |
parent | a121ae6e8e6f16ba355e8c86eba2b98792c93091 (diff) | |
download | opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.zip opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.tar.gz opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.tar.bz2 |
Added filter menu - contains 3 filters - show uninstalled packages,
show installed packages and show upgraded packages
Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 89 |
1 files changed, 81 insertions, 8 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 | |||
@@ -34,28 +34,33 @@ MainWindow :: MainWindow( QWidget *p, char *name ) | |||
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 ); |
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 ); | ||
51 | 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 ); |
@@ -106,6 +111,74 @@ void MainWindow :: repeatSearchForPackage() | |||
106 | } | 111 | } |
107 | 112 | ||
108 | void MainWindow :: displayAbout() | 113 | void MainWindow :: displayAbout() |
109 | { | 114 | { |
110 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | 115 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); |
111 | } | 116 | } |
117 | |||
118 | |||
119 | void 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 | |||
142 | void 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 | |||
164 | void 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 | } | ||