-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 89 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 13 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 45 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 7 |
4 files changed, 141 insertions, 13 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 | |||
@@ -16,64 +16,69 @@ | |||
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <qmenubar.h> | 18 | #include <qmenubar.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | 21 | ||
22 | #include "mainwin.h" | 22 | #include "mainwin.h" |
23 | #include "datamgr.h" | 23 | #include "datamgr.h" |
24 | #include "networkpkgmgr.h" | 24 | #include "networkpkgmgr.h" |
25 | #include "settingsimpl.h" | 25 | #include "settingsimpl.h" |
26 | #include "helpwindow.h" | 26 | #include "helpwindow.h" |
27 | #include "utils.h" | 27 | #include "utils.h" |
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 ); |
68 | } | 73 | } |
69 | 74 | ||
70 | MainWindow :: ~MainWindow() | 75 | MainWindow :: ~MainWindow() |
71 | { | 76 | { |
72 | delete networkPkgWindow; | 77 | delete networkPkgWindow; |
73 | } | 78 | } |
74 | 79 | ||
75 | void MainWindow :: setDocument( const QString &doc ) | 80 | void MainWindow :: setDocument( const QString &doc ) |
76 | { | 81 | { |
77 | // Remove path from package | 82 | // Remove path from package |
78 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 83 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
79 | cout << "Selecting package " << package << endl; | 84 | cout << "Selecting package " << package << endl; |
@@ -88,24 +93,92 @@ void MainWindow :: displaySettings() | |||
88 | delete dlg; | 93 | delete dlg; |
89 | } | 94 | } |
90 | 95 | ||
91 | void MainWindow :: displayHelp() | 96 | void MainWindow :: displayHelp() |
92 | { | 97 | { |
93 | HelpWindow *dlg = new HelpWindow( this ); | 98 | HelpWindow *dlg = new HelpWindow( this ); |
94 | dlg->exec(); | 99 | dlg->exec(); |
95 | delete dlg; | 100 | delete dlg; |
96 | } | 101 | } |
97 | 102 | ||
98 | void MainWindow :: searchForPackage() | 103 | void MainWindow :: searchForPackage() |
99 | { | 104 | { |
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 | } | ||
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 | |||
@@ -15,36 +15,49 @@ | |||
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef MAINWIN_H | 18 | #ifndef MAINWIN_H |
19 | #define MAINWIN_H | 19 | #define MAINWIN_H |
20 | 20 | ||
21 | #include <qmainwindow.h> | 21 | #include <qmainwindow.h> |
22 | #include <qwidgetstack.h> | 22 | #include <qwidgetstack.h> |
23 | 23 | ||
24 | 24 | ||
25 | class NetworkPackageManager; | 25 | class NetworkPackageManager; |
26 | class DataManager; | 26 | class DataManager; |
27 | 27 | ||
28 | class MainWindow :public QMainWindow | 28 | class MainWindow :public QMainWindow |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | 32 | ||
33 | MainWindow( QWidget *p = 0, char *name = 0 ); | 33 | MainWindow( QWidget *p = 0, char *name = 0 ); |
34 | ~MainWindow(); | 34 | ~MainWindow(); |
35 | 35 | ||
36 | private: | 36 | private: |
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; |
45 | |||
40 | NetworkPackageManager *networkPkgWindow; | 46 | NetworkPackageManager *networkPkgWindow; |
41 | 47 | ||
48 | int mnuShowUninstalledPkgsId; | ||
49 | int mnuShowInstalledPkgsId; | ||
50 | int mnuShowUpgradedPkgsId; | ||
51 | |||
42 | public slots: | 52 | public 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 | |||
@@ -35,72 +35,72 @@ using namespace std; | |||
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | 36 | ||
37 | #include "datamgr.h" | 37 | #include "datamgr.h" |
38 | #include "networkpkgmgr.h" | 38 | #include "networkpkgmgr.h" |
39 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
40 | #include "ipkg.h" | 40 | #include "ipkg.h" |
41 | #include "inputdlg.h" | 41 | #include "inputdlg.h" |
42 | #include "letterpushbutton.h" | 42 | #include "letterpushbutton.h" |
43 | 43 | ||
44 | #include "global.h" | 44 | #include "global.h" |
45 | 45 | ||
46 | extern int compareVersions( const char *v1, const char *v2 ); | 46 | extern int compareVersions( const char *v1, const char *v2 ); |
47 | 47 | ||
48 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) | 48 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) |
49 | : QWidget(parent, name) | 49 | : QWidget(parent, name) |
50 | { | 50 | { |
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 |
60 | 61 | ||
62 | showUninstalledPkgs = false; | ||
63 | showInstalledPkgs = false; | ||
64 | showUpgradedPkgs = false; | ||
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 | ||
70 | NetworkPackageManager::~NetworkPackageManager() | 73 | NetworkPackageManager::~NetworkPackageManager() |
71 | { | 74 | { |
72 | } | 75 | } |
73 | 76 | ||
74 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) | 77 | void 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 | ||
85 | void NetworkPackageManager :: updateData() | 85 | void NetworkPackageManager :: updateData() |
86 | { | 86 | { |
87 | serversList->clear(); | 87 | serversList->clear(); |
88 | packagesList->clear(); | 88 | packagesList->clear(); |
89 | 89 | ||
90 | 90 | ||
91 | vector<Server>::iterator it; | 91 | vector<Server>::iterator it; |
92 | int activeItem = -1; | 92 | int activeItem = -1; |
93 | int i; | 93 | int i; |
94 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) | 94 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) |
95 | { | 95 | { |
96 | if ( !it->isServerActive() ) | 96 | if ( !it->isServerActive() ) |
97 | { | 97 | { |
98 | i--; | 98 | i--; |
99 | continue; | 99 | continue; |
100 | } | 100 | } |
101 | serversList->insertItem( it->getServerName() ); | 101 | serversList->insertItem( it->getServerName() ); |
102 | if ( it->getServerName() == currentlySelectedServer ) | 102 | if ( it->getServerName() == currentlySelectedServer ) |
103 | activeItem = i; | 103 | activeItem = i; |
104 | } | 104 | } |
105 | 105 | ||
106 | // set selected server to be active server | 106 | // set selected server to be active server |
@@ -202,52 +202,69 @@ void NetworkPackageManager :: showProgressDialog( char *initialText ) | |||
202 | void NetworkPackageManager :: serverSelected( int ) | 202 | void NetworkPackageManager :: serverSelected( int ) |
203 | { | 203 | { |
204 | packagesList->clear(); | 204 | packagesList->clear(); |
205 | 205 | ||
206 | // display packages | 206 | // display packages |
207 | QString serverName = serversList->currentText(); | 207 | QString serverName = serversList->currentText(); |
208 | currentlySelectedServer = serverName; | 208 | currentlySelectedServer = serverName; |
209 | 209 | ||
210 | #ifdef QWS | 210 | #ifdef QWS |
211 | // read download directory from config file | 211 | // read download directory from config file |
212 | Config cfg( "aqpkg" ); | 212 | Config cfg( "aqpkg" ); |
213 | cfg.setGroup( "settings" ); | 213 | cfg.setGroup( "settings" ); |
214 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 214 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | Server *s = dataMgr->getServer( serverName ); | 217 | Server *s = dataMgr->getServer( serverName ); |
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 | // Apply show only uninstalled packages filter | ||
227 | if ( showUninstalledPkgs && it->isInstalled() ) | ||
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 | |||
226 | // If the local server, only display installed packages | 242 | // If the local server, only display installed packages |
227 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 243 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) |
228 | continue; | 244 | continue; |
229 | 245 | ||
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() ) |
237 | { | 254 | { |
238 | 255 | ||
239 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) | 256 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) |
240 | text += "*"; | 257 | text += "*"; |
241 | } | 258 | } |
242 | } | 259 | } |
243 | 260 | ||
244 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 261 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
245 | 262 | ||
246 | if ( it->isInstalled() ) | 263 | if ( it->isInstalled() ) |
247 | { | 264 | { |
248 | QString destName = ""; | 265 | QString destName = ""; |
249 | if ( it->getLocalPackage() ) | 266 | if ( it->getLocalPackage() ) |
250 | { | 267 | { |
251 | if ( it->getLocalPackage()->getInstalledTo() ) | 268 | if ( it->getLocalPackage()->getInstalledTo() ) |
252 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | 269 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); |
253 | } | 270 | } |
@@ -748,24 +765,42 @@ void NetworkPackageManager :: searchForPackage( bool findNext ) | |||
748 | cout << "searching for " << lastSearchText << endl; | 765 | cout << "searching for " << lastSearchText << endl; |
749 | // look through package list for text startng at current position | 766 | // look through package list for text startng at current position |
750 | vector<InstallData> workingPackages; | 767 | vector<InstallData> workingPackages; |
751 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 768 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
752 | if ( start != 0 ) | 769 | if ( start != 0 ) |
753 | start = (QCheckListItem *)start->nextSibling(); | 770 | start = (QCheckListItem *)start->nextSibling(); |
754 | 771 | ||
755 | if ( start == 0 ) | 772 | if ( start == 0 ) |
756 | start = (QCheckListItem *)packagesList->firstChild(); | 773 | start = (QCheckListItem *)packagesList->firstChild(); |
757 | 774 | ||
758 | for ( QCheckListItem *item = start; item != 0 ; | 775 | for ( QCheckListItem *item = start; item != 0 ; |
759 | item = (QCheckListItem *)item->nextSibling() ) | 776 | item = (QCheckListItem *)item->nextSibling() ) |
760 | { | 777 | { |
761 | cout << "checking " << item->text().lower() << endl; | 778 | cout << "checking " << item->text().lower() << endl; |
762 | if ( item->text().lower().find( lastSearchText ) != -1 ) | 779 | if ( item->text().lower().find( lastSearchText ) != -1 ) |
763 | { | 780 | { |
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 | |||
790 | void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) | ||
791 | { | ||
792 | showUninstalledPkgs = val; | ||
793 | serverSelected( -1 ); | ||
794 | } | ||
795 | |||
796 | void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) | ||
797 | { | ||
798 | showInstalledPkgs = val; | ||
799 | serverSelected( -1 ); | ||
800 | } | ||
801 | |||
802 | void 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 | |||
@@ -20,62 +20,69 @@ | |||
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | 26 | ||
27 | #include "datamgr.h" | 27 | #include "datamgr.h" |
28 | #include "progressdlg.h" | 28 | #include "progressdlg.h" |
29 | class InstallData; | 29 | class InstallData; |
30 | 30 | ||
31 | /** NetworkPackageManager is the base class of the project */ | 31 | /** NetworkPackageManager is the base class of the project */ |
32 | class NetworkPackageManager : public QWidget | 32 | class NetworkPackageManager : public QWidget |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | 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 | |||
44 | private: | 48 | private: |
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(); |
67 | void downloadRemotePackage(); | 74 | void downloadRemotePackage(); |
68 | InstallData dealWithItem( QCheckListItem *item ); | 75 | InstallData dealWithItem( QCheckListItem *item ); |
69 | QString stickyOption; | 76 | QString stickyOption; |
70 | 77 | ||
71 | public slots: | 78 | public slots: |
72 | void serverSelected( int index ); | 79 | void serverSelected( int index ); |
73 | void applyChanges(); | 80 | void applyChanges(); |
74 | void upgradePackages(); | 81 | void upgradePackages(); |
75 | void downloadPackage(); | 82 | void downloadPackage(); |
76 | void updateServer(); | 83 | void updateServer(); |
77 | void displayText( const QString &t ); | 84 | void displayText( const QString &t ); |
78 | void letterPushed( QString t ); | 85 | void letterPushed( QString t ); |
79 | }; | 86 | }; |
80 | 87 | ||
81 | #endif | 88 | #endif |