author | drw <drw> | 2003-01-24 02:28:59 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-24 02:28:59 (UTC) |
commit | 342c113c3b7b3a319f49498b82def9f761c1264f (patch) (unidiff) | |
tree | 596c76aded38645435ecc9c1a1a90d603e681465 | |
parent | a6ad63972673fdb2ed9fba33c7c2e5e9cb3968b1 (diff) | |
download | opie-342c113c3b7b3a319f49498b82def9f761c1264f.zip opie-342c113c3b7b3a319f49498b82def9f761c1264f.tar.gz opie-342c113c3b7b3a319f49498b82def9f761c1264f.tar.bz2 |
Make the quick jump to keypad a toolbar like the find bar (option in config dialog will be removed).
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 92 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 3 |
2 files changed, 65 insertions, 30 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index ae073ef..a25f5a7 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -29,99 +29,124 @@ | |||
29 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qmenubar.h> | 35 | #include <qmenubar.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
41 | #include <qwidgetstack.h> | 41 | #include <qwidgetstack.h> |
42 | 42 | ||
43 | #include "categoryfilterimpl.h" | 43 | #include "categoryfilterimpl.h" |
44 | #include "datamgr.h" | 44 | #include "datamgr.h" |
45 | #include "global.h" | 45 | #include "global.h" |
46 | #include "helpwindow.h" | 46 | #include "helpwindow.h" |
47 | #include "inputdlg.h" | 47 | #include "inputdlg.h" |
48 | #include "installdlgimpl.h" | 48 | #include "installdlgimpl.h" |
49 | #include "letterpushbutton.h" | 49 | #include "letterpushbutton.h" |
50 | #include "mainwin.h" | 50 | #include "mainwin.h" |
51 | #include "settingsimpl.h" | 51 | #include "settingsimpl.h" |
52 | #include "utils.h" | 52 | #include "utils.h" |
53 | 53 | ||
54 | extern int compareVersions( const char *v1, const char *v2 ); | 54 | extern int compareVersions( const char *v1, const char *v2 ); |
55 | 55 | ||
56 | MainWindow :: MainWindow() | 56 | MainWindow :: MainWindow() |
57 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 57 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
58 | { | 58 | { |
59 | setCaption( tr( "AQPkg - Package Manager" ) ); | 59 | setCaption( tr( "AQPkg - Package Manager" ) ); |
60 | 60 | ||
61 | #ifdef QWS | ||
62 | // read download directory from config file | ||
63 | Config cfg( "aqpkg" ); | ||
64 | cfg.setGroup( "settings" ); | ||
65 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | ||
66 | showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | ||
67 | |||
68 | #endif | ||
69 | |||
70 | // Create UI widgets | 61 | // Create UI widgets |
71 | initMainWidget(); | 62 | initMainWidget(); |
72 | initProgressWidget(); | 63 | initProgressWidget(); |
73 | 64 | ||
74 | // Build menu and tool bars | 65 | // Build menu and tool bars |
75 | setToolBarsMovable( FALSE ); | 66 | setToolBarsMovable( FALSE ); |
76 | 67 | ||
77 | QPEToolBar *bar = new QPEToolBar( this ); | 68 | QPEToolBar *bar = new QPEToolBar( this ); |
78 | bar->setHorizontalStretchable( TRUE ); | 69 | bar->setHorizontalStretchable( TRUE ); |
79 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 70 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
80 | mb->setMargin( 0 ); | 71 | mb->setMargin( 0 ); |
81 | bar = new QPEToolBar( this ); | 72 | bar = new QPEToolBar( this ); |
82 | 73 | ||
83 | // Find toolbar | 74 | // Find toolbar |
84 | findBar = new QPEToolBar( this ); | 75 | findBar = new QPEToolBar( this ); |
85 | addToolBar( findBar, QMainWindow::Top, true ); | 76 | addToolBar( findBar, QMainWindow::Top, true ); |
86 | findBar->setHorizontalStretchable( true ); | 77 | findBar->setHorizontalStretchable( true ); |
87 | findEdit = new QLineEdit( findBar ); | 78 | findEdit = new QLineEdit( findBar ); |
88 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 79 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
89 | findBar->setStretchableWidget( findEdit ); | 80 | findBar->setStretchableWidget( findEdit ); |
90 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | 81 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); |
82 | |||
83 | // Quick jump toolbar | ||
84 | jumpBar = new QPEToolBar( this ); | ||
85 | addToolBar( jumpBar, QMainWindow::Top, true ); | ||
86 | jumpBar->setHorizontalStretchable( true ); | ||
87 | QWidget *w = new QWidget( jumpBar ); | ||
88 | jumpBar->setStretchableWidget( w ); | ||
91 | 89 | ||
90 | QGridLayout *layout = new QGridLayout( w ); | ||
91 | //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 ); | ||
92 | //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); | ||
93 | //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); | ||
94 | |||
95 | char text[2]; | ||
96 | text[1] = '\0'; | ||
97 | for ( int i = 0 ; i < 26 ; ++i ) | ||
98 | { | ||
99 | text[0] = 'A' + i; | ||
100 | LetterPushButton *b = new LetterPushButton( text, w ); | ||
101 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | ||
102 | layout->addWidget( b, i / 13, i % 13); | ||
103 | /* | ||
104 | if ( i < 13 ) | ||
105 | hbox3->addWidget( b ); | ||
106 | else | ||
107 | hbox4->addWidget( b ); | ||
108 | */ | ||
109 | } | ||
110 | |||
111 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | ||
112 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | ||
113 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | ||
114 | a->addTo( jumpBar ); | ||
115 | jumpBar->hide(); | ||
116 | |||
92 | // Packages menu | 117 | // Packages menu |
93 | QPopupMenu *popup = new QPopupMenu( this ); | 118 | QPopupMenu *popup = new QPopupMenu( this ); |
94 | 119 | ||
95 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 120 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
96 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 121 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
97 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); | 122 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); |
98 | a->addTo( popup ); | 123 | a->addTo( popup ); |
99 | a->addTo( bar ); | 124 | a->addTo( bar ); |
100 | 125 | ||
101 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 126 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
102 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 127 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
103 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); | 128 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); |
104 | actionUpgrade->addTo( popup ); | 129 | actionUpgrade->addTo( popup ); |
105 | actionUpgrade->addTo( bar ); | 130 | actionUpgrade->addTo( bar ); |
106 | 131 | ||
107 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 132 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
108 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 133 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); |
109 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 134 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
110 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 135 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
111 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); | 136 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); |
112 | actionDownload->addTo( popup ); | 137 | actionDownload->addTo( popup ); |
113 | actionDownload->addTo( bar ); | 138 | actionDownload->addTo( bar ); |
114 | 139 | ||
115 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 140 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
116 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 141 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
117 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); | 142 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); |
118 | a->addTo( popup ); | 143 | a->addTo( popup ); |
119 | a->addTo( bar ); | 144 | a->addTo( bar ); |
120 | 145 | ||
121 | mb->insertItem( tr( "Actions" ), popup ); | 146 | mb->insertItem( tr( "Actions" ), popup ); |
122 | 147 | ||
123 | // View menu | 148 | // View menu |
124 | popup = new QPopupMenu( this ); | 149 | popup = new QPopupMenu( this ); |
125 | 150 | ||
126 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 151 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
127 | actionUninstalled->setToggleAction( TRUE ); | 152 | actionUninstalled->setToggleAction( TRUE ); |
@@ -139,64 +164,72 @@ MainWindow :: MainWindow() | |||
139 | actionUpdated->setToggleAction( TRUE ); | 164 | actionUpdated->setToggleAction( TRUE ); |
140 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 165 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
141 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | 166 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); |
142 | actionUpdated->addTo( popup ); | 167 | actionUpdated->addTo( popup ); |
143 | 168 | ||
144 | popup->insertSeparator(); | 169 | popup->insertSeparator(); |
145 | 170 | ||
146 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | 171 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); |
147 | actionFilter->setToggleAction( TRUE ); | 172 | actionFilter->setToggleAction( TRUE ); |
148 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | 173 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); |
149 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | 174 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); |
150 | actionFilter->addTo( popup ); | 175 | actionFilter->addTo( popup ); |
151 | 176 | ||
152 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | 177 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); |
153 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | 178 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); |
154 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 179 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
155 | a->addTo( popup ); | 180 | a->addTo( popup ); |
156 | 181 | ||
157 | popup->insertSeparator(); | 182 | popup->insertSeparator(); |
158 | 183 | ||
159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 184 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
160 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 185 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
161 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | 186 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
162 | a->addTo( popup ); | 187 | a->addTo( popup ); |
163 | 188 | ||
164 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 189 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
165 | actionFindNext->setEnabled( FALSE ); | 190 | actionFindNext->setEnabled( FALSE ); |
166 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 191 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
167 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 192 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
168 | actionFindNext->addTo( popup ); | 193 | actionFindNext->addTo( popup ); |
169 | actionFindNext->addTo( findBar ); | 194 | actionFindNext->addTo( findBar ); |
170 | 195 | ||
196 | |||
197 | popup->insertSeparator(); | ||
198 | |||
199 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | ||
200 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | ||
201 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | ||
202 | a->addTo( popup ); | ||
203 | |||
171 | mb->insertItem( tr( "View" ), popup ); | 204 | mb->insertItem( tr( "View" ), popup ); |
172 | 205 | ||
173 | 206 | ||
174 | // Options menu | 207 | // Options menu |
175 | popup = new QPopupMenu( this ); | 208 | popup = new QPopupMenu( this ); |
176 | 209 | ||
177 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); | 210 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); |
178 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 211 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
179 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 212 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
180 | a->addTo( popup ); | 213 | a->addTo( popup ); |
181 | 214 | ||
182 | popup->insertSeparator(); | 215 | popup->insertSeparator(); |
183 | 216 | ||
184 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); | 217 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); |
185 | a->setWhatsThis( tr( "Click here for help." ) ); | 218 | a->setWhatsThis( tr( "Click here for help." ) ); |
186 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); | 219 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); |
187 | a->addTo( popup ); | 220 | a->addTo( popup ); |
188 | 221 | ||
189 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); | 222 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); |
190 | a->setWhatsThis( tr( "Click here for software version information." ) ); | 223 | a->setWhatsThis( tr( "Click here for software version information." ) ); |
191 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); | 224 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); |
192 | a->addTo( popup ); | 225 | a->addTo( popup ); |
193 | 226 | ||
194 | mb->insertItem( tr( "Options" ), popup ); | 227 | mb->insertItem( tr( "Options" ), popup ); |
195 | 228 | ||
196 | // Finish find toolbar creation | 229 | // Finish find toolbar creation |
197 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 230 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
198 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 231 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
199 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 232 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
200 | a->addTo( findBar ); | 233 | a->addTo( findBar ); |
201 | findBar->hide(); | 234 | findBar->hide(); |
202 | 235 | ||
@@ -208,106 +241,95 @@ MainWindow :: MainWindow() | |||
208 | stack->raiseWidget( progressWindow ); | 241 | stack->raiseWidget( progressWindow ); |
209 | 242 | ||
210 | // Delayed call to finish initialization | 243 | // Delayed call to finish initialization |
211 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 244 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
212 | } | 245 | } |
213 | 246 | ||
214 | MainWindow :: ~MainWindow() | 247 | MainWindow :: ~MainWindow() |
215 | { | 248 | { |
216 | delete mgr; | 249 | delete mgr; |
217 | } | 250 | } |
218 | 251 | ||
219 | void MainWindow :: initMainWidget() | 252 | void MainWindow :: initMainWidget() |
220 | { | 253 | { |
221 | networkPkgWindow = new QWidget( this ); | 254 | networkPkgWindow = new QWidget( this ); |
222 | 255 | ||
223 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); | 256 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); |
224 | 257 | ||
225 | serversList = new QComboBox( networkPkgWindow ); | 258 | serversList = new QComboBox( networkPkgWindow ); |
226 | connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); | 259 | connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); |
227 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); | 260 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); |
228 | 261 | ||
229 | installedIcon = Resource::loadPixmap( "aqpkg/installed" ); | 262 | installedIcon = Resource::loadPixmap( "aqpkg/installed" ); |
230 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); | 263 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); |
231 | 264 | ||
232 | packagesList = new QListView( networkPkgWindow ); | 265 | packagesList = new QListView( networkPkgWindow ); |
233 | packagesList->addColumn( tr( "Packages" ), 225 ); | 266 | packagesList->addColumn( tr( "Packages" ), 225 ); |
234 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 267 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); |
235 | 268 | ||
236 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 269 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
237 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 270 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
238 | hbox1->addWidget( l ); | 271 | hbox1->addWidget( l ); |
239 | hbox1->addWidget( serversList ); | 272 | hbox1->addWidget( serversList ); |
240 | |||
241 | |||
242 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); | ||
243 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); | ||
244 | |||
245 | if ( showJumpTo ) | ||
246 | { | ||
247 | char text[2]; | ||
248 | text[1] = '\0'; | ||
249 | for ( int i = 0 ; i < 26 ; ++i ) | ||
250 | { | ||
251 | text[0] = 'A' + i; | ||
252 | LetterPushButton *b = new LetterPushButton( text, networkPkgWindow ); | ||
253 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | ||
254 | if ( i < 13 ) | ||
255 | hbox3->addWidget( b ); | ||
256 | else | ||
257 | hbox4->addWidget( b ); | ||
258 | } | ||
259 | } | ||
260 | 273 | ||
261 | vbox->addWidget( packagesList ); | 274 | vbox->addWidget( packagesList ); |
262 | 275 | ||
263 | downloadEnabled = TRUE; | 276 | downloadEnabled = TRUE; |
264 | } | 277 | } |
265 | 278 | ||
266 | void MainWindow :: initProgressWidget() | 279 | void MainWindow :: initProgressWidget() |
267 | { | 280 | { |
268 | progressWindow = new QWidget( this ); | 281 | progressWindow = new QWidget( this ); |
269 | 282 | ||
270 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); | 283 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); |
271 | 284 | ||
272 | m_status = new QLabel( progressWindow ); | 285 | m_status = new QLabel( progressWindow ); |
273 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 286 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
274 | layout->addWidget( m_status ); | 287 | layout->addWidget( m_status ); |
275 | 288 | ||
276 | m_progress = new QProgressBar( progressWindow ); | 289 | m_progress = new QProgressBar( progressWindow ); |
277 | layout->addWidget( m_progress ); | 290 | layout->addWidget( m_progress ); |
278 | } | 291 | } |
279 | 292 | ||
280 | void MainWindow :: init() | 293 | void MainWindow :: init() |
281 | { | 294 | { |
295 | #ifdef QWS | ||
296 | // read download directory from config file | ||
297 | Config cfg( "aqpkg" ); | ||
298 | cfg.setGroup( "settings" ); | ||
299 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | ||
300 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | ||
301 | |||
302 | #endif | ||
303 | |||
282 | stack->raiseWidget( progressWindow ); | 304 | stack->raiseWidget( progressWindow ); |
283 | 305 | ||
284 | mgr = new DataManager(); | 306 | mgr = new DataManager(); |
285 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); | 307 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); |
286 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 308 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
287 | this, SLOT( setProgressMessage( const QString & ) ) ); | 309 | this, SLOT( setProgressMessage( const QString & ) ) ); |
288 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); | 310 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); |
289 | mgr->loadServers(); | 311 | mgr->loadServers(); |
290 | 312 | ||
291 | showUninstalledPkgs = false; | 313 | showUninstalledPkgs = false; |
292 | showInstalledPkgs = false; | 314 | showInstalledPkgs = false; |
293 | showUpgradedPkgs = false; | 315 | showUpgradedPkgs = false; |
294 | categoryFilterEnabled = false; | 316 | categoryFilterEnabled = false; |
295 | 317 | ||
296 | updateData(); | 318 | updateData(); |
297 | 319 | ||
298 | stack->raiseWidget( networkPkgWindow ); | 320 | stack->raiseWidget( networkPkgWindow ); |
299 | } | 321 | } |
300 | /* | 322 | /* |
301 | void MainWindow :: setDocument( const QString &doc ) | 323 | void MainWindow :: setDocument( const QString &doc ) |
302 | { | 324 | { |
303 | // Remove path from package | 325 | // Remove path from package |
304 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 326 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
305 | // std::cout << "Selecting package " << package << std::endl; | 327 | // std::cout << "Selecting package " << package << std::endl; |
306 | 328 | ||
307 | // First select local server | 329 | // First select local server |
308 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 330 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
309 | { | 331 | { |
310 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 332 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
311 | { | 333 | { |
312 | serversList->setCurrentItem( i ); | 334 | serversList->setCurrentItem( i ); |
313 | break; | 335 | break; |
@@ -324,80 +346,90 @@ void MainWindow :: setDocument( const QString &doc ) | |||
324 | { | 346 | { |
325 | item->setOn( true ); | 347 | item->setOn( true ); |
326 | break; | 348 | break; |
327 | } | 349 | } |
328 | } | 350 | } |
329 | } | 351 | } |
330 | */ | 352 | */ |
331 | void MainWindow :: displaySettings() | 353 | void MainWindow :: displaySettings() |
332 | { | 354 | { |
333 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 355 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
334 | if ( dlg->showDlg( 0 ) ) | 356 | if ( dlg->showDlg( 0 ) ) |
335 | { | 357 | { |
336 | stack->raiseWidget( progressWindow ); | 358 | stack->raiseWidget( progressWindow ); |
337 | updateData(); | 359 | updateData(); |
338 | stack->raiseWidget( networkPkgWindow ); | 360 | stack->raiseWidget( networkPkgWindow ); |
339 | } | 361 | } |
340 | delete dlg; | 362 | delete dlg; |
341 | } | 363 | } |
342 | 364 | ||
343 | void MainWindow :: displayHelp() | 365 | void MainWindow :: displayHelp() |
344 | { | 366 | { |
345 | HelpWindow *dlg = new HelpWindow( this ); | 367 | HelpWindow *dlg = new HelpWindow( this ); |
346 | dlg->exec(); | 368 | dlg->exec(); |
347 | delete dlg; | 369 | delete dlg; |
348 | } | 370 | } |
349 | 371 | ||
350 | void MainWindow :: displayFindBar() | 372 | void MainWindow :: displayFindBar() |
351 | { | 373 | { |
352 | findBar->show(); | 374 | findBar->show(); |
353 | findEdit->setFocus(); | 375 | findEdit->setFocus(); |
354 | } | 376 | } |
355 | 377 | ||
378 | void MainWindow :: displayJumpBar() | ||
379 | { | ||
380 | jumpBar->show(); | ||
381 | } | ||
382 | |||
356 | void MainWindow :: repeatFind() | 383 | void MainWindow :: repeatFind() |
357 | { | 384 | { |
358 | searchForPackage( findEdit->text() ); | 385 | searchForPackage( findEdit->text() ); |
359 | } | 386 | } |
360 | 387 | ||
361 | void MainWindow :: findPackage( const QString &text ) | 388 | void MainWindow :: findPackage( const QString &text ) |
362 | { | 389 | { |
363 | actionFindNext->setEnabled( !text.isEmpty() ); | 390 | actionFindNext->setEnabled( !text.isEmpty() ); |
364 | searchForPackage( text ); | 391 | searchForPackage( text ); |
365 | } | 392 | } |
366 | 393 | ||
367 | void MainWindow :: hideFindBar() | 394 | void MainWindow :: hideFindBar() |
368 | { | 395 | { |
369 | findBar->hide(); | 396 | findBar->hide(); |
370 | } | 397 | } |
371 | 398 | ||
399 | void MainWindow :: hideJumpBar() | ||
400 | { | ||
401 | jumpBar->hide(); | ||
402 | } | ||
403 | |||
372 | void MainWindow :: displayAbout() | 404 | void MainWindow :: displayAbout() |
373 | { | 405 | { |
374 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); | 406 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); |
375 | } | 407 | } |
376 | 408 | ||
377 | void MainWindow :: filterUninstalledPackages() | 409 | void MainWindow :: filterUninstalledPackages() |
378 | { | 410 | { |
379 | showUninstalledPkgs = actionUninstalled->isOn(); | 411 | showUninstalledPkgs = actionUninstalled->isOn(); |
380 | if ( showUninstalledPkgs ) | 412 | if ( showUninstalledPkgs ) |
381 | { | 413 | { |
382 | showInstalledPkgs = FALSE; | 414 | showInstalledPkgs = FALSE; |
383 | showUpgradedPkgs = FALSE; | 415 | showUpgradedPkgs = FALSE; |
384 | } | 416 | } |
385 | serverSelected( -1 ); | 417 | serverSelected( -1 ); |
386 | 418 | ||
387 | actionInstalled->setOn( FALSE ); | 419 | actionInstalled->setOn( FALSE ); |
388 | actionUpdated->setOn( FALSE ); | 420 | actionUpdated->setOn( FALSE ); |
389 | } | 421 | } |
390 | 422 | ||
391 | void MainWindow :: filterInstalledPackages() | 423 | void MainWindow :: filterInstalledPackages() |
392 | { | 424 | { |
393 | showInstalledPkgs = actionInstalled->isOn(); | 425 | showInstalledPkgs = actionInstalled->isOn(); |
394 | if ( showInstalledPkgs ) | 426 | if ( showInstalledPkgs ) |
395 | { | 427 | { |
396 | showUninstalledPkgs = FALSE; | 428 | showUninstalledPkgs = FALSE; |
397 | showUpgradedPkgs = FALSE; | 429 | showUpgradedPkgs = FALSE; |
398 | } | 430 | } |
399 | serverSelected( -1 ); | 431 | serverSelected( -1 ); |
400 | 432 | ||
401 | actionUninstalled->setOn( FALSE ); | 433 | actionUninstalled->setOn( FALSE ); |
402 | actionUpdated->setOn( FALSE ); | 434 | actionUpdated->setOn( FALSE ); |
403 | } | 435 | } |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index be30668..b49c819 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -19,116 +19,119 @@ | |||
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 | 23 | ||
24 | class DataManager; | 24 | class DataManager; |
25 | class InstallData; | 25 | class InstallData; |
26 | 26 | ||
27 | class QAction; | 27 | class QAction; |
28 | class QCheckListItem; | 28 | class QCheckListItem; |
29 | class QComboBox; | 29 | class QComboBox; |
30 | class QLabel; | 30 | class QLabel; |
31 | class QLineEdit; | 31 | class QLineEdit; |
32 | class QListView; | 32 | class QListView; |
33 | class QPEToolBar; | 33 | class QPEToolBar; |
34 | class QProgressBar; | 34 | class QProgressBar; |
35 | class QWidgetStack; | 35 | class QWidgetStack; |
36 | 36 | ||
37 | class MainWindow :public QMainWindow | 37 | class MainWindow :public QMainWindow |
38 | { | 38 | { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | 41 | ||
42 | MainWindow(); | 42 | MainWindow(); |
43 | ~MainWindow(); | 43 | ~MainWindow(); |
44 | 44 | ||
45 | private: | 45 | private: |
46 | DataManager *mgr; | 46 | DataManager *mgr; |
47 | 47 | ||
48 | QWidgetStack *stack; | 48 | QWidgetStack *stack; |
49 | 49 | ||
50 | QPEToolBar *findBar; | 50 | QPEToolBar *findBar; |
51 | QPEToolBar *jumpBar; | ||
51 | QLineEdit *findEdit; | 52 | QLineEdit *findEdit; |
52 | QAction *actionFindNext; | 53 | QAction *actionFindNext; |
53 | QAction *actionFilter; | 54 | QAction *actionFilter; |
54 | QAction *actionUpgrade; | 55 | QAction *actionUpgrade; |
55 | QAction *actionDownload; | 56 | QAction *actionDownload; |
56 | QAction *actionUninstalled; | 57 | QAction *actionUninstalled; |
57 | QAction *actionInstalled; | 58 | QAction *actionInstalled; |
58 | QAction *actionUpdated; | 59 | QAction *actionUpdated; |
59 | 60 | ||
60 | QPixmap iconDownload; | 61 | QPixmap iconDownload; |
61 | QPixmap iconRemove; | 62 | QPixmap iconRemove; |
62 | 63 | ||
63 | int mnuShowUninstalledPkgsId; | 64 | int mnuShowUninstalledPkgsId; |
64 | int mnuShowInstalledPkgsId; | 65 | int mnuShowInstalledPkgsId; |
65 | int mnuShowUpgradedPkgsId; | 66 | int mnuShowUpgradedPkgsId; |
66 | int mnuFilterByCategory; | 67 | int mnuFilterByCategory; |
67 | int mnuSetFilterCategory; | 68 | int mnuSetFilterCategory; |
68 | 69 | ||
69 | // Main package list widget | 70 | // Main package list widget |
70 | QWidget *networkPkgWindow; | 71 | QWidget *networkPkgWindow; |
71 | QComboBox *serversList; | 72 | QComboBox *serversList; |
72 | QListView *packagesList; | 73 | QListView *packagesList; |
73 | QPixmap installedIcon; | 74 | QPixmap installedIcon; |
74 | QPixmap updatedIcon; | 75 | QPixmap updatedIcon; |
75 | QString currentlySelectedServer; | 76 | QString currentlySelectedServer; |
76 | QString categoryFilter; | 77 | QString categoryFilter; |
77 | QString stickyOption; | 78 | QString stickyOption; |
78 | 79 | ||
79 | bool categoryFilterEnabled; | 80 | bool categoryFilterEnabled; |
80 | bool showJumpTo; | 81 | bool showJumpTo; |
81 | bool showUninstalledPkgs; | 82 | bool showUninstalledPkgs; |
82 | bool showInstalledPkgs; | 83 | bool showInstalledPkgs; |
83 | bool showUpgradedPkgs; | 84 | bool showUpgradedPkgs; |
84 | bool downloadEnabled; | 85 | bool downloadEnabled; |
85 | 86 | ||
86 | void initMainWidget(); | 87 | void initMainWidget(); |
87 | void updateData(); | 88 | void updateData(); |
88 | void serverSelected( int index, bool showProgress ); | 89 | void serverSelected( int index, bool showProgress ); |
89 | void searchForPackage( const QString & ); | 90 | void searchForPackage( const QString & ); |
90 | bool filterByCategory( bool val ); | 91 | bool filterByCategory( bool val ); |
91 | void downloadSelectedPackages(); | 92 | void downloadSelectedPackages(); |
92 | void downloadRemotePackage(); | 93 | void downloadRemotePackage(); |
93 | InstallData dealWithItem( QCheckListItem *item ); | 94 | InstallData dealWithItem( QCheckListItem *item ); |
94 | void reloadData(); | 95 | void reloadData(); |
95 | 96 | ||
96 | // Progress widget | 97 | // Progress widget |
97 | QWidget *progressWindow; | 98 | QWidget *progressWindow; |
98 | QLabel *m_status; | 99 | QLabel *m_status; |
99 | QProgressBar *m_progress; | 100 | QProgressBar *m_progress; |
100 | 101 | ||
101 | void initProgressWidget(); | 102 | void initProgressWidget(); |
102 | 103 | ||
103 | public slots: | 104 | public slots: |
104 | // void setDocument( const QString &doc ); | 105 | // void setDocument( const QString &doc ); |
105 | void displayHelp(); | 106 | void displayHelp(); |
106 | void displayFindBar(); | 107 | void displayFindBar(); |
108 | void displayJumpBar(); | ||
107 | void repeatFind(); | 109 | void repeatFind(); |
108 | void findPackage( const QString & ); | 110 | void findPackage( const QString & ); |
109 | void hideFindBar(); | 111 | void hideFindBar(); |
112 | void hideJumpBar(); | ||
110 | void displayAbout(); | 113 | void displayAbout(); |
111 | void displaySettings(); | 114 | void displaySettings(); |
112 | void filterUninstalledPackages(); | 115 | void filterUninstalledPackages(); |
113 | void filterInstalledPackages(); | 116 | void filterInstalledPackages(); |
114 | void filterUpgradedPackages(); | 117 | void filterUpgradedPackages(); |
115 | void filterCategory(); | 118 | void filterCategory(); |
116 | bool setFilterCategory(); | 119 | bool setFilterCategory(); |
117 | void raiseMainWidget(); | 120 | void raiseMainWidget(); |
118 | void raiseProgressWidget(); | 121 | void raiseProgressWidget(); |
119 | void enableUpgrade( bool ); | 122 | void enableUpgrade( bool ); |
120 | void enableDownload( bool ); | 123 | void enableDownload( bool ); |
121 | 124 | ||
122 | private slots: | 125 | private slots: |
123 | void init(); | 126 | void init(); |
124 | void setProgressSteps( int ); | 127 | void setProgressSteps( int ); |
125 | void setProgressMessage( const QString & ); | 128 | void setProgressMessage( const QString & ); |
126 | void updateProgress( int ); | 129 | void updateProgress( int ); |
127 | void serverSelected( int index ); | 130 | void serverSelected( int index ); |
128 | void updateServer(); | 131 | void updateServer(); |
129 | void upgradePackages(); | 132 | void upgradePackages(); |
130 | void downloadPackage(); | 133 | void downloadPackage(); |
131 | void applyChanges(); | 134 | void applyChanges(); |
132 | void letterPushed( QString t ); | 135 | void letterPushed( QString t ); |
133 | }; | 136 | }; |
134 | #endif | 137 | #endif |