summaryrefslogtreecommitdiff
authordrw <drw>2003-03-08 21:40:12 (UTC)
committer drw <drw>2003-03-08 21:40:12 (UTC)
commit8a437f5e03f48bc4831e469bb045ca64435d01b5 (patch) (unidiff)
tree3d36ad74010eb6225917fc370820e9c4f194025c
parentabf7debafd01d4ff71bddee06bf5cb4d46e6519c (diff)
downloadopie-8a437f5e03f48bc4831e469bb045ca64435d01b5.zip
opie-8a437f5e03f48bc4831e469bb045ca64435d01b5.tar.gz
opie-8a437f5e03f48bc4831e469bb045ca64435d01b5.tar.bz2
Use inline pics
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 392d04d..dfe6d9c 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -9,425 +9,425 @@
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 <linux/limits.h> 18#include <linux/limits.h>
19#include <unistd.h> 19#include <unistd.h>
20 20
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpemenubar.h> 22#include <qpe/qpemenubar.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27 27
28#include <qaction.h> 28#include <qaction.h>
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 "inputdlg.h" 46#include "inputdlg.h"
47#include "ipkg.h" 47#include "ipkg.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
54extern int compareVersions( const char *v1, const char *v2 ); 54extern int compareVersions( const char *v1, const char *v2 );
55 55
56MainWindow :: MainWindow() 56MainWindow :: 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 // Create UI widgets 61 // Create UI widgets
62 initMainWidget(); 62 initMainWidget();
63 initProgressWidget(); 63 initProgressWidget();
64 64
65 // Build menu and tool bars 65 // Build menu and tool bars
66 setToolBarsMovable( FALSE ); 66 setToolBarsMovable( FALSE );
67 67
68 QPEToolBar *bar = new QPEToolBar( this ); 68 QPEToolBar *bar = new QPEToolBar( this );
69 bar->setHorizontalStretchable( TRUE ); 69 bar->setHorizontalStretchable( TRUE );
70 QPEMenuBar *mb = new QPEMenuBar( bar ); 70 QPEMenuBar *mb = new QPEMenuBar( bar );
71 mb->setMargin( 0 ); 71 mb->setMargin( 0 );
72 bar = new QPEToolBar( this ); 72 bar = new QPEToolBar( this );
73 73
74 // Find toolbar 74 // Find toolbar
75 findBar = new QPEToolBar( this ); 75 findBar = new QPEToolBar( this );
76 addToolBar( findBar, QMainWindow::Top, true ); 76 addToolBar( findBar, QMainWindow::Top, true );
77 findBar->setHorizontalStretchable( true ); 77 findBar->setHorizontalStretchable( true );
78 findEdit = new QLineEdit( findBar ); 78 findEdit = new QLineEdit( findBar );
79 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); 79 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
80 findBar->setStretchableWidget( findEdit ); 80 findBar->setStretchableWidget( findEdit );
81 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); 81 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) );
82 82
83 // Quick jump toolbar 83 // Quick jump toolbar
84 jumpBar = new QPEToolBar( this ); 84 jumpBar = new QPEToolBar( this );
85 addToolBar( jumpBar, QMainWindow::Top, true ); 85 addToolBar( jumpBar, QMainWindow::Top, true );
86 jumpBar->setHorizontalStretchable( true ); 86 jumpBar->setHorizontalStretchable( true );
87 QWidget *w = new QWidget( jumpBar ); 87 QWidget *w = new QWidget( jumpBar );
88 jumpBar->setStretchableWidget( w ); 88 jumpBar->setStretchableWidget( w );
89 89
90 QGridLayout *layout = new QGridLayout( w ); 90 QGridLayout *layout = new QGridLayout( w );
91 91
92 char text[2]; 92 char text[2];
93 text[1] = '\0'; 93 text[1] = '\0';
94 for ( int i = 0 ; i < 26 ; ++i ) 94 for ( int i = 0 ; i < 26 ; ++i )
95 { 95 {
96 text[0] = 'A' + i; 96 text[0] = 'A' + i;
97 LetterPushButton *b = new LetterPushButton( text, w ); 97 LetterPushButton *b = new LetterPushButton( text, w );
98 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 98 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
99 layout->addWidget( b, i / 13, i % 13); 99 layout->addWidget( b, i / 13, i % 13);
100 } 100 }
101 101
102 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); 102 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 );
103 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); 103 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
104 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); 104 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
105 a->addTo( jumpBar ); 105 a->addTo( jumpBar );
106 jumpBar->hide(); 106 jumpBar->hide();
107 107
108 // Packages menu 108 // Packages menu
109 QPopupMenu *popup = new QPopupMenu( this ); 109 QPopupMenu *popup = new QPopupMenu( this );
110 110
111 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); 111 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
112 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 112 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
113 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); 113 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
114 a->addTo( popup ); 114 a->addTo( popup );
115 a->addTo( bar ); 115 a->addTo( bar );
116 116
117 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); 117 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 );
118 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 118 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
119 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); 119 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
120 actionUpgrade->addTo( popup ); 120 actionUpgrade->addTo( popup );
121 actionUpgrade->addTo( bar ); 121 actionUpgrade->addTo( bar );
122 122
123 iconDownload = Resource::loadPixmap( "aqpkg/download" ); 123 iconDownload = Resource::loadPixmap( "aqpkg/download" );
124 iconRemove = Resource::loadPixmap( "aqpkg/remove" ); 124 iconRemove = Resource::loadPixmap( "aqpkg/remove" );
125 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 125 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
126 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 126 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
127 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); 127 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) );
128 actionDownload->addTo( popup ); 128 actionDownload->addTo( popup );
129 actionDownload->addTo( bar ); 129 actionDownload->addTo( bar );
130 130
131 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); 131 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 );
132 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 132 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
133 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); 133 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) );
134 a->addTo( popup ); 134 a->addTo( popup );
135 a->addTo( bar ); 135 a->addTo( bar );
136 136
137 mb->insertItem( tr( "Actions" ), popup ); 137 mb->insertItem( tr( "Actions" ), popup );
138 138
139 // View menu 139 // View menu
140 popup = new QPopupMenu( this ); 140 popup = new QPopupMenu( this );
141 141
142 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 142 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
143 actionUninstalled->setToggleAction( TRUE ); 143 actionUninstalled->setToggleAction( TRUE );
144 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 144 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
145 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); 145 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
146 actionUninstalled->addTo( popup ); 146 actionUninstalled->addTo( popup );
147 147
148 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 148 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
149 actionInstalled->setToggleAction( TRUE ); 149 actionInstalled->setToggleAction( TRUE );
150 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 150 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
151 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); 151 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
152 actionInstalled->addTo( popup ); 152 actionInstalled->addTo( popup );
153 153
154 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 154 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
155 actionUpdated->setToggleAction( TRUE ); 155 actionUpdated->setToggleAction( TRUE );
156 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 156 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
157 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); 157 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) );
158 actionUpdated->addTo( popup ); 158 actionUpdated->addTo( popup );
159 159
160 popup->insertSeparator(); 160 popup->insertSeparator();
161 161
162 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); 162 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 );
163 actionFilter->setToggleAction( TRUE ); 163 actionFilter->setToggleAction( TRUE );
164 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); 164 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) );
165 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); 165 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) );
166 actionFilter->addTo( popup ); 166 actionFilter->addTo( popup );
167 167
168 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); 168 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 );
169 a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); 169 a->setWhatsThis( tr( "Click here to change package category to used filter." ) );
170 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); 170 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) );
171 a->addTo( popup ); 171 a->addTo( popup );
172 172
173 popup->insertSeparator(); 173 popup->insertSeparator();
174 174
175 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 175 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
176 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 176 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
177 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); 177 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
178 a->addTo( popup ); 178 a->addTo( popup );
179 179
180 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 180 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
181 actionFindNext->setEnabled( FALSE ); 181 actionFindNext->setEnabled( FALSE );
182 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 182 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
183 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); 183 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
184 actionFindNext->addTo( popup ); 184 actionFindNext->addTo( popup );
185 actionFindNext->addTo( findBar ); 185 actionFindNext->addTo( findBar );
186 186
187 187
188 popup->insertSeparator(); 188 popup->insertSeparator();
189 189
190 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); 190 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 );
191 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); 191 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) );
192 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); 192 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
193 a->addTo( popup ); 193 a->addTo( popup );
194 194
195 mb->insertItem( tr( "View" ), popup ); 195 mb->insertItem( tr( "View" ), popup );
196 196
197 197
198 // Options menu 198 // Options menu
199 popup = new QPopupMenu( this ); 199 popup = new QPopupMenu( this );
200 200
201 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); 201 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
202 a->setWhatsThis( tr( "Click here to configure this application." ) ); 202 a->setWhatsThis( tr( "Click here to configure this application." ) );
203 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); 203 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
204 a->addTo( popup ); 204 a->addTo( popup );
205 205
206 mb->insertItem( tr( "Options" ), popup ); 206 mb->insertItem( tr( "Options" ), popup );
207 207
208 // Finish find toolbar creation 208 // Finish find toolbar creation
209 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 209 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
210 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 210 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
211 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); 211 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
212 a->addTo( findBar ); 212 a->addTo( findBar );
213 findBar->hide(); 213 findBar->hide();
214 214
215 // Create widget stack and add UI widgets 215 // Create widget stack and add UI widgets
216 stack = new QWidgetStack( this ); 216 stack = new QWidgetStack( this );
217 stack->addWidget( progressWindow, 2 ); 217 stack->addWidget( progressWindow, 2 );
218 stack->addWidget( networkPkgWindow, 1 ); 218 stack->addWidget( networkPkgWindow, 1 );
219 setCentralWidget( stack ); 219 setCentralWidget( stack );
220 stack->raiseWidget( progressWindow ); 220 stack->raiseWidget( progressWindow );
221 221
222 // Delayed call to finish initialization 222 // Delayed call to finish initialization
223 QTimer::singleShot( 100, this, SLOT( init() ) ); 223 QTimer::singleShot( 100, this, SLOT( init() ) );
224} 224}
225 225
226MainWindow :: ~MainWindow() 226MainWindow :: ~MainWindow()
227{ 227{
228 delete mgr; 228 delete mgr;
229} 229}
230 230
231void MainWindow :: initMainWidget() 231void MainWindow :: initMainWidget()
232{ 232{
233 networkPkgWindow = new QWidget( this ); 233 networkPkgWindow = new QWidget( this );
234 234
235 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 235 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
236 236
237 serversList = new QComboBox( networkPkgWindow ); 237 serversList = new QComboBox( networkPkgWindow );
238 connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); 238 connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) );
239 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 239 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
240 240
241 installedIcon = Resource::loadPixmap( "aqpkg/installed" ); 241 installedIcon = Resource::loadPixmap( "installed" );
242 updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); 242 updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
243 243
244 packagesList = new QListView( networkPkgWindow ); 244 packagesList = new QListView( networkPkgWindow );
245 packagesList->addColumn( tr( "Packages" ), 225 ); 245 packagesList->addColumn( tr( "Packages" ), 225 );
246 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." ) ); 246 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." ) );
247 247
248 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); 248 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
249 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 249 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
250 hbox1->addWidget( l ); 250 hbox1->addWidget( l );
251 hbox1->addWidget( serversList ); 251 hbox1->addWidget( serversList );
252 252
253 vbox->addWidget( packagesList ); 253 vbox->addWidget( packagesList );
254 254
255 downloadEnabled = TRUE; 255 downloadEnabled = TRUE;
256} 256}
257 257
258void MainWindow :: initProgressWidget() 258void MainWindow :: initProgressWidget()
259{ 259{
260 progressWindow = new QWidget( this ); 260 progressWindow = new QWidget( this );
261 261
262 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); 262 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
263 263
264 m_status = new QLabel( progressWindow ); 264 m_status = new QLabel( progressWindow );
265 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 265 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
266 layout->addWidget( m_status ); 266 layout->addWidget( m_status );
267 267
268 m_progress = new QProgressBar( progressWindow ); 268 m_progress = new QProgressBar( progressWindow );
269 layout->addWidget( m_progress ); 269 layout->addWidget( m_progress );
270} 270}
271 271
272void MainWindow :: init() 272void MainWindow :: init()
273{ 273{
274#ifdef QWS 274#ifdef QWS
275 // read download directory from config file 275 // read download directory from config file
276 Config cfg( "aqpkg" ); 276 Config cfg( "aqpkg" );
277 cfg.setGroup( "settings" ); 277 cfg.setGroup( "settings" );
278 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 278 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
279// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 279// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
280 280
281#endif 281#endif
282 282
283 stack->raiseWidget( progressWindow ); 283 stack->raiseWidget( progressWindow );
284 284
285 mgr = new DataManager(); 285 mgr = new DataManager();
286 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); 286 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) );
287 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), 287 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
288 this, SLOT( setProgressMessage( const QString & ) ) ); 288 this, SLOT( setProgressMessage( const QString & ) ) );
289 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); 289 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) );
290 mgr->loadServers(); 290 mgr->loadServers();
291 291
292 showUninstalledPkgs = false; 292 showUninstalledPkgs = false;
293 showInstalledPkgs = false; 293 showInstalledPkgs = false;
294 showUpgradedPkgs = false; 294 showUpgradedPkgs = false;
295 categoryFilterEnabled = false; 295 categoryFilterEnabled = false;
296 296
297 updateData(); 297 updateData();
298 298
299 stack->raiseWidget( networkPkgWindow ); 299 stack->raiseWidget( networkPkgWindow );
300} 300}
301/* 301/*
302void MainWindow :: setDocument( const QString &doc ) 302void MainWindow :: setDocument( const QString &doc )
303{ 303{
304 // Remove path from package 304 // Remove path from package
305 QString package = Utils::getPackageNameFromIpkFilename( doc ); 305 QString package = Utils::getPackageNameFromIpkFilename( doc );
306// std::cout << "Selecting package " << package << std::endl; 306// std::cout << "Selecting package " << package << std::endl;
307 307
308 // First select local server 308 // First select local server
309 for ( int i = 0 ; i < serversList->count() ; ++i ) 309 for ( int i = 0 ; i < serversList->count() ; ++i )
310 { 310 {
311 if ( serversList->text( i ) == LOCAL_IPKGS ) 311 if ( serversList->text( i ) == LOCAL_IPKGS )
312 { 312 {
313 serversList->setCurrentItem( i ); 313 serversList->setCurrentItem( i );
314 break; 314 break;
315 } 315 }
316 } 316 }
317 serverSelected( 0 ); 317 serverSelected( 0 );
318 318
319 // Now set the check box of the selected package 319 // Now set the check box of the selected package
320 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 320 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
321 item != 0 ; 321 item != 0 ;
322 item = (QCheckListItem *)item->nextSibling() ) 322 item = (QCheckListItem *)item->nextSibling() )
323 { 323 {
324 if ( item->text().startsWith( package ) ) 324 if ( item->text().startsWith( package ) )
325 { 325 {
326 item->setOn( true ); 326 item->setOn( true );
327 break; 327 break;
328 } 328 }
329 } 329 }
330} 330}
331*/ 331*/
332void MainWindow :: displaySettings() 332void MainWindow :: displaySettings()
333{ 333{
334 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 334 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
335 if ( dlg->showDlg() ) 335 if ( dlg->showDlg() )
336 { 336 {
337 stack->raiseWidget( progressWindow ); 337 stack->raiseWidget( progressWindow );
338 updateData(); 338 updateData();
339 stack->raiseWidget( networkPkgWindow ); 339 stack->raiseWidget( networkPkgWindow );
340 } 340 }
341 delete dlg; 341 delete dlg;
342} 342}
343 343
344void MainWindow :: displayFindBar() 344void MainWindow :: displayFindBar()
345{ 345{
346 findBar->show(); 346 findBar->show();
347 findEdit->setFocus(); 347 findEdit->setFocus();
348} 348}
349 349
350void MainWindow :: displayJumpBar() 350void MainWindow :: displayJumpBar()
351{ 351{
352 jumpBar->show(); 352 jumpBar->show();
353} 353}
354 354
355void MainWindow :: repeatFind() 355void MainWindow :: repeatFind()
356{ 356{
357 searchForPackage( findEdit->text() ); 357 searchForPackage( findEdit->text() );
358} 358}
359 359
360void MainWindow :: findPackage( const QString &text ) 360void MainWindow :: findPackage( const QString &text )
361{ 361{
362 actionFindNext->setEnabled( !text.isEmpty() ); 362 actionFindNext->setEnabled( !text.isEmpty() );
363 searchForPackage( text ); 363 searchForPackage( text );
364} 364}
365 365
366void MainWindow :: hideFindBar() 366void MainWindow :: hideFindBar()
367{ 367{
368 findBar->hide(); 368 findBar->hide();
369} 369}
370 370
371void MainWindow :: hideJumpBar() 371void MainWindow :: hideJumpBar()
372{ 372{
373 jumpBar->hide(); 373 jumpBar->hide();
374} 374}
375 375
376void MainWindow :: filterUninstalledPackages() 376void MainWindow :: filterUninstalledPackages()
377{ 377{
378 showUninstalledPkgs = actionUninstalled->isOn(); 378 showUninstalledPkgs = actionUninstalled->isOn();
379 if ( showUninstalledPkgs ) 379 if ( showUninstalledPkgs )
380 { 380 {
381 showInstalledPkgs = FALSE; 381 showInstalledPkgs = FALSE;
382 showUpgradedPkgs = FALSE; 382 showUpgradedPkgs = FALSE;
383 } 383 }
384 serverSelected( -1 ); 384 serverSelected( -1 );
385 385
386 actionInstalled->setOn( FALSE ); 386 actionInstalled->setOn( FALSE );
387 actionUpdated->setOn( FALSE ); 387 actionUpdated->setOn( FALSE );
388} 388}
389 389
390void MainWindow :: filterInstalledPackages() 390void MainWindow :: filterInstalledPackages()
391{ 391{
392 showInstalledPkgs = actionInstalled->isOn(); 392 showInstalledPkgs = actionInstalled->isOn();
393 if ( showInstalledPkgs ) 393 if ( showInstalledPkgs )
394 { 394 {
395 showUninstalledPkgs = FALSE; 395 showUninstalledPkgs = FALSE;
396 showUpgradedPkgs = FALSE; 396 showUpgradedPkgs = FALSE;
397 } 397 }
398 serverSelected( -1 ); 398 serverSelected( -1 );
399 399
400 actionUninstalled->setOn( FALSE ); 400 actionUninstalled->setOn( FALSE );
401 actionUpdated->setOn( FALSE ); 401 actionUpdated->setOn( FALSE );
402} 402}
403 403
404void MainWindow :: filterUpgradedPackages() 404void MainWindow :: filterUpgradedPackages()
405{ 405{
406 showUpgradedPkgs = actionUpdated->isOn(); 406 showUpgradedPkgs = actionUpdated->isOn();
407 if ( showUpgradedPkgs ) 407 if ( showUpgradedPkgs )
408 { 408 {
409 showUninstalledPkgs = FALSE; 409 showUninstalledPkgs = FALSE;
410 showInstalledPkgs = FALSE; 410 showInstalledPkgs = FALSE;
411 } 411 }
412 serverSelected( -1 ); 412 serverSelected( -1 );
413 413
414 actionUninstalled->setOn( FALSE ); 414 actionUninstalled->setOn( FALSE );
415 actionInstalled->setOn( FALSE ); 415 actionInstalled->setOn( FALSE );
416} 416}
417 417
418bool MainWindow :: setFilterCategory() 418bool MainWindow :: setFilterCategory()
419{ 419{
420 // Get categories; 420 // Get categories;
421 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); 421 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this );
422 if ( dlg.exec() == QDialog::Accepted ) 422 if ( dlg.exec() == QDialog::Accepted )
423 { 423 {
424 categoryFilter = dlg.getSelectedFilter(); 424 categoryFilter = dlg.getSelectedFilter();
425 425
426 if ( categoryFilter == "" ) 426 if ( categoryFilter == "" )
427 return false; 427 return false;
428 428
429 categoryFilterEnabled = true; 429 categoryFilterEnabled = true;
430 serverSelected( -1 ); 430 serverSelected( -1 );
431 actionFilter->setOn( TRUE ); 431 actionFilter->setOn( TRUE );
432 return true; 432 return true;
433 } 433 }