summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp40
-rw-r--r--noncore/settings/packagemanager/mainwindow.h3
2 files changed, 31 insertions, 12 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 5a942a1..349094d 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,190 +1,190 @@
1/* 1/*
2 This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7_;:, .> :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.= = ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++= -. .` .: 20++= -. .` .:
21: = ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22-. .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24 -- :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "mainwindow.h" 30#include "mainwindow.h"
31#include "installdlg.h" 31#include "installdlg.h"
32#include "filterdlg.h" 32#include "filterdlg.h"
33#include "promptdlg.h" 33#include "promptdlg.h"
34#include "entrydlg.h" 34#include "entrydlg.h"
35#include "packageinfodlg.h" 35#include "packageinfodlg.h"
36 36
37#include <opie2/ofiledialog.h> 37#include <opie2/ofiledialog.h>
38 38
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42 42
43#include <qaction.h> 43#include <qaction.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qmenubar.h> 47#include <qmenubar.h>
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qpopupmenu.h> 49#include <qpopupmenu.h>
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qtoolbar.h> 51#include <qtoolbar.h>
52#include <qwhatsthis.h> 52#include <qwhatsthis.h>
53 53
54MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) 54MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
55 : QMainWindow( parent, name, WStyle_ContextHelp ) 55 : QMainWindow( parent, name, WStyle_ContextHelp )
56 , m_config( "packman" ) 56 , m_config( "packman" )
57 , m_packman( &m_config, this ) 57 , m_packman( &m_config, this )
58 , m_menuBar( this ) 58 , m_menuBar( this )
59 , m_toolBar( this ) 59 , m_toolBar( this )
60 , m_findBar( this ) 60 , m_findBar( this )
61 , m_widgetStack( this ) 61 , m_widgetStack( this )
62 , m_packageList( this ) 62 , m_packageList( this )
63 , m_statusWidget( this ) 63 , m_statusWidget( this )
64 , m_statusText( &m_statusWidget ) 64 , m_statusText( &m_statusWidget )
65 , m_statusBar( &m_statusWidget ) 65 , m_statusBar( &m_statusWidget )
66 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 66 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
67 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 67 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
68 , m_iconNull( m_iconUpdated.size() ) 68 , m_iconNull( m_iconUpdated.size() )
69 , m_filterName( QString::null ) 69 , m_filterName( QString::null )
70 , m_filterServer( QString::null ) 70 , m_filterServer( QString::null )
71 , m_filterDest( QString::null ) 71 , m_filterDest( QString::null )
72 , m_filterStatus( OPackageManager::NotDefined ) 72 , m_filterStatus( OPackageManager::NotDefined )
73 , m_filterCategory( QString::null ) 73 , m_filterCategory( QString::null )
74 74
75{ 75{
76// setCaption( tr( "Package Manager" ) ); 76// setCaption( tr( "Package Manager" ) );
77 77
78 m_iconNull.fill( colorGroup().base() ); 78 m_iconNull.fill( colorGroup().base() );
79 79
80 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); 80 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
81 81
82 // Initialize widget stack, package list and status widget 82 // Initialize widget stack, package list and status widget
83 initStatusWidget(); 83 initStatusWidget();
84 initPackageList(); 84 initPackageList();
85 85
86 m_widgetStack.addWidget( &m_statusWidget, 2 ); 86 m_widgetStack.addWidget( &m_statusWidget, 2 );
87 m_widgetStack.addWidget( &m_packageList, 1 ); 87 m_widgetStack.addWidget( &m_packageList, 1 );
88 setCentralWidget( &m_widgetStack ); 88 setCentralWidget( &m_widgetStack );
89 89
90 // Initialize remaining user interface items 90 // Initialize remaining user interface items
91 initUI(); 91 initUI();
92 92
93 // Initialize package information 93 // Initialize package information
94 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); 94 QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) );
95} 95}
96 96
97void MainWindow::closeEvent( QCloseEvent *event ) 97void MainWindow::closeEvent( QCloseEvent *event )
98{ 98{
99 // Close app only if either the package or status widgets are currently active 99 // Close app only if either the package or status widgets are currently active
100 bool close = m_widgetStack.visibleWidget() == &m_packageList || 100 bool close = m_widgetStack.visibleWidget() == &m_packageList ||
101 m_widgetStack.visibleWidget() == &m_statusWidget; 101 m_widgetStack.visibleWidget() == &m_statusWidget;
102 if ( close ) 102 if ( close )
103 { 103 {
104 // TODO - write out application configuration settings 104 // TODO - write out application configuration settings
105 105
106 // Write out package manager configuration settings 106 // Write out package manager configuration settings
107 m_packman.saveSettings(); 107 m_packman.saveSettings();
108 event->accept(); 108 event->accept();
109 } 109 }
110 else 110 else
111 { 111 {
112 delete m_widgetStack.visibleWidget(); 112 delete m_widgetStack.visibleWidget();
113 m_widgetStack.raiseWidget( &m_packageList ); 113 m_widgetStack.raiseWidget( &m_packageList );
114 event->ignore(); 114 event->ignore();
115 } 115 }
116} 116}
117 117
118void MainWindow::initPackageList() 118void MainWindow::initPackageList()
119{ 119{
120 m_packageList.addColumn( tr( "Packages" ) ); 120 m_packageList.addColumn( tr( "Packages" ) );
121 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\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\nTap inside the box at the left to select a package. Tap and hold to view package details." ) ); 121 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\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\nTap inside the box at the left to select a package. Tap and hold to view package details." ) );
122 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); 122 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
123 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), 123 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
124 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); 124 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) );
125} 125}
126 126
127void MainWindow::initStatusWidget() 127void MainWindow::initStatusWidget()
128{ 128{
129 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); 129 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
130 130
131 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 131 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
132 layout->addWidget( &m_statusText ); 132 layout->addWidget( &m_statusText );
133 133
134 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); 134 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
135 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); 135 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) );
136 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); 136 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
137 137
138 layout->addWidget( &m_statusBar ); 138 layout->addWidget( &m_statusBar );
139} 139}
140 140
141void MainWindow::initUI() 141void MainWindow::initUI()
142{ 142{
143 // Build menu and tool bars 143 // Build menu and tool bars
144 setToolBarsMovable( false ); 144 setToolBarsMovable( false );
145 145
146 m_menuBar.setHorizontalStretchable( true ); 146 m_menuBar.setHorizontalStretchable( true );
147 QMenuBar *mb = new QMenuBar( &m_menuBar ); 147 QMenuBar *mb = new QMenuBar( &m_menuBar );
148 mb->setMargin( 0 ); 148 mb->setMargin( 0 );
149 149
150 // Find toolbar 150 // Find toolbar
151 addToolBar( &m_findBar, QMainWindow::Top, true ); 151 addToolBar( &m_findBar, QMainWindow::Top, true );
152 m_findBar.setHorizontalStretchable( true ); 152 m_findBar.setHorizontalStretchable( true );
153 m_findEdit = new QLineEdit( &m_findBar ); 153 m_findEdit = new QLineEdit( &m_findBar );
154 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); 154 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
155 m_findBar.setStretchableWidget( m_findEdit ); 155 m_findBar.setStretchableWidget( m_findEdit );
156 connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); 156 connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) );
157 157
158 // Packages menu 158 // Packages menu
159 QPopupMenu *popup = new QPopupMenu( this ); 159 QPopupMenu *popup = new QPopupMenu( this );
160 160
161 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); 161 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 );
162 a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); 162 a->setWhatsThis( tr( "Tap here to update package lists from servers." ) );
163 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); 163 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
164 a->addTo( popup ); 164 a->addTo( popup );
165 a->addTo( &m_toolBar ); 165 a->addTo( &m_toolBar );
166 166
167 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); 167 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 );
168 actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); 168 actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) );
169 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); 169 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
170 actionUpgrade->addTo( popup ); 170 actionUpgrade->addTo( popup );
171 actionUpgrade->addTo( &m_toolBar ); 171 actionUpgrade->addTo( &m_toolBar );
172 172
173 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); 173 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
174 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); 174 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
175 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 175 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
176 actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); 176 actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) );
177 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); 177 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
178 actionDownload->addTo( popup ); 178 actionDownload->addTo( popup );
179 actionDownload->addTo( &m_toolBar ); 179 actionDownload->addTo( &m_toolBar );
180 180
181 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); 181 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
182 a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); 182 a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) );
183 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); 183 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
184 a->addTo( popup ); 184 a->addTo( popup );
185 a->addTo( &m_toolBar ); 185 a->addTo( &m_toolBar );
186 186
187 a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); 187 a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 );
188 a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); 188 a->setWhatsThis( tr( "Tap here to install a package file located on device." ) );
189 connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); 189 connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) );
190 a->addTo( popup ); 190 a->addTo( popup );
@@ -216,208 +216,233 @@ void MainWindow::initUI()
216 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 216 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
217 m_actionShowUpdated->setToggleAction( true ); 217 m_actionShowUpdated->setToggleAction( true );
218 m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); 218 m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) );
219 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); 219 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
220 m_actionShowUpdated->addTo( popup ); 220 m_actionShowUpdated->addTo( popup );
221 221
222 popup->insertSeparator(); 222 popup->insertSeparator();
223 223
224 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), 224 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ),
225 QString::null, 0, this, 0 ); 225 QString::null, 0, this, 0 );
226 m_actionFilter->setToggleAction( true ); 226 m_actionFilter->setToggleAction( true );
227 m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); 227 m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) );
228 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); 228 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
229 m_actionFilter->addTo( popup ); 229 m_actionFilter->addTo( popup );
230 230
231 a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); 231 a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 );
232 a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); 232 a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) );
233 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); 233 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
234 a->addTo( popup ); 234 a->addTo( popup );
235 235
236 popup->insertSeparator(); 236 popup->insertSeparator();
237 237
238 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 238 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
239 a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); 239 a->setWhatsThis( tr( "Tap here to search for text in package names." ) );
240 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); 240 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
241 a->addTo( popup ); 241 a->addTo( popup );
242 242
243 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 243 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
244 m_actionFindNext->setEnabled( false ); 244 m_actionFindNext->setEnabled( false );
245 m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); 245 m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) );
246 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); 246 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
247 m_actionFindNext->addTo( popup ); 247 m_actionFindNext->addTo( popup );
248 m_actionFindNext->addTo( &m_findBar ); 248 m_actionFindNext->addTo( &m_findBar );
249 249
250 mb->insertItem( tr( "View" ), popup ); 250 mb->insertItem( tr( "View" ), popup );
251 251
252 // Finish find toolbar creation 252 // Finish find toolbar creation
253 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 253 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
254 a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); 254 a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) );
255 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); 255 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
256 a->addTo( &m_findBar ); 256 a->addTo( &m_findBar );
257 m_findBar.hide(); 257 m_findBar.hide();
258} 258}
259 259
260void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) 260void MainWindow::loadPackageList( OPackageList *packages, bool clearList )
261{ 261{
262 if ( clearList ) 262 if ( clearList )
263 m_packageList.clear(); 263 m_packageList.clear();
264 264
265 if ( packages ) 265 if ( packages )
266 { 266 {
267 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) 267 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt )
268 { 268 {
269 OPackage *package = packageIt.current(); 269 OPackage *package = packageIt.current();
270 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), 270 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(),
271 QCheckListItem::CheckBox ); 271 QCheckListItem::CheckBox );
272 m_packageList.insertItem( item ); 272 m_packageList.insertItem( item );
273 273
274 // If a different version of package is available, show update available icon 274 // If a different version of package is available, show update available icon
275 // Otherwise, show installed icon 275 // Otherwise, show installed icon
276 if ( !package->versionInstalled().isNull() ) 276 if ( !package->versionInstalled().isNull() )
277 { 277 {
278 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 278 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
279 item->setPixmap( 0, m_iconUpdated ); 279 item->setPixmap( 0, m_iconUpdated );
280 else 280 else
281 item->setPixmap( 0, m_iconInstalled ); 281 item->setPixmap( 0, m_iconInstalled );
282 } 282 }
283 else 283 else
284 item->setPixmap( 0, m_iconNull ); 284 item->setPixmap( 0, m_iconNull );
285 } 285 }
286 } 286 }
287} 287}
288 288
289void MainWindow::searchForPackage( const QString &text ) 289void MainWindow::searchForPackage( const QString &text )
290{ 290{
291 if ( !text.isEmpty() ) 291 if ( !text.isEmpty() )
292 { 292 {
293 // look through package list for text startng at current position 293 // look through package list for text startng at current position
294 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); 294 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem());
295 if ( start == 0 ) 295 if ( start == 0 )
296 start = static_cast<QCheckListItem *>(m_packageList.firstChild()); 296 start = static_cast<QCheckListItem *>(m_packageList.firstChild());
297 297
298// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; 298// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ;
299 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; 299 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ;
300 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 300 item = static_cast<QCheckListItem *>(item->nextSibling()) )
301 { 301 {
302 if ( item->text().lower().find( text ) != -1 ) 302 if ( item->text().lower().find( text ) != -1 )
303 { 303 {
304 m_packageList.ensureItemVisible( item ); 304 m_packageList.ensureItemVisible( item );
305 m_packageList.setCurrentItem( item ); 305 m_packageList.setCurrentItem( item );
306 break; 306 break;
307 } 307 }
308 } 308 }
309 } 309 }
310} 310}
311 311
312void MainWindow::installLocalPackage( const QString &ipkFile )
313{
314 // Install selected file
315 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true,
316 OPackage::Install, new QStringList( ipkFile ) );
317 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
318
319 // Display widget
320 m_widgetStack.addWidget( dlg, 3 );
321 m_widgetStack.raiseWidget( dlg );
322}
323
324void MainWindow::setDocument( const QString &ipkFile )
325{
326 QString file = ipkFile;
327 DocLnk lnk( ipkFile );
328 if ( lnk.isValid() )
329 file = lnk.file();
330
331 installLocalPackage( file );
332}
333
312void MainWindow::initPackageInfo() 334void MainWindow::initPackageInfo()
313{ 335{
314 m_widgetStack.raiseWidget( &m_statusWidget ); 336 m_widgetStack.raiseWidget( &m_statusWidget );
315 337
316 // Load package list 338 // Load package list
317 m_packman.loadAvailablePackages(); 339 m_packman.loadAvailablePackages();
318 m_packman.loadInstalledPackages(); 340 m_packman.loadInstalledPackages();
319 341
320 OPackageList *packageList = m_packman.packages(); 342 OPackageList *packageList = m_packman.packages();
321 if ( packageList ) 343 if ( packageList )
322 { 344 {
323 loadPackageList( packageList, true ); 345 loadPackageList( packageList, true );
324 delete packageList; 346 delete packageList;
325 } 347 }
326 348
327 m_widgetStack.raiseWidget( &m_packageList ); 349 QWidget *widget = m_widgetStack.widget( 3 );
350 if ( !widget )
351 widget = &m_packageList;
352 m_widgetStack.raiseWidget( widget );
328} 353}
329 354
330void MainWindow::slotWidgetStackShow( QWidget *widget ) 355void MainWindow::slotWidgetStackShow( QWidget *widget )
331{ 356{
332 if ( widget == &m_packageList ) 357 if ( widget == &m_packageList )
333 { 358 {
334 setCaption( tr( "Package Manager" ) ); 359 setCaption( tr( "Package Manager" ) );
335 360
336 m_menuBar.show(); 361 m_menuBar.show();
337 m_toolBar.show(); 362 m_toolBar.show();
338 } 363 }
339 else 364 else
340 { 365 {
341 m_menuBar.hide(); 366 m_menuBar.hide();
342 m_toolBar.hide(); 367 m_toolBar.hide();
343 } 368 }
344} 369}
345 370
346void MainWindow::slotInitStatusBar( int numSteps ) 371void MainWindow::slotInitStatusBar( int numSteps )
347{ 372{
348 m_statusBar.setTotalSteps( numSteps ); 373 m_statusBar.setTotalSteps( numSteps );
349} 374}
350 375
351void MainWindow::slotStatusText( const QString &status ) 376void MainWindow::slotStatusText( const QString &status )
352{ 377{
353 m_statusText.setText( status ); 378 m_statusText.setText( status );
354} 379}
355 380
356void MainWindow::slotStatusBar( int currStep ) 381void MainWindow::slotStatusBar( int currStep )
357{ 382{
358 m_statusBar.setProgress( currStep ); 383 m_statusBar.setProgress( currStep );
359} 384}
360 385
361void MainWindow::slotUpdate() 386void MainWindow::slotUpdate()
362{ 387{
363 // Create package manager output widget 388 // Create package manager output widget
364 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, 389 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false,
365 OPackage::Update ); 390 OPackage::Update );
366 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 391 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
367 392
368 // Display widget 393 // Display widget
369 m_widgetStack.addWidget( dlg, 3 ); 394 m_widgetStack.addWidget( dlg, 3 );
370 m_widgetStack.raiseWidget( dlg ); 395 m_widgetStack.raiseWidget( dlg );
371} 396}
372 397
373void MainWindow::slotUpgrade() 398void MainWindow::slotUpgrade()
374{ 399{
375 // Create package manager output widget 400 // Create package manager output widget
376 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, 401 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false,
377 OPackage::Upgrade ); 402 OPackage::Upgrade );
378 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 403 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
379 404
380 // Display widget 405 // Display widget
381 m_widgetStack.addWidget( dlg, 3 ); 406 m_widgetStack.addWidget( dlg, 3 );
382 m_widgetStack.raiseWidget( dlg ); 407 m_widgetStack.raiseWidget( dlg );
383} 408}
384 409
385void MainWindow::slotDownload() 410void MainWindow::slotDownload()
386{ 411{
387 // Retrieve list of packages selected for download (if any) 412 // Retrieve list of packages selected for download (if any)
388 QStringList *workingPackages = new QStringList(); 413 QStringList *workingPackages = new QStringList();
389 414
390 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 415 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
391 item != 0 ; 416 item != 0 ;
392 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 417 item = static_cast<QCheckListItem *>(item->nextSibling()) )
393 { 418 {
394 if ( item->isOn() ) 419 if ( item->isOn() )
395 workingPackages->append( item->text() ); 420 workingPackages->append( item->text() );
396 } 421 }
397 422
398 if ( workingPackages->isEmpty() ) 423 if ( workingPackages->isEmpty() )
399 { 424 {
400 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 425 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
401 return; 426 return;
402 } 427 }
403 else 428 else
404 { 429 {
405 // Download selected packages 430 // Download selected packages
406 m_config.setGroup( "settings" ); 431 m_config.setGroup( "settings" );
407 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); 432 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );
408 433
409 bool ok = false; 434 bool ok = false;
410 QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); 435 QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this );
411 if ( ok && !text.isEmpty() ) 436 if ( ok && !text.isEmpty() )
412 workingDir = text; // user entered something and pressed ok 437 workingDir = text; // user entered something and pressed ok
413 else 438 else
414 return; // user entered nothing or pressed cancel 439 return; // user entered nothing or pressed cancel
415 440
416 // Store download directory in config file 441 // Store download directory in config file
417 m_config.writeEntry( "DownloadDir", workingDir ); 442 m_config.writeEntry( "DownloadDir", workingDir );
418 443
419 // Get starting directory 444 // Get starting directory
420 QDir::setCurrent( workingDir ); 445 QDir::setCurrent( workingDir );
421 446
422 // Create package manager output widget 447 // Create package manager output widget
423 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, 448 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
@@ -444,202 +469,193 @@ void MainWindow::slotApply()
444 { 469 {
445 OPackage *package = m_packman.findPackage( item->text() ); 470 OPackage *package = m_packman.findPackage( item->text() );
446 if ( package ) 471 if ( package )
447 { 472 {
448 if ( !package->versionInstalled().isNull() ) 473 if ( !package->versionInstalled().isNull() )
449 { 474 {
450 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 475 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
451 { 476 {
452 // Remove/upgrade package 477 // Remove/upgrade package
453 int answer = PromptDlg::ask( tr( "Remove or upgrade" ), 478 int answer = PromptDlg::ask( tr( "Remove or upgrade" ),
454 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), 479 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ),
455 tr( "Remove" ), tr( "Upgrade" ), this ); 480 tr( "Remove" ), tr( "Upgrade" ), this );
456 if ( answer == 1 ) // Remove 481 if ( answer == 1 ) // Remove
457 { 482 {
458 if ( !removeList ) 483 if ( !removeList )
459 removeList = new QStringList(); 484 removeList = new QStringList();
460 removeList->append( item->text() ); 485 removeList->append( item->text() );
461 } 486 }
462 else if ( answer == 2 ) // Upgrade 487 else if ( answer == 2 ) // Upgrade
463 { 488 {
464 if ( !upgradeList ) 489 if ( !upgradeList )
465 upgradeList = new QStringList(); 490 upgradeList = new QStringList();
466 upgradeList->append( item->text() ); 491 upgradeList->append( item->text() );
467 } 492 }
468 } 493 }
469 else 494 else
470 { 495 {
471 // Remove/reinstall package 496 // Remove/reinstall package
472 int answer = PromptDlg::ask( tr( "Remove or reinstall" ), 497 int answer = PromptDlg::ask( tr( "Remove or reinstall" ),
473 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), 498 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ),
474 tr( "Remove" ), tr( "Reinstall" ), this ); 499 tr( "Remove" ), tr( "Reinstall" ), this );
475 if ( answer == 1 ) // Remove 500 if ( answer == 1 ) // Remove
476 { 501 {
477 if ( !removeList ) 502 if ( !removeList )
478 removeList = new QStringList(); 503 removeList = new QStringList();
479 removeList->append( item->text() ); 504 removeList->append( item->text() );
480 } 505 }
481 else if ( answer == 2 ) // Reinstall 506 else if ( answer == 2 ) // Reinstall
482 { 507 {
483 if ( !installList ) 508 if ( !installList )
484 installList = new QStringList(); 509 installList = new QStringList();
485 installList->append( item->text() ); 510 installList->append( item->text() );
486 } 511 }
487 } 512 }
488 } 513 }
489 else 514 else
490 { 515 {
491 // Install package 516 // Install package
492 if ( !installList ) 517 if ( !installList )
493 installList = new QStringList(); 518 installList = new QStringList();
494 installList->append( item->text() ); 519 installList->append( item->text() );
495 } 520 }
496 } 521 }
497 } 522 }
498 } 523 }
499 524
500 // If nothing is selected, display message and exit 525 // If nothing is selected, display message and exit
501 if ( !removeList && !installList && !upgradeList ) 526 if ( !removeList && !installList && !upgradeList )
502 { 527 {
503 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 528 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
504 return; 529 return;
505 } 530 }
506 531
507 // Send command only if there are packages to process 532 // Send command only if there are packages to process
508 OPackage::Command removeCmd = OPackage::NotDefined; 533 OPackage::Command removeCmd = OPackage::NotDefined;
509 if ( removeList && !removeList->isEmpty() ) 534 if ( removeList && !removeList->isEmpty() )
510 removeCmd = OPackage::Remove; 535 removeCmd = OPackage::Remove;
511 OPackage::Command installCmd = OPackage::NotDefined; 536 OPackage::Command installCmd = OPackage::NotDefined;
512 if ( installList && !installList->isEmpty() ) 537 if ( installList && !installList->isEmpty() )
513 installCmd = OPackage::Install; 538 installCmd = OPackage::Install;
514 OPackage::Command upgradeCmd = OPackage::NotDefined; 539 OPackage::Command upgradeCmd = OPackage::NotDefined;
515 if ( upgradeList && !upgradeList->isEmpty() ) 540 if ( upgradeList && !upgradeList->isEmpty() )
516 upgradeCmd = OPackage::Upgrade; 541 upgradeCmd = OPackage::Upgrade;
517 542
518 // Create package manager output widget 543 // Create package manager output widget
519 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 544 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
520 removeCmd, removeList, 545 removeCmd, removeList,
521 installCmd, installList, 546 installCmd, installList,
522 upgradeCmd, upgradeList ); 547 upgradeCmd, upgradeList );
523 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 548 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
524 549
525 // Display widget 550 // Display widget
526 m_widgetStack.addWidget( dlg, 3 ); 551 m_widgetStack.addWidget( dlg, 3 );
527 m_widgetStack.raiseWidget( dlg ); 552 m_widgetStack.raiseWidget( dlg );
528} 553}
529 554
530void MainWindow::slotInstallLocal() 555void MainWindow::slotInstallLocal()
531{ 556{
532 // Display file open dialog with only package files 557 // Display file open dialog with only package files
533 MimeTypes type; 558 MimeTypes type;
534 QStringList packages; 559 QStringList packages;
535 packages << "application/ipkg"; 560 packages << "application/ipkg";
536 type.insert( tr( "Application Packages" ), packages ); 561 type.insert( tr( "Application Packages" ), packages );
537 QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, 562 QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL,
538 "/", QString::null, type ); 563 "/", QString::null, type );
539 if ( !package.isNull() ) 564 if ( !package.isNull() )
540 { 565 installLocalPackage( package );
541 // Install selected file
542 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true,
543 OPackage::Install, new QStringList( package ) );
544 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
545
546 // Display widget
547 m_widgetStack.addWidget( dlg, 3 );
548 m_widgetStack.raiseWidget( dlg );
549 }
550} 566}
551 567
552void MainWindow::slotCloseDlg() 568void MainWindow::slotCloseDlg()
553{ 569{
554 // Close install dialog 570 // Close install dialog
555 delete m_widgetStack.visibleWidget(); 571 delete m_widgetStack.visibleWidget();
556 572
557 // Reload package list 573 // Reload package list
558 initPackageInfo(); 574 initPackageInfo();
559 575
560 // Update Opie launcher links 576 // Update Opie launcher links
561 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 577 QCopEnvelope e("QPE/System", "linkChanged(QString)");
562 QString lf = QString::null; 578 QString lf = QString::null;
563 e << lf; 579 e << lf;
564 580
565 // Reapply any filters previously set 581 // Reapply any filters previously set
566 if ( m_actionShowNotInstalled->isOn() ) 582 if ( m_actionShowNotInstalled->isOn() )
567 slotShowNotInstalled(); 583 slotShowNotInstalled();
568 else if ( m_actionShowInstalled->isOn() ) 584 else if ( m_actionShowInstalled->isOn() )
569 slotShowInstalled(); 585 slotShowInstalled();
570 else if ( m_actionShowUpdated->isOn() ) 586 else if ( m_actionShowUpdated->isOn() )
571 slotShowUpdated(); 587 slotShowUpdated();
572 else if ( m_actionFilter->isOn() ) 588 else if ( m_actionFilter->isOn() )
573 slotFilter( true ); 589 slotFilter( true );
574} 590}
575 591
576void MainWindow::slotConfigure() 592void MainWindow::slotConfigure()
577{ 593{
578 if ( m_packman.configureDlg( false ) ) 594 if ( m_packman.configureDlg( false ) )
579 { 595 {
580 if ( PromptDlg::ask( tr( "Config updated" ), 596 if ( PromptDlg::ask( tr( "Config updated" ),
581 tr( "The configuration has been updated. Do you want to update server and package information now?" ), 597 tr( "The configuration has been updated. Do you want to update server and package information now?" ),
582 tr( "Yes" ), tr( "No" ), this ) == 1 ) 598 tr( "Yes" ), tr( "No" ), this ) == 1 )
583 { 599 {
584 // Update package list and reload package info 600 // Update package list and reload package info
585 slotUpdate(); 601 slotUpdate();
586 } 602 }
587 } 603 }
588} 604}
589 605
590void MainWindow::slotShowNotInstalled() 606void MainWindow::slotShowNotInstalled()
591{ 607{
592 OPackageList *packageList; 608 OPackageList *packageList;
593 if ( m_actionShowNotInstalled->isOn() ) 609 if ( m_actionShowNotInstalled->isOn() )
594 { 610 {
595 m_actionShowInstalled->setOn( false ); 611 m_actionShowInstalled->setOn( false );
596 m_actionShowUpdated->setOn( false ); 612 m_actionShowUpdated->setOn( false );
597 m_actionFilter->setOn( false ); 613 m_actionFilter->setOn( false );
598 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 614 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
599 OPackageManager::NotInstalled, QString::null ); 615 OPackageManager::NotInstalled, QString::null );
600 } 616 }
601 else 617 else
602 packageList = m_packman.packages(); 618 packageList = m_packman.packages();
603 619
604 if ( packageList ) 620 if ( packageList )
605 { 621 {
606 loadPackageList( packageList, true ); 622 loadPackageList( packageList, true );
607 delete packageList; 623 delete packageList;
608 } 624 }
609} 625}
610 626
611void MainWindow::slotShowInstalled() 627void MainWindow::slotShowInstalled()
612{ 628{
613 OPackageList *packageList; 629 OPackageList *packageList;
614 if ( m_actionShowInstalled->isOn() ) 630 if ( m_actionShowInstalled->isOn() )
615 { 631 {
616 m_actionShowNotInstalled->setOn( false ); 632 m_actionShowNotInstalled->setOn( false );
617 m_actionShowUpdated->setOn( false ); 633 m_actionShowUpdated->setOn( false );
618 m_actionFilter->setOn( false ); 634 m_actionFilter->setOn( false );
619 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 635 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
620 OPackageManager::Installed, QString::null ); 636 OPackageManager::Installed, QString::null );
621 } 637 }
622 else 638 else
623 packageList = m_packman.packages(); 639 packageList = m_packman.packages();
624 640
625 if ( packageList ) 641 if ( packageList )
626 { 642 {
627 loadPackageList( packageList, true ); 643 loadPackageList( packageList, true );
628 delete packageList; 644 delete packageList;
629 } 645 }
630} 646}
631 647
632void MainWindow::slotShowUpdated() 648void MainWindow::slotShowUpdated()
633{ 649{
634 OPackageList *packageList; 650 OPackageList *packageList;
635 if ( m_actionShowUpdated->isOn() ) 651 if ( m_actionShowUpdated->isOn() )
636 { 652 {
637 m_actionShowInstalled->setOn( false ); 653 m_actionShowInstalled->setOn( false );
638 m_actionShowNotInstalled->setOn( false ); 654 m_actionShowNotInstalled->setOn( false );
639 m_actionFilter->setOn( false ); 655 m_actionFilter->setOn( false );
640 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 656 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
641 OPackageManager::Updated, QString::null ); 657 OPackageManager::Updated, QString::null );
642 } 658 }
643 else 659 else
644 packageList = m_packman.packages(); 660 packageList = m_packman.packages();
645 661
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h
index 7968614..103c664 100644
--- a/noncore/settings/packagemanager/mainwindow.h
+++ b/noncore/settings/packagemanager/mainwindow.h
@@ -8,133 +8,136 @@ _;:, .> :=|. This file is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.= = ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++= -. .` .: 20++= -. .` .:
21: = ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22-. .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24 -- :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#ifndef MAINWINDOW_H 30#ifndef MAINWINDOW_H
31#define MAINWINDOW_H 31#define MAINWINDOW_H
32 32
33#include "opackagemanager.h" 33#include "opackagemanager.h"
34 34
35#include <qpe/config.h> 35#include <qpe/config.h>
36 36
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qmainwindow.h> 39#include <qmainwindow.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qprogressbar.h> 41#include <qprogressbar.h>
42#include <qtoolbar.h> 42#include <qtoolbar.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44 44
45class QAction; 45class QAction;
46class QLineEdit; 46class QLineEdit;
47 47
48class MainWindow :public QMainWindow 48class MainWindow :public QMainWindow
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); 53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 );
54 static QString appName() { return QString::fromLatin1( "packagemanager" ); }; 54 static QString appName() { return QString::fromLatin1( "packagemanager" ); };
55 55
56protected: 56protected:
57 void closeEvent( QCloseEvent *event ); 57 void closeEvent( QCloseEvent *event );
58 58
59private: 59private:
60 Config m_config; // Configuration file 60 Config m_config; // Configuration file
61 61
62 OPackageManager m_packman; // Package manager 62 OPackageManager m_packman; // Package manager
63 63
64 // Toolbars 64 // Toolbars
65 QToolBar m_menuBar; // Main toolbar containing menu 65 QToolBar m_menuBar; // Main toolbar containing menu
66 QToolBar m_toolBar; // Main toolbar 66 QToolBar m_toolBar; // Main toolbar
67 QToolBar m_findBar; // Find toolbar 67 QToolBar m_findBar; // Find toolbar
68 68
69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget 69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget
70 QListView m_packageList; // Main list view of all packages 70 QListView m_packageList; // Main list view of all packages
71 71
72 QLineEdit *m_findEdit; // Line edit box used for find toolbar 72 QLineEdit *m_findEdit; // Line edit box used for find toolbar
73 73
74 // Status widget controls 74 // Status widget controls
75 QWidget m_statusWidget; // Widget to display status during long operations 75 QWidget m_statusWidget; // Widget to display status during long operations
76 QLabel m_statusText; // Text status message 76 QLabel m_statusText; // Text status message
77 QProgressBar m_statusBar; // Progress bar showing % completed 77 QProgressBar m_statusBar; // Progress bar showing % completed
78 78
79 // Icon pixmaps 79 // Icon pixmaps
80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated 80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated
81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed 81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed
82 QPixmap m_iconNull; // Cached icon which shows when package is not installed 82 QPixmap m_iconNull; // Cached icon which shows when package is not installed
83 83
84 // Menu/tool bar actions 84 // Menu/tool bar actions
85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed 85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed
86 QAction *m_actionShowInstalled; // Action to show pakages currently installed 86 QAction *m_actionShowInstalled; // Action to show pakages currently installed
87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available 87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available
88 QAction *m_actionFilter; // Action to filter packages 88 QAction *m_actionFilter; // Action to filter packages
89 QAction *m_actionFindNext; // Action to find next match 89 QAction *m_actionFindNext; // Action to find next match
90 90
91 // Cached filter settings 91 // Cached filter settings
92 QString m_filterName; // Cached name filter value 92 QString m_filterName; // Cached name filter value
93 QString m_filterServer; // Cached server name filter value 93 QString m_filterServer; // Cached server name filter value
94 QString m_filterDest; // Cached destination name filter value 94 QString m_filterDest; // Cached destination name filter value
95 OPackageManager::Status m_filterStatus; // Cached status filter value 95 OPackageManager::Status m_filterStatus; // Cached status filter value
96 QString m_filterCategory; // Cached category filter value 96 QString m_filterCategory; // Cached category filter value
97 97
98 void initPackageList(); 98 void initPackageList();
99 void initStatusWidget(); 99 void initStatusWidget();
100 void initUI(); 100 void initUI();
101 101
102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); 102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true );
103 void searchForPackage( const QString &text ); 103 void searchForPackage( const QString &text );
104 void installLocalPackage( const QString &ipkFile );
104 105
105private slots: 106private slots:
107 void setDocument( const QString &ipkFile );
108
106 void initPackageInfo(); 109 void initPackageInfo();
107 void slotWidgetStackShow( QWidget *widget ); 110 void slotWidgetStackShow( QWidget *widget );
108 111
109 // Status widget slots 112 // Status widget slots
110 void slotInitStatusBar( int numSteps ); 113 void slotInitStatusBar( int numSteps );
111 void slotStatusText( const QString &status ); 114 void slotStatusText( const QString &status );
112 void slotStatusBar( int currStep ); 115 void slotStatusBar( int currStep );
113 116
114 // Actions menu action slots 117 // Actions menu action slots
115 void slotUpdate(); 118 void slotUpdate();
116 void slotUpgrade(); 119 void slotUpgrade();
117 void slotDownload(); 120 void slotDownload();
118 void slotApply(); 121 void slotApply();
119 void slotInstallLocal(); 122 void slotInstallLocal();
120 void slotCloseDlg(); 123 void slotCloseDlg();
121 void slotConfigure(); 124 void slotConfigure();
122 125
123 // View menu action slots 126 // View menu action slots
124 void slotShowNotInstalled(); 127 void slotShowNotInstalled();
125 void slotShowInstalled(); 128 void slotShowInstalled();
126 void slotShowUpdated(); 129 void slotShowUpdated();
127 void slotFilterChange(); 130 void slotFilterChange();
128 void slotFilter( bool isOn ); 131 void slotFilter( bool isOn );
129 132
130 // Find action slots 133 // Find action slots
131 void slotFindShowToolbar(); 134 void slotFindShowToolbar();
132 void slotFindHideToolbar(); 135 void slotFindHideToolbar();
133 void slotFindChanged( const QString &findText ); 136 void slotFindChanged( const QString &findText );
134 void slotFindNext(); 137 void slotFindNext();
135 138
136 // Other slots 139 // Other slots
137 void slotDisplayPackageInfo( QListViewItem * ); 140 void slotDisplayPackageInfo( QListViewItem * );
138}; 141};
139 142
140#endif 143#endif