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 | |||
@@ -28,40 +28,45 @@ | |||
28 | #include "global.h" | 28 | #include "global.h" |
29 | 29 | ||
30 | MainWindow :: MainWindow( QWidget *p, char *name ) | 30 | MainWindow :: MainWindow( QWidget *p, char *name ) |
31 | :QMainWindow( p, name ) | 31 | :QMainWindow( p, 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 ); |
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 ); |
62 | 67 | ||
63 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | 68 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); |
64 | stack->addWidget( networkPkgWindow, 1 ); | 69 | stack->addWidget( networkPkgWindow, 1 ); |
65 | 70 | ||
66 | setCentralWidget( stack ); | 71 | setCentralWidget( stack ); |
67 | stack->raiseWidget( networkPkgWindow ); | 72 | stack->raiseWidget( networkPkgWindow ); |
@@ -100,12 +105,80 @@ void MainWindow :: searchForPackage() | |||
100 | networkPkgWindow->searchForPackage( false ); | 105 | networkPkgWindow->searchForPackage( false ); |
101 | } | 106 | } |
102 | 107 | ||
103 | void MainWindow :: repeatSearchForPackage() | 108 | void MainWindow :: repeatSearchForPackage() |
104 | { | 109 | { |
105 | networkPkgWindow->searchForPackage( true ); | 110 | networkPkgWindow->searchForPackage( true ); |
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 | } | ||