Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 0e40c01..e0e5e04 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -27,54 +27,54 @@ | |||
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "mainwindow.h" | 31 | #include "mainwindow.h" |
32 | #include "installdlg.h" | 32 | #include "installdlg.h" |
33 | #include "filterdlg.h" | 33 | #include "filterdlg.h" |
34 | #include "promptdlg.h" | 34 | #include "promptdlg.h" |
35 | #include "entrydlg.h" | 35 | #include "entrydlg.h" |
36 | #include "packageinfodlg.h" | 36 | #include "packageinfodlg.h" |
37 | 37 | ||
38 | #include <opie2/ofiledialog.h> | 38 | #include <opie2/ofiledialog.h> |
39 | #include <opie2/oresource.h> | ||
39 | 40 | ||
40 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
41 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
42 | #include <qpe/resource.h> | ||
43 | 43 | ||
44 | #include <qaction.h> | 44 | #include <qaction.h> |
45 | #include <qdir.h> | 45 | #include <qdir.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
48 | #include <qmenubar.h> | 48 | #include <qmenubar.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | #include <qpopupmenu.h> | 50 | #include <qpopupmenu.h> |
51 | #include <qtimer.h> | 51 | #include <qtimer.h> |
52 | #include <qtoolbar.h> | 52 | #include <qtoolbar.h> |
53 | #include <qwhatsthis.h> | 53 | #include <qwhatsthis.h> |
54 | 54 | ||
55 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) | 55 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) |
56 | : QMainWindow( parent, name, WStyle_ContextHelp ) | 56 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
57 | , m_config( "packman" ) | 57 | , m_config( "packman" ) |
58 | , m_packman( &m_config, this ) | 58 | , m_packman( &m_config, this ) |
59 | , m_menuBar( this ) | 59 | , m_menuBar( this ) |
60 | , m_toolBar( this ) | 60 | , m_toolBar( this ) |
61 | , m_findBar( this ) | 61 | , m_findBar( this ) |
62 | , m_widgetStack( this ) | 62 | , m_widgetStack( this ) |
63 | , m_packageList( this ) | 63 | , m_packageList( this ) |
64 | , m_statusWidget( this ) | 64 | , m_statusWidget( this ) |
65 | , m_statusText( &m_statusWidget ) | 65 | , m_statusText( &m_statusWidget ) |
66 | , m_statusBar( &m_statusWidget ) | 66 | , m_statusBar( &m_statusWidget ) |
67 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) | 67 | , m_iconUpdated( Opie::Core::OResource::loadPixmap( "packagemanager/updated" ) ) |
68 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) | 68 | , m_iconInstalled( Opie::Core::OResource::loadPixmap( "installed" ) ) |
69 | , m_iconNull( m_iconUpdated.size() ) | 69 | , m_iconNull( m_iconUpdated.size() ) |
70 | , m_filterName( QString::null ) | 70 | , m_filterName( QString::null ) |
71 | , m_filterServer( QString::null ) | 71 | , m_filterServer( QString::null ) |
72 | , m_filterDest( QString::null ) | 72 | , m_filterDest( QString::null ) |
73 | , m_filterStatus( OPackageManager::NotDefined ) | 73 | , m_filterStatus( OPackageManager::NotDefined ) |
74 | , m_filterCategory( QString::null ) | 74 | , m_filterCategory( QString::null ) |
75 | 75 | ||
76 | { | 76 | { |
77 | // setCaption( tr( "Package Manager" ) ); | 77 | // setCaption( tr( "Package Manager" ) ); |
78 | 78 | ||
79 | m_iconNull.fill( colorGroup().base() ); | 79 | m_iconNull.fill( colorGroup().base() ); |
80 | 80 | ||
@@ -150,59 +150,64 @@ void MainWindow::initUI() | |||
150 | 150 | ||
151 | // Find toolbar | 151 | // Find toolbar |
152 | addToolBar( &m_findBar, QMainWindow::Top, true ); | 152 | addToolBar( &m_findBar, QMainWindow::Top, true ); |
153 | m_findBar.setHorizontalStretchable( true ); | 153 | m_findBar.setHorizontalStretchable( true ); |
154 | m_findEdit = new QLineEdit( &m_findBar ); | 154 | m_findEdit = new QLineEdit( &m_findBar ); |
155 | QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); | 155 | QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); |
156 | m_findBar.setStretchableWidget( m_findEdit ); | 156 | m_findBar.setStretchableWidget( m_findEdit ); |
157 | connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); | 157 | connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); |
158 | 158 | ||
159 | // Packages menu | 159 | // Packages menu |
160 | QPopupMenu *popup = new QPopupMenu( this ); | 160 | QPopupMenu *popup = new QPopupMenu( this ); |
161 | 161 | ||
162 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); | 162 | QAction *a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "packagemanager/update", |
163 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
163 | a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); | 164 | a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); |
164 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); | 165 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); |
165 | a->addTo( popup ); | 166 | a->addTo( popup ); |
166 | a->addTo( &m_toolBar ); | 167 | a->addTo( &m_toolBar ); |
167 | 168 | ||
168 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); | 169 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "packagemanager/upgrade", |
170 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
169 | actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); | 171 | actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); |
170 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); | 172 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); |
171 | actionUpgrade->addTo( popup ); | 173 | actionUpgrade->addTo( popup ); |
172 | actionUpgrade->addTo( &m_toolBar ); | 174 | actionUpgrade->addTo( &m_toolBar ); |
173 | 175 | ||
174 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 176 | QPixmap iconDownload = Opie::Core::OResource::loadPixmap( "packagemanager/download", Opie::Core::OResource::SmallIcon ); |
175 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 177 | QPixmap iconRemove = Opie::Core::OResource::loadPixmap( "packagemanager/remove", Opie::Core::OResource::SmallIcon ); |
176 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 178 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
177 | actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); | 179 | actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); |
178 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 180 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
179 | actionDownload->addTo( popup ); | 181 | actionDownload->addTo( popup ); |
180 | actionDownload->addTo( &m_toolBar ); | 182 | actionDownload->addTo( &m_toolBar ); |
181 | 183 | ||
182 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 184 | a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply", |
185 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
183 | a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); | 186 | a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); |
184 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); | 187 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); |
185 | a->addTo( popup ); | 188 | a->addTo( popup ); |
186 | a->addTo( &m_toolBar ); | 189 | a->addTo( &m_toolBar ); |
187 | 190 | ||
188 | a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); | 191 | a = new QAction( tr( "Install local package" ), Opie::Core::OResource::loadPixmap( "folder", |
192 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
189 | a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); | 193 | a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); |
190 | connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); | 194 | connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); |
191 | a->addTo( popup ); | 195 | a->addTo( popup ); |
192 | //a->addTo( &m_toolBar ); | 196 | //a->addTo( &m_toolBar ); |
193 | 197 | ||
194 | popup->insertSeparator(); | 198 | popup->insertSeparator(); |
195 | 199 | ||
196 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 200 | a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", |
201 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
197 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); | 202 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); |
198 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 203 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
199 | a->addTo( popup ); | 204 | a->addTo( popup ); |
200 | mb->insertItem( tr( "Actions" ), popup ); | 205 | mb->insertItem( tr( "Actions" ), popup ); |
201 | 206 | ||
202 | // View menu | 207 | // View menu |
203 | popup = new QPopupMenu( this ); | 208 | popup = new QPopupMenu( this ); |
204 | 209 | ||
205 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 210 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
206 | m_actionShowNotInstalled->setToggleAction( true ); | 211 | m_actionShowNotInstalled->setToggleAction( true ); |
207 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); | 212 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); |
208 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); | 213 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); |
@@ -213,54 +218,57 @@ void MainWindow::initUI() | |||
213 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); | 218 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); |
214 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); | 219 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); |
215 | m_actionShowInstalled->addTo( popup ); | 220 | m_actionShowInstalled->addTo( popup ); |
216 | 221 | ||
217 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 222 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
218 | m_actionShowUpdated->setToggleAction( true ); | 223 | m_actionShowUpdated->setToggleAction( true ); |
219 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); | 224 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); |
220 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); | 225 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); |
221 | m_actionShowUpdated->addTo( popup ); | 226 | m_actionShowUpdated->addTo( popup ); |
222 | 227 | ||
223 | popup->insertSeparator(); | 228 | popup->insertSeparator(); |
224 | 229 | ||
225 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 230 | m_actionFilter = new QAction( tr( "Filter" ), Opie::Core::OResource::loadPixmap( "packagemanager/filter", |
226 | QString::null, 0, this, 0 ); | 231 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); |
227 | m_actionFilter->setToggleAction( true ); | 232 | m_actionFilter->setToggleAction( true ); |
228 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); | 233 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); |
229 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 234 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
230 | m_actionFilter->addTo( popup ); | 235 | m_actionFilter->addTo( popup ); |
231 | 236 | ||
232 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); | 237 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); |
233 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); | 238 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); |
234 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | 239 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); |
235 | a->addTo( popup ); | 240 | a->addTo( popup ); |
236 | 241 | ||
237 | popup->insertSeparator(); | 242 | popup->insertSeparator(); |
238 | 243 | ||
239 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 244 | a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), |
245 | QString::null, 0, this, 0 ); | ||
240 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); | 246 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); |
241 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); | 247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); |
242 | a->addTo( popup ); | 248 | a->addTo( popup ); |
243 | 249 | ||
244 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 250 | m_actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next", |
251 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
245 | m_actionFindNext->setEnabled( false ); | 252 | m_actionFindNext->setEnabled( false ); |
246 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); | 253 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); |
247 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); | 254 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); |
248 | m_actionFindNext->addTo( popup ); | 255 | m_actionFindNext->addTo( popup ); |
249 | m_actionFindNext->addTo( &m_findBar ); | 256 | m_actionFindNext->addTo( &m_findBar ); |
250 | 257 | ||
251 | mb->insertItem( tr( "View" ), popup ); | 258 | mb->insertItem( tr( "View" ), popup ); |
252 | 259 | ||
253 | // Finish find toolbar creation | 260 | // Finish find toolbar creation |
254 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 261 | a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), |
262 | QString::null, 0, this, 0 ); | ||
255 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); | 263 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); |
256 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); | 264 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); |
257 | a->addTo( &m_findBar ); | 265 | a->addTo( &m_findBar ); |
258 | m_findBar.hide(); | 266 | m_findBar.hide(); |
259 | } | 267 | } |
260 | 268 | ||
261 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | 269 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) |
262 | { | 270 | { |
263 | if ( clearList ) | 271 | if ( clearList ) |
264 | m_packageList.clear(); | 272 | m_packageList.clear(); |
265 | 273 | ||
266 | if ( packages ) | 274 | if ( packages ) |