author | drw <drw> | 2003-01-10 21:07:59 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-10 21:07:59 (UTC) |
commit | 3d5b0fdc15ed9b3ee392e52254aa9db73e2b7dac (patch) (unidiff) | |
tree | a6cb5e1cc109fc9ec54aca9b61726111771f08bf | |
parent | 1c7ae0ce09caf37c3c7d5d284eee390940143a26 (diff) | |
download | opie-3d5b0fdc15ed9b3ee392e52254aa9db73e2b7dac.zip opie-3d5b0fdc15ed9b3ee392e52254aa9db73e2b7dac.tar.gz opie-3d5b0fdc15ed9b3ee392e52254aa9db73e2b7dac.tar.bz2 |
Made find dialog a toolbar, fixed show options under View menu
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 166 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 26 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 52 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 3 |
4 files changed, 125 insertions, 122 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 4aa83b5..e184f6b 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,355 +1,343 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | mainwin.cpp - description | 2 | mainwin.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | begin : Mon Aug 26 13:32:30 BST 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <iostream> | 18 | #include <iostream> |
19 | using namespace std; | 19 | using namespace std; |
20 | 20 | ||
21 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | #include <qaction.h> | 25 | #include <qaction.h> |
26 | #include <qlineedit.h> | ||
26 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
27 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
28 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
29 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwhatsthis.h> | ||
30 | #include <qwidgetstack.h> | 32 | #include <qwidgetstack.h> |
31 | 33 | ||
32 | #include "mainwin.h" | 34 | #include "mainwin.h" |
33 | #include "progresswidget.h" | 35 | #include "progresswidget.h" |
34 | #include "datamgr.h" | 36 | #include "datamgr.h" |
35 | #include "networkpkgmgr.h" | 37 | #include "networkpkgmgr.h" |
36 | #include "settingsimpl.h" | 38 | #include "settingsimpl.h" |
37 | #include "helpwindow.h" | 39 | #include "helpwindow.h" |
38 | #include "utils.h" | 40 | #include "utils.h" |
39 | #include "global.h" | 41 | #include "global.h" |
40 | 42 | ||
41 | MainWindow :: MainWindow() | 43 | MainWindow :: MainWindow() |
42 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 44 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
43 | { | 45 | { |
44 | setCaption( tr( "AQPkg - Package Manager" ) ); | 46 | setCaption( tr( "AQPkg - Package Manager" ) ); |
45 | 47 | ||
46 | // Create UI widgets | 48 | // Create UI widgets |
47 | progressWindow = new ProgressWidget( this ); | 49 | progressWindow = new ProgressWidget( this ); |
48 | networkPkgWindow = new NetworkPackageManager( this ); | 50 | networkPkgWindow = new NetworkPackageManager( this ); |
49 | 51 | ||
50 | // Build menu and tool bars | 52 | // Build menu and tool bars |
51 | setToolBarsMovable( FALSE ); | 53 | setToolBarsMovable( FALSE ); |
52 | 54 | ||
53 | QPEToolBar *bar = new QPEToolBar( this ); | 55 | QPEToolBar *bar = new QPEToolBar( this ); |
54 | bar->setHorizontalStretchable( TRUE ); | 56 | bar->setHorizontalStretchable( TRUE ); |
55 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 57 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
56 | mb->setMargin( 0 ); | 58 | mb->setMargin( 0 ); |
57 | bar = new QPEToolBar( this ); | 59 | bar = new QPEToolBar( this ); |
58 | 60 | ||
61 | // Find toolbar | ||
62 | findBar = new QPEToolBar( this ); | ||
63 | addToolBar( findBar, QMainWindow::Top, true ); | ||
64 | findBar->setHorizontalStretchable( true ); | ||
65 | findEdit = new QLineEdit( findBar ); | ||
66 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | ||
67 | findBar->setStretchableWidget( findEdit ); | ||
68 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | ||
69 | |||
59 | // Packages menu | 70 | // Packages menu |
60 | QPopupMenu *popup = new QPopupMenu( this ); | 71 | QPopupMenu *popup = new QPopupMenu( this ); |
61 | 72 | ||
62 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 73 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
63 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 74 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
64 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( updateServer() ) ); | 75 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( updateServer() ) ); |
65 | a->addTo( popup ); | 76 | a->addTo( popup ); |
66 | a->addTo( bar ); | 77 | a->addTo( bar ); |
67 | 78 | ||
68 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 79 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
69 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 80 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
70 | connect( actionUpgrade, SIGNAL( activated() ), networkPkgWindow, SLOT( upgradePackages() ) ); | 81 | connect( actionUpgrade, SIGNAL( activated() ), networkPkgWindow, SLOT( upgradePackages() ) ); |
71 | actionUpgrade->addTo( popup ); | 82 | actionUpgrade->addTo( popup ); |
72 | actionUpgrade->addTo( bar ); | 83 | actionUpgrade->addTo( bar ); |
73 | 84 | ||
74 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 85 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
75 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 86 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); |
76 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 87 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
77 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 88 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
78 | connect( actionDownload, SIGNAL( activated() ), networkPkgWindow, SLOT( downloadPackage() ) ); | 89 | connect( actionDownload, SIGNAL( activated() ), networkPkgWindow, SLOT( downloadPackage() ) ); |
79 | actionDownload->addTo( popup ); | 90 | actionDownload->addTo( popup ); |
80 | actionDownload->addTo( bar ); | 91 | actionDownload->addTo( bar ); |
81 | 92 | ||
82 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 93 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
83 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 94 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
84 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( applyChanges() ) ); | 95 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( applyChanges() ) ); |
85 | a->addTo( popup ); | 96 | a->addTo( popup ); |
86 | a->addTo( bar ); | 97 | a->addTo( bar ); |
87 | 98 | ||
88 | mb->insertItem( tr( "Packages" ), popup ); | 99 | mb->insertItem( tr( "Packages" ), popup ); |
89 | 100 | ||
90 | // Search menu | 101 | // Search menu |
91 | popup = new QPopupMenu( this ); | 102 | popup = new QPopupMenu( this ); |
92 | 103 | ||
93 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 104 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
94 | a->setWhatsThis( tr( "Click here to search for a specific package." ) ); | 105 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
95 | connect( a, SIGNAL( activated() ), this, SLOT( searchForPackage() ) ); | 106 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
96 | a->addTo( popup ); | 107 | a->addTo( popup ); |
97 | 108 | ||
98 | a = new QAction( tr( "Find next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 109 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
99 | a->setWhatsThis( tr( "Click here to search for the next package." ) ); | 110 | actionFindNext->setEnabled( FALSE ); |
100 | connect( a, SIGNAL( activated() ), this, SLOT( repeatSearchForPackage() ) ); | 111 | actionFindNext->setWhatsThis( tr( "Click here to search for the package name containing the text you are searching for." ) ); |
101 | a->addTo( popup ); | 112 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
113 | actionFindNext->addTo( popup ); | ||
114 | actionFindNext->addTo( findBar ); | ||
102 | 115 | ||
103 | // Show 'quick jump' keypad? | 116 | // Show 'quick jump' keypad? |
104 | 117 | ||
105 | popup->insertSeparator(); | 118 | popup->insertSeparator(); |
106 | 119 | ||
107 | a = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | 120 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); |
108 | a->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | 121 | actionFilter->setToggleAction( TRUE ); |
109 | connect( a, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | 122 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); |
110 | a->addTo( popup ); | 123 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); |
124 | actionFilter->addTo( popup ); | ||
111 | 125 | ||
112 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | 126 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); |
113 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | 127 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); |
114 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 128 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
115 | a->addTo( popup ); | 129 | a->addTo( popup ); |
116 | 130 | ||
117 | mb->insertItem( tr( "Search" ), popup ); | 131 | mb->insertItem( tr( "Search" ), popup ); |
118 | 132 | ||
119 | 133 | ||
120 | // View menu | 134 | // View menu |
121 | popup = new QPopupMenu( this ); | 135 | popup = new QPopupMenu( this ); |
122 | 136 | ||
123 | a = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 137 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
124 | a->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 138 | actionUninstalled->setToggleAction( TRUE ); |
125 | connect( a, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); | 139 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
126 | a->addTo( popup ); | 140 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); |
141 | actionUninstalled->addTo( popup ); | ||
127 | 142 | ||
128 | a = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 143 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
129 | a->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 144 | actionInstalled->setToggleAction( TRUE ); |
130 | connect( a, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); | 145 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
131 | a->addTo( popup ); | 146 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); |
147 | actionInstalled->addTo( popup ); | ||
132 | 148 | ||
133 | a = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 149 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
134 | a->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 150 | actionUpdated->setToggleAction( TRUE ); |
135 | connect( a, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | 151 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
136 | a->addTo( popup ); | 152 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); |
153 | actionUpdated->addTo( popup ); | ||
137 | 154 | ||
138 | popup->insertSeparator(); | 155 | popup->insertSeparator(); |
139 | 156 | ||
140 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); | 157 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); |
141 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 158 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
142 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 159 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
143 | a->addTo( popup ); | 160 | a->addTo( popup ); |
144 | 161 | ||
145 | popup->insertSeparator(); | 162 | popup->insertSeparator(); |
146 | 163 | ||
147 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); | 164 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); |
148 | a->setWhatsThis( tr( "Click here for help." ) ); | 165 | a->setWhatsThis( tr( "Click here for help." ) ); |
149 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); | 166 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); |
150 | a->addTo( popup ); | 167 | a->addTo( popup ); |
151 | 168 | ||
152 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); | 169 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); |
153 | a->setWhatsThis( tr( "Click here for software version information." ) ); | 170 | a->setWhatsThis( tr( "Click here for software version information." ) ); |
154 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); |
155 | a->addTo( popup ); | 172 | a->addTo( popup ); |
156 | 173 | ||
157 | mb->insertItem( tr( "View" ), popup ); | 174 | mb->insertItem( tr( "View" ), popup ); |
175 | |||
176 | // Finish find toolbar creation | ||
177 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | ||
178 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | ||
179 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | ||
180 | a->addTo( findBar ); | ||
181 | findBar->hide(); | ||
158 | 182 | ||
183 | |||
159 | // Create widget stack and add UI widgets | 184 | // Create widget stack and add UI widgets |
160 | stack = new QWidgetStack( this ); | 185 | stack = new QWidgetStack( this ); |
161 | stack->addWidget( progressWindow, 2 ); | 186 | stack->addWidget( progressWindow, 2 ); |
162 | stack->addWidget( networkPkgWindow, 1 ); | 187 | stack->addWidget( networkPkgWindow, 1 ); |
163 | setCentralWidget( stack ); | 188 | setCentralWidget( stack ); |
164 | stack->raiseWidget( progressWindow ); | 189 | stack->raiseWidget( progressWindow ); |
165 | 190 | ||
166 | // Delayed call to finish initialization | 191 | // Delayed call to finish initialization |
167 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 192 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
168 | } | 193 | } |
169 | 194 | ||
170 | MainWindow :: ~MainWindow() | 195 | MainWindow :: ~MainWindow() |
171 | { | 196 | { |
172 | delete mgr; | 197 | delete mgr; |
173 | } | 198 | } |
174 | 199 | ||
175 | void MainWindow :: init() | 200 | void MainWindow :: init() |
176 | { | 201 | { |
177 | stack->raiseWidget( progressWindow ); | 202 | stack->raiseWidget( progressWindow ); |
178 | 203 | ||
179 | mgr = new DataManager(); | 204 | mgr = new DataManager(); |
180 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | 205 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); |
181 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 206 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
182 | progressWindow, SLOT( setMessage( const QString & ) ) ); | 207 | progressWindow, SLOT( setMessage( const QString & ) ) ); |
183 | connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | 208 | connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); |
184 | mgr->loadServers(); | 209 | mgr->loadServers(); |
185 | 210 | ||
186 | networkPkgWindow->setDataManager( mgr ); | 211 | networkPkgWindow->setDataManager( mgr ); |
187 | networkPkgWindow->updateData(); | 212 | networkPkgWindow->updateData(); |
188 | connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); | 213 | connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); |
189 | connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); | 214 | connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); |
190 | connect( networkPkgWindow, SIGNAL( appEnableUpgrade( bool ) ), this, SLOT( enableUpgrade( bool ) ) ); | 215 | connect( networkPkgWindow, SIGNAL( appEnableUpgrade( bool ) ), this, SLOT( enableUpgrade( bool ) ) ); |
191 | connect( networkPkgWindow, SIGNAL( appEnableDownload( bool ) ), this, SLOT( enableDownload( bool ) ) ); | 216 | connect( networkPkgWindow, SIGNAL( appEnableDownload( bool ) ), this, SLOT( enableDownload( bool ) ) ); |
192 | connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | 217 | connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); |
193 | connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), | 218 | connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), |
194 | progressWindow, SLOT( setMessage( const QString & ) ) ); | 219 | progressWindow, SLOT( setMessage( const QString & ) ) ); |
195 | connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | 220 | connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); |
196 | 221 | ||
197 | stack->raiseWidget( networkPkgWindow ); | 222 | stack->raiseWidget( networkPkgWindow ); |
198 | } | 223 | } |
199 | 224 | ||
200 | void MainWindow :: setDocument( const QString &doc ) | 225 | void MainWindow :: setDocument( const QString &doc ) |
201 | { | 226 | { |
202 | // Remove path from package | 227 | // Remove path from package |
203 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 228 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
204 | std::cout << "Selecting package " << package << std::endl; | 229 | std::cout << "Selecting package " << package << std::endl; |
205 | networkPkgWindow->selectLocalPackage( package ); | 230 | networkPkgWindow->selectLocalPackage( package ); |
206 | } | 231 | } |
207 | 232 | ||
208 | void MainWindow :: displaySettings() | 233 | void MainWindow :: displaySettings() |
209 | { | 234 | { |
210 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 235 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
211 | if ( dlg->showDlg( 0 ) ) | 236 | if ( dlg->showDlg( 0 ) ) |
212 | networkPkgWindow->updateData(); | 237 | networkPkgWindow->updateData(); |
213 | delete dlg; | 238 | delete dlg; |
214 | } | 239 | } |
215 | 240 | ||
216 | void MainWindow :: displayHelp() | 241 | void MainWindow :: displayHelp() |
217 | { | 242 | { |
218 | HelpWindow *dlg = new HelpWindow( this ); | 243 | HelpWindow *dlg = new HelpWindow( this ); |
219 | dlg->exec(); | 244 | dlg->exec(); |
220 | delete dlg; | 245 | delete dlg; |
221 | } | 246 | } |
247 | |||
248 | void MainWindow :: displayFindBar() | ||
249 | { | ||
250 | findBar->show(); | ||
251 | findEdit->setFocus(); | ||
252 | } | ||
222 | 253 | ||
223 | void MainWindow :: searchForPackage() | 254 | void MainWindow :: repeatFind() |
224 | { | 255 | { |
225 | networkPkgWindow->searchForPackage( false ); | 256 | networkPkgWindow->searchForPackage( findEdit->text() ); |
226 | } | 257 | } |
227 | 258 | ||
228 | void MainWindow :: repeatSearchForPackage() | 259 | void MainWindow :: findPackage( const QString &text ) |
229 | { | 260 | { |
230 | networkPkgWindow->searchForPackage( true ); | 261 | actionFindNext->setEnabled( !text.isEmpty() ); |
262 | networkPkgWindow->searchForPackage( text ); | ||
263 | } | ||
264 | |||
265 | void MainWindow :: hideFindBar() | ||
266 | { | ||
267 | findBar->hide(); | ||
231 | } | 268 | } |
232 | 269 | ||
233 | void MainWindow :: displayAbout() | 270 | void MainWindow :: displayAbout() |
234 | { | 271 | { |
235 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); | 272 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); |
236 | } | 273 | } |
237 | 274 | ||
238 | |||
239 | void MainWindow :: filterUninstalledPackages() | 275 | void MainWindow :: filterUninstalledPackages() |
240 | { | 276 | { |
241 | bool val; | 277 | networkPkgWindow->showOnlyUninstalledPackages( actionUninstalled->isOn() ); |
242 | if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) | 278 | actionInstalled->setOn( FALSE ); |
243 | { | 279 | actionUpdated->setOn( FALSE ); |
244 | val = false; | ||
245 | filter->setItemChecked( mnuShowUninstalledPkgsId, false ); | ||
246 | } | ||
247 | else | ||
248 | { | ||
249 | val = true; | ||
250 | filter->setItemChecked( mnuShowUninstalledPkgsId, true ); | ||
251 | } | ||
252 | |||
253 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); | ||
254 | networkPkgWindow->showOnlyInstalledPackages( false ); | ||
255 | filter->setItemChecked( mnuShowUpgradedPkgsId, false ); | ||
256 | networkPkgWindow->showUpgradedPackages( false ); | ||
257 | |||
258 | networkPkgWindow->showOnlyUninstalledPackages( val ); | ||
259 | |||
260 | } | 280 | } |
261 | 281 | ||
262 | void MainWindow :: filterInstalledPackages() | 282 | void MainWindow :: filterInstalledPackages() |
263 | { | 283 | { |
264 | bool val; | 284 | actionUninstalled->setOn( FALSE ); |
265 | if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) | 285 | networkPkgWindow->showOnlyInstalledPackages( actionInstalled->isOn() ); |
266 | { | 286 | actionUpdated->setOn( FALSE ); |
267 | val = false; | ||
268 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); | ||
269 | } | ||
270 | else | ||
271 | { | ||
272 | val = true; | ||
273 | filter->setItemChecked( mnuShowInstalledPkgsId, true ); | ||
274 | } | ||
275 | |||
276 | filter->setItemChecked( mnuShowUninstalledPkgsId, false ); | ||
277 | networkPkgWindow->showOnlyUninstalledPackages( false ); | ||
278 | filter->setItemChecked( mnuShowUpgradedPkgsId, false ); | ||
279 | networkPkgWindow->showUpgradedPackages( false ); | ||
280 | |||
281 | networkPkgWindow->showOnlyInstalledPackages( val ); | ||
282 | } | 287 | } |
283 | 288 | ||
284 | void MainWindow :: filterUpgradedPackages() | 289 | void MainWindow :: filterUpgradedPackages() |
285 | { | 290 | { |
286 | bool val; | 291 | actionUninstalled->setOn( FALSE ); |
287 | if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) ) | 292 | actionInstalled->setOn( FALSE ); |
288 | { | 293 | networkPkgWindow->showUpgradedPackages( actionUpdated->isOn() ); |
289 | val = false; | ||
290 | filter->setItemChecked( mnuShowUpgradedPkgsId, false ); | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | val = true; | ||
295 | filter->setItemChecked( mnuShowUpgradedPkgsId, true ); | ||
296 | } | ||
297 | |||
298 | filter->setItemChecked( mnuShowUninstalledPkgsId, false ); | ||
299 | networkPkgWindow->showOnlyUninstalledPackages( false ); | ||
300 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); | ||
301 | networkPkgWindow->showOnlyInstalledPackages( false ); | ||
302 | |||
303 | networkPkgWindow->showUpgradedPackages( val ); | ||
304 | } | 294 | } |
305 | 295 | ||
306 | void MainWindow :: setFilterCategory() | 296 | void MainWindow :: setFilterCategory() |
307 | { | 297 | { |
308 | if ( networkPkgWindow->setFilterCategory( ) ) | 298 | if ( networkPkgWindow->setFilterCategory() ) |
309 | filter->setItemChecked( mnuFilterByCategory, true ); | 299 | actionFilter->setOn( TRUE ); |
310 | } | 300 | } |
311 | 301 | ||
312 | void MainWindow :: filterCategory() | 302 | void MainWindow :: filterCategory() |
313 | { | 303 | { |
314 | if ( filter->isItemChecked( mnuFilterByCategory ) ) | 304 | if ( !actionFilter->isOn() ) |
315 | { | 305 | { |
316 | networkPkgWindow->filterByCategory( false ); | 306 | networkPkgWindow->filterByCategory( FALSE ); |
317 | filter->setItemChecked( mnuFilterByCategory, false ); | ||
318 | } | 307 | } |
319 | else | 308 | else |
320 | { | 309 | { |
321 | if ( networkPkgWindow->filterByCategory( true ) ) | 310 | actionFilter->setOn( networkPkgWindow->filterByCategory( TRUE ) ); |
322 | filter->setItemChecked( mnuFilterByCategory, true ); | ||
323 | } | 311 | } |
324 | } | 312 | } |
325 | 313 | ||
326 | void MainWindow :: raiseMainWidget() | 314 | void MainWindow :: raiseMainWidget() |
327 | { | 315 | { |
328 | stack->raiseWidget( networkPkgWindow ); | 316 | stack->raiseWidget( networkPkgWindow ); |
329 | } | 317 | } |
330 | 318 | ||
331 | void MainWindow :: raiseProgressWidget() | 319 | void MainWindow :: raiseProgressWidget() |
332 | { | 320 | { |
333 | stack->raiseWidget( progressWindow ); | 321 | stack->raiseWidget( progressWindow ); |
334 | } | 322 | } |
335 | 323 | ||
336 | void MainWindow :: enableUpgrade( bool enabled ) | 324 | void MainWindow :: enableUpgrade( bool enabled ) |
337 | { | 325 | { |
338 | actionUpgrade->setEnabled( enabled ); | 326 | actionUpgrade->setEnabled( enabled ); |
339 | } | 327 | } |
340 | 328 | ||
341 | void MainWindow :: enableDownload( bool enabled ) | 329 | void MainWindow :: enableDownload( bool enabled ) |
342 | { | 330 | { |
343 | if ( enabled ) | 331 | if ( enabled ) |
344 | { | 332 | { |
345 | actionDownload->setIconSet( iconDownload ); | 333 | actionDownload->setIconSet( iconDownload ); |
346 | actionDownload->setText( tr( "Download" ) ); | 334 | actionDownload->setText( tr( "Download" ) ); |
347 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 335 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
348 | } | 336 | } |
349 | else | 337 | else |
350 | { | 338 | { |
351 | actionDownload->setIconSet( iconRemove ); | 339 | actionDownload->setIconSet( iconRemove ); |
352 | actionDownload->setText( tr( "Remove" ) ); | 340 | actionDownload->setText( tr( "Remove" ) ); |
353 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); | 341 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); |
354 | } | 342 | } |
355 | } | 343 | } |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 028ef5b..ef67cc9 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -1,83 +1,89 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | mainwin.h - description | 2 | mainwin.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | begin : Mon Aug 26 13:32:30 BST 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
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 <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | //#include <qwidgetstack.h> | ||
24 | 23 | ||
25 | class QWidgetStack; | 24 | class QWidgetStack; |
26 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | class QLineEdit; | ||
27 | class QAction; | 27 | class QAction; |
28 | class ProgressWidget; | 28 | class ProgressWidget; |
29 | class NetworkPackageManager; | 29 | class NetworkPackageManager; |
30 | class DataManager; | 30 | class DataManager; |
31 | 31 | ||
32 | class MainWindow :public QMainWindow | 32 | class MainWindow :public QMainWindow |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | 36 | ||
37 | MainWindow(); | 37 | MainWindow(); |
38 | ~MainWindow(); | 38 | ~MainWindow(); |
39 | 39 | ||
40 | private: | 40 | private: |
41 | DataManager *mgr; | 41 | DataManager *mgr; |
42 | 42 | ||
43 | QMenuBar *menu; | ||
44 | QPopupMenu *help; | ||
45 | QPopupMenu *settings; | ||
46 | QPopupMenu *edit; | ||
47 | QPopupMenu *filter; | ||
48 | QWidgetStack *stack; | 43 | QWidgetStack *stack; |
49 | QAction *actionUpgrade; | 44 | |
50 | QAction *actionDownload; | 45 | QPEToolBar *findBar; |
46 | QLineEdit *findEdit; | ||
47 | QAction *actionFindNext; | ||
48 | QAction *actionFilter; | ||
49 | QAction *actionUpgrade; | ||
50 | QAction *actionDownload; | ||
51 | QAction *actionUninstalled; | ||
52 | QAction *actionInstalled; | ||
53 | QAction *actionUpdated; | ||
54 | |||
51 | QPixmap iconDownload; | 55 | QPixmap iconDownload; |
52 | QPixmap iconRemove; | 56 | QPixmap iconRemove; |
53 | 57 | ||
54 | NetworkPackageManager *networkPkgWindow; | 58 | NetworkPackageManager *networkPkgWindow; |
55 | ProgressWidget *progressWindow; | 59 | ProgressWidget *progressWindow; |
56 | 60 | ||
57 | int mnuShowUninstalledPkgsId; | 61 | int mnuShowUninstalledPkgsId; |
58 | int mnuShowInstalledPkgsId; | 62 | int mnuShowInstalledPkgsId; |
59 | int mnuShowUpgradedPkgsId; | 63 | int mnuShowUpgradedPkgsId; |
60 | int mnuFilterByCategory; | 64 | int mnuFilterByCategory; |
61 | int mnuSetFilterCategory; | 65 | int mnuSetFilterCategory; |
62 | 66 | ||
63 | public slots: | 67 | public slots: |
64 | void setDocument( const QString &doc ); | 68 | void setDocument( const QString &doc ); |
65 | void displayHelp(); | 69 | void displayHelp(); |
66 | void searchForPackage(); | 70 | void displayFindBar(); |
67 | void repeatSearchForPackage(); | 71 | void repeatFind(); |
72 | void findPackage( const QString & ); | ||
73 | void hideFindBar(); | ||
68 | void displayAbout(); | 74 | void displayAbout(); |
69 | void displaySettings(); | 75 | void displaySettings(); |
70 | void filterUninstalledPackages(); | 76 | void filterUninstalledPackages(); |
71 | void filterInstalledPackages(); | 77 | void filterInstalledPackages(); |
72 | void filterUpgradedPackages(); | 78 | void filterUpgradedPackages(); |
73 | void filterCategory(); | 79 | void filterCategory(); |
74 | void setFilterCategory(); | 80 | void setFilterCategory(); |
75 | void raiseMainWidget(); | 81 | void raiseMainWidget(); |
76 | void raiseProgressWidget(); | 82 | void raiseProgressWidget(); |
77 | void enableUpgrade( bool ); | 83 | void enableUpgrade( bool ); |
78 | void enableDownload( bool ); | 84 | void enableDownload( bool ); |
79 | 85 | ||
80 | private slots: | 86 | private slots: |
81 | void init(); | 87 | void init(); |
82 | }; | 88 | }; |
83 | #endif | 89 | #endif |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 91afe02..c209589 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -199,240 +199,241 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) | |||
199 | bool doProgress = ( list.size() > 200 ); | 199 | bool doProgress = ( list.size() > 200 ); |
200 | if ( doProgress ) | 200 | if ( doProgress ) |
201 | { | 201 | { |
202 | if ( raiseProgress ) | 202 | if ( raiseProgress ) |
203 | { | 203 | { |
204 | emit appRaiseProgressWidget(); | 204 | emit appRaiseProgressWidget(); |
205 | } | 205 | } |
206 | emit progressSetSteps( list.size() ); | 206 | emit progressSetSteps( list.size() ); |
207 | emit progressSetMessage( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 207 | emit progressSetMessage( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
208 | } | 208 | } |
209 | 209 | ||
210 | packagesList->clear(); | 210 | packagesList->clear(); |
211 | 211 | ||
212 | #ifdef QWS | 212 | #ifdef QWS |
213 | // read download directory from config file | 213 | // read download directory from config file |
214 | Config cfg( "aqpkg" ); | 214 | Config cfg( "aqpkg" ); |
215 | cfg.setGroup( "settings" ); | 215 | cfg.setGroup( "settings" ); |
216 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 216 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
217 | #endif | 217 | #endif |
218 | 218 | ||
219 | int i = 0; | 219 | int i = 0; |
220 | for ( it = list.begin() ; it != list.end() ; ++it ) | 220 | for ( it = list.begin() ; it != list.end() ; ++it ) |
221 | { | 221 | { |
222 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 222 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
223 | i++; | 223 | i++; |
224 | if ( ( i % 100 ) == 0 ) | 224 | if ( ( i % 100 ) == 0 ) |
225 | { | 225 | { |
226 | if ( doProgress ) | 226 | if ( doProgress ) |
227 | { | 227 | { |
228 | emit progressUpdate( i ); | 228 | emit progressUpdate( i ); |
229 | } | 229 | } |
230 | qApp->processEvents(); | 230 | qApp->processEvents(); |
231 | } | 231 | } |
232 | 232 | ||
233 | QString text = ""; | 233 | QString text = ""; |
234 | 234 | ||
235 | // Apply show only uninstalled packages filter | 235 | // Apply show only uninstalled packages filter |
236 | if ( showUninstalledPkgs && it->isInstalled() ) | 236 | if ( showUninstalledPkgs && it->isInstalled() ) |
237 | continue; | 237 | continue; |
238 | 238 | ||
239 | // Apply show only installed packages filter | 239 | // Apply show only installed packages filter |
240 | if ( showInstalledPkgs && !it->isInstalled() ) | 240 | if ( showInstalledPkgs && !it->isInstalled() ) |
241 | continue; | 241 | continue; |
242 | 242 | ||
243 | // Apply show only new installed packages filter | 243 | // Apply show only new installed packages filter |
244 | if ( showUpgradedPkgs ) | 244 | if ( showUpgradedPkgs ) |
245 | { | 245 | { |
246 | if ( !it->isInstalled() || | 246 | if ( !it->isInstalled() || |
247 | compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) | 247 | compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) |
248 | continue; | 248 | continue; |
249 | } | 249 | } |
250 | 250 | ||
251 | // Apply the section filter | 251 | // Apply the section filter |
252 | if ( categoryFilterEnabled && categoryFilter != "" ) | 252 | if ( categoryFilterEnabled && categoryFilter != "" ) |
253 | { | 253 | { |
254 | if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) | 254 | if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) |
255 | continue; | 255 | continue; |
256 | } | 256 | } |
257 | 257 | ||
258 | // If the local server, only display installed packages | 258 | // If the local server, only display installed packages |
259 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 259 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) |
260 | continue; | 260 | continue; |
261 | 261 | ||
262 | 262 | ||
263 | text += it->getPackageName(); | 263 | text.append( it->getPackageName() ); |
264 | if ( it->isInstalled() ) | 264 | if ( it->isInstalled() ) |
265 | { | 265 | { |
266 | text += " (installed)"; | 266 | text.append( " (installed)" ); |
267 | 267 | ||
268 | // If a different version of package is available, postfix it with an * | 268 | // If a different version of package is available, postfix it with an * |
269 | if ( it->getVersion() != it->getInstalledVersion() ) | 269 | if ( it->getVersion() != it->getInstalledVersion() ) |
270 | { | 270 | { |
271 | 271 | ||
272 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) | 272 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) |
273 | text += "*"; | 273 | text.append( "*" ); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 277 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
278 | 278 | ||
279 | if ( it->isInstalled() ) | 279 | if ( it->isInstalled() ) |
280 | { | 280 | { |
281 | QString destName = ""; | 281 | QString destName = ""; |
282 | if ( it->getLocalPackage() ) | 282 | if ( it->getLocalPackage() ) |
283 | { | 283 | { |
284 | if ( it->getLocalPackage()->getInstalledTo() ) | 284 | if ( it->getLocalPackage()->getInstalledTo() ) |
285 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | 285 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); |
286 | } | 286 | } |
287 | else | 287 | else |
288 | { | 288 | { |
289 | if ( it->getInstalledTo() ) | 289 | if ( it->getInstalledTo() ) |
290 | destName = it->getInstalledTo()->getDestinationName(); | 290 | destName = it->getInstalledTo()->getDestinationName(); |
291 | } | 291 | } |
292 | if ( destName != "" ) | 292 | if ( destName != "" ) |
293 | new QCheckListItem( item, QString( tr( "Installed To - " ) ) + destName ); | 293 | new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); |
294 | } | 294 | } |
295 | 295 | ||
296 | if ( !it->isPackageStoredLocally() ) | 296 | if ( !it->isPackageStoredLocally() ) |
297 | { | 297 | { |
298 | new QCheckListItem( item, QString( tr( "Description - " ) ) + it->getDescription() ); | 298 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); |
299 | new QCheckListItem( item, QString( tr( "Size - " ) ) + it->getPackageSize() ); | 299 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); |
300 | new QCheckListItem( item, QString( tr( "Section - " ) ) + it->getSection() ); | 300 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); |
301 | } | 301 | } |
302 | else | 302 | else |
303 | new QCheckListItem( item, QString( tr( "Filename - " ) ) + it->getFilename() ); | 303 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); |
304 | 304 | ||
305 | if ( serverName == LOCAL_SERVER ) | 305 | if ( serverName == LOCAL_SERVER ) |
306 | { | 306 | { |
307 | new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getVersion() ); | 307 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); |
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | new QCheckListItem( item, QString( tr( "V. Available - " ) ) + it->getVersion() ); | 311 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); |
312 | if ( it->getLocalPackage() ) | 312 | if ( it->getLocalPackage() ) |
313 | { | 313 | { |
314 | if ( it->isInstalled() ) | 314 | if ( it->isInstalled() ) |
315 | new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getInstalledVersion() ); | 315 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | packagesList->insertItem( item ); | 319 | packagesList->insertItem( item ); |
320 | } | 320 | } |
321 | 321 | ||
322 | // If the local server or the local ipkgs server disable the download button | 322 | // If the local server or the local ipkgs server disable the download button |
323 | if ( serverName == LOCAL_SERVER ) | 323 | if ( serverName == LOCAL_SERVER ) |
324 | { | 324 | { |
325 | downloadEnabled = TRUE; | 325 | downloadEnabled = TRUE; |
326 | emit appEnableUpgrade( FALSE ); | 326 | emit appEnableUpgrade( FALSE ); |
327 | } | 327 | } |
328 | else if ( serverName == LOCAL_IPKGS ) | 328 | else if ( serverName == LOCAL_IPKGS ) |
329 | { | 329 | { |
330 | downloadEnabled = FALSE; | 330 | downloadEnabled = FALSE; |
331 | emit appEnableUpgrade( FALSE ); | 331 | emit appEnableUpgrade( FALSE ); |
332 | } | 332 | } |
333 | else | 333 | else |
334 | { | 334 | { |
335 | downloadEnabled = TRUE; | 335 | downloadEnabled = TRUE; |
336 | emit appEnableUpgrade( TRUE ); | 336 | emit appEnableUpgrade( TRUE ); |
337 | } | 337 | } |
338 | emit appEnableDownload( downloadEnabled ); | 338 | emit appEnableDownload( downloadEnabled ); |
339 | 339 | ||
340 | // Display this widget once everything is done | 340 | // Display this widget once everything is done |
341 | if ( doProgress && raiseProgress ) | 341 | if ( doProgress && raiseProgress ) |
342 | { | 342 | { |
343 | emit appRaiseMainWidget(); | 343 | emit appRaiseMainWidget(); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
347 | void NetworkPackageManager :: updateServer() | 347 | void NetworkPackageManager :: updateServer() |
348 | { | 348 | { |
349 | QString serverName = serversList->currentText(); | 349 | QString serverName = serversList->currentText(); |
350 | 350 | ||
351 | // Update the current server | 351 | // Update the current server |
352 | // Display dialog | 352 | // Display dialog |
353 | 353 | ||
354 | // Disable buttons to stop silly people clicking lots on them :) | 354 | // Disable buttons to stop silly people clicking lots on them :) |
355 | 355 | ||
356 | // First, write out ipkg_conf file so that ipkg can use it | 356 | // First, write out ipkg_conf file so that ipkg can use it |
357 | dataMgr->writeOutIpkgConf(); | 357 | dataMgr->writeOutIpkgConf(); |
358 | 358 | ||
359 | Ipkg ipkg; | 359 | Ipkg ipkg; |
360 | ipkg.setOption( "update" ); | 360 | ipkg.setOption( "update" ); |
361 | 361 | ||
362 | InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true ); | 362 | InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true ); |
363 | dlg.showDlg(); | 363 | dlg.showDlg(); |
364 | 364 | ||
365 | // Reload data | 365 | // Reload data |
366 | dataMgr->reloadServerData(); | 366 | dataMgr->reloadServerData(); |
367 | serverSelected(-1); | 367 | serverSelected(-1); |
368 | // delete progDlg; | 368 | // delete progDlg; |
369 | } | 369 | } |
370 | 370 | ||
371 | void NetworkPackageManager :: upgradePackages() | 371 | void NetworkPackageManager :: upgradePackages() |
372 | { | 372 | { |
373 | // We're gonna do an upgrade of all packages | 373 | // We're gonna do an upgrade of all packages |
374 | // First warn user that this isn't recommended | 374 | // First warn user that this isn't recommended |
375 | // TODO - ODevice???? | ||
375 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); | 376 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); |
376 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, | 377 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, |
377 | QMessageBox::Yes, | 378 | QMessageBox::Yes, |
378 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 379 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
379 | 0, this ); | 380 | 0, this ); |
380 | warn.adjustSize(); | 381 | warn.adjustSize(); |
381 | 382 | ||
382 | if ( warn.exec() == QMessageBox::Yes ) | 383 | if ( warn.exec() == QMessageBox::Yes ) |
383 | { | 384 | { |
384 | // First, write out ipkg_conf file so that ipkg can use it | 385 | // First, write out ipkg_conf file so that ipkg can use it |
385 | dataMgr->writeOutIpkgConf(); | 386 | dataMgr->writeOutIpkgConf(); |
386 | 387 | ||
387 | // Now run upgrade | 388 | // Now run upgrade |
388 | Ipkg ipkg; | 389 | Ipkg ipkg; |
389 | ipkg.setOption( "upgrade" ); | 390 | ipkg.setOption( "upgrade" ); |
390 | 391 | ||
391 | InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true ); | 392 | InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true ); |
392 | dlg.showDlg(); | 393 | dlg.showDlg(); |
393 | 394 | ||
394 | // Reload data | 395 | // Reload data |
395 | dataMgr->reloadServerData(); | 396 | dataMgr->reloadServerData(); |
396 | serverSelected(-1); | 397 | serverSelected(-1); |
397 | } | 398 | } |
398 | } | 399 | } |
399 | 400 | ||
400 | 401 | ||
401 | void NetworkPackageManager :: downloadPackage() | 402 | void NetworkPackageManager :: downloadPackage() |
402 | { | 403 | { |
403 | bool doUpdate = true; | 404 | bool doUpdate = true; |
404 | if ( downloadEnabled ) | 405 | if ( downloadEnabled ) |
405 | { | 406 | { |
406 | // See if any packages are selected | 407 | // See if any packages are selected |
407 | bool found = false; | 408 | bool found = false; |
408 | if ( serversList->currentText() != LOCAL_SERVER ) | 409 | if ( serversList->currentText() != LOCAL_SERVER ) |
409 | { | 410 | { |
410 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 411 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
411 | item != 0 && !found; | 412 | item != 0 && !found; |
412 | item = (QCheckListItem *)item->nextSibling() ) | 413 | item = (QCheckListItem *)item->nextSibling() ) |
413 | { | 414 | { |
414 | if ( item->isOn() ) | 415 | if ( item->isOn() ) |
415 | found = true; | 416 | found = true; |
416 | } | 417 | } |
417 | } | 418 | } |
418 | 419 | ||
419 | // If user selected some packages then download the and store the locally | 420 | // If user selected some packages then download the and store the locally |
420 | // otherwise, display dialog asking user what package to download from an http server | 421 | // otherwise, display dialog asking user what package to download from an http server |
421 | // and whether to install it | 422 | // and whether to install it |
422 | if ( found ) | 423 | if ( found ) |
423 | downloadSelectedPackages(); | 424 | downloadSelectedPackages(); |
424 | else | 425 | else |
425 | downloadRemotePackage(); | 426 | downloadRemotePackage(); |
426 | 427 | ||
427 | } | 428 | } |
428 | else | 429 | else |
429 | { | 430 | { |
430 | doUpdate = false; | 431 | doUpdate = false; |
431 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 432 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
432 | item != 0 ; | 433 | item != 0 ; |
433 | item = (QCheckListItem *)item->nextSibling() ) | 434 | item = (QCheckListItem *)item->nextSibling() ) |
434 | { | 435 | { |
435 | if ( item->isOn() ) | 436 | if ( item->isOn() ) |
436 | { | 437 | { |
437 | QString name = item->text(); | 438 | QString name = item->text(); |
438 | int pos = name.find( "*" ); | 439 | int pos = name.find( "*" ); |
@@ -712,158 +713,167 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
712 | break; | 713 | break; |
713 | case 1: // Quit or Escape | 714 | case 1: // Quit or Escape |
714 | item.option = secondOption; | 715 | item.option = secondOption; |
715 | break; | 716 | break; |
716 | } | 717 | } |
717 | } | 718 | } |
718 | else | 719 | else |
719 | { | 720 | { |
720 | // item.option = stickyOption; | 721 | // item.option = stickyOption; |
721 | } | 722 | } |
722 | } | 723 | } |
723 | 724 | ||
724 | 725 | ||
725 | // Check if we are reinstalling the same version | 726 | // Check if we are reinstalling the same version |
726 | if ( item.option != "R" ) | 727 | if ( item.option != "R" ) |
727 | item.recreateLinks = true; | 728 | item.recreateLinks = true; |
728 | else | 729 | else |
729 | item.recreateLinks = false; | 730 | item.recreateLinks = false; |
730 | 731 | ||
731 | // User hit cancel (on dlg - assume remove) | 732 | // User hit cancel (on dlg - assume remove) |
732 | return item; | 733 | return item; |
733 | } | 734 | } |
734 | } | 735 | } |
735 | 736 | ||
736 | void NetworkPackageManager :: displayText( const QString &t ) | 737 | void NetworkPackageManager :: displayText( const QString &t ) |
737 | { | 738 | { |
738 | cout << t << endl; | 739 | cout << t << endl; |
739 | } | 740 | } |
740 | 741 | ||
741 | 742 | ||
742 | void NetworkPackageManager :: letterPushed( QString t ) | 743 | void NetworkPackageManager :: letterPushed( QString t ) |
743 | { | 744 | { |
744 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 745 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
745 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 746 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
746 | if ( packagesList->firstChild() == 0 ) | 747 | if ( packagesList->firstChild() == 0 ) |
747 | return; | 748 | return; |
748 | 749 | ||
749 | QCheckListItem *item; | 750 | QCheckListItem *item; |
750 | if ( start == 0 ) | 751 | if ( start == 0 ) |
751 | { | 752 | { |
752 | item = (QCheckListItem *)packagesList->firstChild(); | 753 | item = (QCheckListItem *)packagesList->firstChild(); |
753 | start = top; | 754 | start = top; |
754 | } | 755 | } |
755 | else | 756 | else |
756 | item = (QCheckListItem *)start->nextSibling(); | 757 | item = (QCheckListItem *)start->nextSibling(); |
757 | 758 | ||
758 | if ( item == 0 ) | 759 | if ( item == 0 ) |
759 | item = (QCheckListItem *)packagesList->firstChild(); | 760 | item = (QCheckListItem *)packagesList->firstChild(); |
760 | do | 761 | do |
761 | { | 762 | { |
762 | if ( item->text().lower().startsWith( t.lower() ) ) | 763 | if ( item->text().lower().startsWith( t.lower() ) ) |
763 | { | 764 | { |
764 | packagesList->setSelected( item, true ); | 765 | packagesList->setSelected( item, true ); |
765 | packagesList->ensureItemVisible( item ); | 766 | packagesList->ensureItemVisible( item ); |
766 | break; | 767 | break; |
767 | } | 768 | } |
768 | 769 | ||
769 | item = (QCheckListItem *)item->nextSibling(); | 770 | item = (QCheckListItem *)item->nextSibling(); |
770 | if ( !item ) | 771 | if ( !item ) |
771 | item = (QCheckListItem *)packagesList->firstChild(); | 772 | item = (QCheckListItem *)packagesList->firstChild(); |
772 | } while ( item != start); | 773 | } while ( item != start); |
773 | } | 774 | } |
774 | 775 | ||
775 | 776 | ||
776 | void NetworkPackageManager :: searchForPackage( bool findNext ) | 777 | void NetworkPackageManager :: searchForPackage( const QString &text ) |
777 | { | 778 | { |
778 | bool ok = false; | 779 | if ( !text.isEmpty() ) |
779 | if ( !findNext || lastSearchText.isEmpty() ) | ||
780 | lastSearchText = InputDialog::getText( tr( "Search for package" ), tr( "Enter package to search for" ), lastSearchText, &ok, this ).lower(); | ||
781 | else | ||
782 | ok = true; | ||
783 | |||
784 | if ( ok && !lastSearchText.isEmpty() ) | ||
785 | { | 780 | { |
786 | cout << "searching for " << lastSearchText << endl; | 781 | cout << "searching for " << text << endl; |
787 | // look through package list for text startng at current position | 782 | // look through package list for text startng at current position |
788 | vector<InstallData> workingPackages; | 783 | vector<InstallData> workingPackages; |
789 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 784 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
790 | if ( start != 0 ) | 785 | if ( start != 0 ) |
791 | start = (QCheckListItem *)start->nextSibling(); | 786 | start = (QCheckListItem *)start->nextSibling(); |
792 | 787 | ||
793 | if ( start == 0 ) | 788 | if ( start == 0 ) |
794 | start = (QCheckListItem *)packagesList->firstChild(); | 789 | start = (QCheckListItem *)packagesList->firstChild(); |
795 | 790 | ||
796 | for ( QCheckListItem *item = start; item != 0 ; | 791 | for ( QCheckListItem *item = start; item != 0 ; |
797 | item = (QCheckListItem *)item->nextSibling() ) | 792 | item = (QCheckListItem *)item->nextSibling() ) |
798 | { | 793 | { |
799 | cout << "checking " << item->text().lower() << endl; | 794 | cout << "checking " << item->text().lower() << endl; |
800 | if ( item->text().lower().find( lastSearchText ) != -1 ) | 795 | if ( item->text().lower().find( text ) != -1 ) |
801 | { | 796 | { |
802 | cout << "matched " << item->text() << endl; | 797 | cout << "matched " << item->text() << endl; |
803 | packagesList->ensureItemVisible( item ); | 798 | packagesList->ensureItemVisible( item ); |
804 | packagesList->setCurrentItem( item ); | 799 | packagesList->setCurrentItem( item ); |
805 | break; | 800 | break; |
806 | } | 801 | } |
807 | } | 802 | } |
808 | } | 803 | } |
809 | } | 804 | } |
810 | 805 | ||
811 | void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) | 806 | void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) |
812 | { | 807 | { |
813 | showUninstalledPkgs = val; | 808 | showUninstalledPkgs = val; |
809 | if ( val ) | ||
810 | { | ||
811 | showInstalledPkgs = FALSE; | ||
812 | showUpgradedPkgs = FALSE; | ||
813 | } | ||
814 | serverSelected( -1 ); | 814 | serverSelected( -1 ); |
815 | } | 815 | } |
816 | 816 | ||
817 | void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) | 817 | void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) |
818 | { | 818 | { |
819 | showInstalledPkgs = val; | 819 | showInstalledPkgs = val; |
820 | if ( val ) | ||
821 | { | ||
822 | showUninstalledPkgs = FALSE; | ||
823 | showUpgradedPkgs = FALSE; | ||
824 | } | ||
820 | serverSelected( -1 ); | 825 | serverSelected( -1 ); |
821 | } | 826 | } |
822 | 827 | ||
823 | void NetworkPackageManager :: showUpgradedPackages( bool val ) | 828 | void NetworkPackageManager :: showUpgradedPackages( bool val ) |
824 | { | 829 | { |
825 | showUpgradedPkgs = val; | 830 | showUpgradedPkgs = val; |
831 | if ( val ) | ||
832 | { | ||
833 | showUninstalledPkgs = FALSE; | ||
834 | showInstalledPkgs = FALSE; | ||
835 | } | ||
826 | serverSelected( -1 ); | 836 | serverSelected( -1 ); |
827 | } | 837 | } |
828 | 838 | ||
829 | bool NetworkPackageManager :: filterByCategory( bool val ) | 839 | bool NetworkPackageManager :: filterByCategory( bool val ) |
830 | { | 840 | { |
831 | if ( val ) | 841 | if ( val ) |
832 | { | 842 | { |
833 | if ( categoryFilter == "" ) | 843 | if ( categoryFilter == "" ) |
834 | { | 844 | { |
835 | if ( !setFilterCategory() ) | 845 | if ( !setFilterCategory() ) |
836 | return false; | 846 | return false; |
837 | } | 847 | } |
838 | 848 | ||
839 | categoryFilterEnabled = true; | 849 | categoryFilterEnabled = true; |
840 | serverSelected( -1 ); | 850 | serverSelected( -1 ); |
841 | return true; | 851 | return true; |
842 | } | 852 | } |
843 | else | 853 | else |
844 | { | 854 | { |
845 | // Turn off filter | 855 | // Turn off filter |
846 | categoryFilterEnabled = false; | 856 | categoryFilterEnabled = false; |
847 | serverSelected( -1 ); | 857 | serverSelected( -1 ); |
848 | return false; | 858 | return false; |
849 | } | 859 | } |
850 | } | 860 | } |
851 | 861 | ||
852 | bool NetworkPackageManager :: setFilterCategory( ) | 862 | bool NetworkPackageManager :: setFilterCategory( ) |
853 | { | 863 | { |
854 | // Get categories; | 864 | // Get categories; |
855 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); | 865 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); |
856 | if ( dlg.exec() == QDialog::Accepted ) | 866 | if ( dlg.exec() == QDialog::Accepted ) |
857 | { | 867 | { |
858 | categoryFilter = dlg.getSelectedFilter(); | 868 | categoryFilter = dlg.getSelectedFilter(); |
859 | 869 | ||
860 | if ( categoryFilter == "" ) | 870 | if ( categoryFilter == "" ) |
861 | return false; | 871 | return false; |
862 | 872 | ||
863 | categoryFilterEnabled = true; | 873 | categoryFilterEnabled = true; |
864 | serverSelected( -1 ); | 874 | serverSelected( -1 ); |
865 | return true; | 875 | return true; |
866 | } | 876 | } |
867 | 877 | ||
868 | return false; | 878 | return false; |
869 | } | 879 | } |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index efef898..bd005e2 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h | |||
@@ -1,97 +1,96 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | networkpkgmgr.h - description | 2 | networkpkgmgr.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | begin : Mon Aug 26 13:32:30 BST 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef NETWORKPKGMGR_H | 18 | #ifndef NETWORKPKGMGR_H |
19 | #define NETWORKPKGMGR_H | 19 | #define NETWORKPKGMGR_H |
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 | 28 | ||
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( QWidget* parent=0, const char *name=0 ); | 37 | NetworkPackageManager( QWidget* parent=0, const char *name=0 ); |
38 | /** destructor */ | 38 | /** destructor */ |
39 | ~NetworkPackageManager(); | 39 | ~NetworkPackageManager(); |
40 | 40 | ||
41 | void setDataManager( DataManager *dm ); | 41 | void setDataManager( DataManager *dm ); |
42 | void selectLocalPackage( const QString &pkg ); | 42 | void selectLocalPackage( const QString &pkg ); |
43 | void updateData(); | 43 | void updateData(); |
44 | void searchForPackage( bool findNext ); | 44 | void searchForPackage( const QString & ); |
45 | void showOnlyUninstalledPackages( bool val ); | 45 | void showOnlyUninstalledPackages( bool val ); |
46 | void showOnlyInstalledPackages( bool val ); | 46 | void showOnlyInstalledPackages( bool val ); |
47 | void showUpgradedPackages( bool val ); | 47 | void showUpgradedPackages( bool val ); |
48 | bool filterByCategory( bool val ); | 48 | bool filterByCategory( bool val ); |
49 | bool setFilterCategory(); | 49 | bool setFilterCategory(); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | DataManager *dataMgr; | 52 | DataManager *dataMgr; |
53 | 53 | ||
54 | QComboBox *serversList; | 54 | QComboBox *serversList; |
55 | QListView *packagesList; | 55 | QListView *packagesList; |
56 | 56 | ||
57 | QString currentlySelectedServer; | 57 | QString currentlySelectedServer; |
58 | QString lastSearchText; | ||
59 | QString categoryFilter; | 58 | QString categoryFilter; |
60 | 59 | ||
61 | bool categoryFilterEnabled; | 60 | bool categoryFilterEnabled; |
62 | bool showJumpTo; | 61 | bool showJumpTo; |
63 | bool showUninstalledPkgs; | 62 | bool showUninstalledPkgs; |
64 | bool showInstalledPkgs; | 63 | bool showInstalledPkgs; |
65 | bool showUpgradedPkgs; | 64 | bool showUpgradedPkgs; |
66 | 65 | ||
67 | bool downloadEnabled; | 66 | bool downloadEnabled; |
68 | 67 | ||
69 | void initGui(); | 68 | void initGui(); |
70 | void showProgressDialog( char *initialText ); | 69 | void showProgressDialog( char *initialText ); |
71 | void downloadSelectedPackages(); | 70 | void downloadSelectedPackages(); |
72 | void downloadRemotePackage(); | 71 | void downloadRemotePackage(); |
73 | void serverSelected( int index, bool showProgress ); | 72 | void serverSelected( int index, bool showProgress ); |
74 | 73 | ||
75 | InstallData dealWithItem( QCheckListItem *item ); | 74 | InstallData dealWithItem( QCheckListItem *item ); |
76 | QString stickyOption; | 75 | QString stickyOption; |
77 | 76 | ||
78 | signals: | 77 | signals: |
79 | void appRaiseMainWidget(); | 78 | void appRaiseMainWidget(); |
80 | void appRaiseProgressWidget(); | 79 | void appRaiseProgressWidget(); |
81 | void appEnableUpgrade( bool ); | 80 | void appEnableUpgrade( bool ); |
82 | void appEnableDownload( bool ); | 81 | void appEnableDownload( bool ); |
83 | void progressSetSteps( int ); | 82 | void progressSetSteps( int ); |
84 | void progressSetMessage( const QString & ); | 83 | void progressSetMessage( const QString & ); |
85 | void progressUpdate( int ); | 84 | void progressUpdate( int ); |
86 | 85 | ||
87 | public slots: | 86 | public slots: |
88 | void applyChanges(); | 87 | void applyChanges(); |
89 | void upgradePackages(); | 88 | void upgradePackages(); |
90 | void downloadPackage(); | 89 | void downloadPackage(); |
91 | void updateServer(); | 90 | void updateServer(); |
92 | void displayText( const QString &t ); | 91 | void displayText( const QString &t ); |
93 | void letterPushed( QString t ); | 92 | void letterPushed( QString t ); |
94 | void serverSelected( int index ); | 93 | void serverSelected( int index ); |
95 | }; | 94 | }; |
96 | 95 | ||
97 | #endif | 96 | #endif |