summaryrefslogtreecommitdiff
authordrw <drw>2004-11-18 15:49:02 (UTC)
committer drw <drw>2004-11-18 15:49:02 (UTC)
commit7ac32658ba09d8456cc75e5cf80707caa616848b (patch) (unidiff)
tree56bae9b9c75eae7a9096013830fe98d28a4de0ed
parent718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40 (diff)
downloadopie-7ac32658ba09d8456cc75e5cf80707caa616848b.zip
opie-7ac32658ba09d8456cc75e5cf80707caa616848b.tar.gz
opie-7ac32658ba09d8456cc75e5cf80707caa616848b.tar.bz2
UI tweaks for Installation dialog - 1. Show destination selection only when installing apps, 2. Update available disk space after each package is processed, 3. Disable destination selection once start button has been clicked
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp61
-rw-r--r--noncore/settings/packagemanager/installdlg.h14
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp2
3 files changed, 63 insertions, 14 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 945dfed..781f8f5 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -9,75 +9,77 @@ _;:, .> :=|. This file is free software; you can
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 "installdlg.h" 30#include "installdlg.h"
31 31
32#include <opie2/ofiledialog.h> 32#include <opie2/ofiledialog.h>
33#include <opie2/oprocess.h>
33 34
34#include <qpe/fileselector.h> 35#include <qpe/fileselector.h>
35#include <qpe/resource.h> 36#include <qpe/resource.h>
36#include <qpe/storage.h> 37#include <qpe/storage.h>
37 38
38#include <qapplication.h> 39#include <qapplication.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qfileinfo.h> 41#include <qfileinfo.h>
41#include <qgroupbox.h> 42#include <qgroupbox.h>
42#include <qlabel.h> 43#include <qlabel.h>
43#include <qlayout.h> 44#include <qlayout.h>
44#include <qmap.h> 45#include <qmap.h>
45#include <qmultilineedit.h> 46#include <qmultilineedit.h>
46#include <qpushbutton.h> 47#include <qpushbutton.h>
47 48
48#include <sys/vfs.h> 49#include <sys/vfs.h>
49 50
50#include "opackagemanager.h" 51#include "opackagemanager.h"
51 52
52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, 53InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo,
53 OPackage::Command command1, const QStringList &packages1, 54 OPackage::Command command1, const QStringList &packages1,
54 OPackage::Command command2, const QStringList &packages2, 55 OPackage::Command command2, const QStringList &packages2,
55 OPackage::Command command3, const QStringList &packages3 ) 56 OPackage::Command command3, const QStringList &packages3 )
56 : QWidget( 0x0 ) 57 : QWidget( 0x0 )
57 , m_packman( pm ) 58 , m_packman( pm )
58 , m_numCommands( 0 ) 59 , m_numCommands( 0 )
59 , m_currCommand( 0 ) 60 , m_currCommand( 0 )
61 , m_destItem( 0x0 )
60{ 62{
61 // Save command/package list information 63 // Save command/package list information
62 if ( command1 != OPackage::NotDefined ) 64 if ( command1 != OPackage::NotDefined )
63 { 65 {
64 m_command[ m_numCommands ] = command1; 66 m_command[ m_numCommands ] = command1;
65 m_packages[ m_numCommands ] = packages1; 67 m_packages[ m_numCommands ] = packages1;
66 ++m_numCommands; 68 ++m_numCommands;
67 } 69 }
68 if ( command2 != OPackage::NotDefined ) 70 if ( command2 != OPackage::NotDefined )
69 { 71 {
70 m_command[ m_numCommands ] = command2; 72 m_command[ m_numCommands ] = command2;
71 m_packages[ m_numCommands ] = packages2; 73 m_packages[ m_numCommands ] = packages2;
72 ++m_numCommands; 74 ++m_numCommands;
73 } 75 }
74 if ( command3 != OPackage::NotDefined ) 76 if ( command3 != OPackage::NotDefined )
75 { 77 {
76 m_command[ m_numCommands ] = command3; 78 m_command[ m_numCommands ] = command3;
77 m_packages[ m_numCommands ] = packages3; 79 m_packages[ m_numCommands ] = packages3;
78 ++m_numCommands; 80 ++m_numCommands;
79 } 81 }
80 82
81 // Initialize UI 83 // Initialize UI
82 if ( parent ) 84 if ( parent )
83 parent->setCaption( caption ); 85 parent->setCaption( caption );
@@ -142,126 +144,160 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
142 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); 144 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
143 break; 145 break;
144 case OPackage::Download : lineStr.append( tr( "download" ) ); 146 case OPackage::Download : lineStr.append( tr( "download" ) );
145 break; 147 break;
146 default : 148 default :
147 break; 149 break;
148 }; 150 };
149 lineStr.append( ":\n" ); 151 lineStr.append( ":\n" );
150 152
151 QStringList tmpPackage = m_packages[ i ]; 153 QStringList tmpPackage = m_packages[ i ];
152 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) 154 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it )
153 { 155 {
154 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 156 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
155 } 157 }
156 158
157 m_output->append( lineStr ); 159 m_output->append( lineStr );
158 } 160 }
159 } 161 }
160 162
161 m_output->append( tr( "Press the start button to begin.\n" ) ); 163 m_output->append( tr( "Press the start button to begin.\n" ) );
162 m_output->setCursorPosition( m_output->numLines(), 0 ); 164 m_output->setCursorPosition( m_output->numLines(), 0 );
163 165
164} 166}
165 167
166InstallDlg::~InstallDlg()
167{
168}
169
170void InstallDlg::slotDisplayAvailSpace( const QString &destination ) 168void InstallDlg::slotDisplayAvailSpace( const QString &destination )
171{ 169{
172 // If available space is not displayed, exit 170 // If available space is not displayed, exit
173 if ( !m_availSpace ) 171 if ( !m_availSpace )
174 return; 172 return;
175 173
176 QString space = tr( "Unknown" ); 174 QString space = tr( "Unknown" );
177 175
178 // Get destination 176 // Get destination
179 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination ); 177 if ( !destination.isNull() )
178 m_destItem = m_packman->findConfItem( OConfItem::Destination, destination );
180 179
181 if ( dest ) 180 if ( m_destItem )
182 { 181 {
183 // Calculate available space 182 // Calculate available space
184 struct statfs fs; 183 struct statfs fs;
185 if ( !statfs( dest->value(), &fs ) ) 184 if ( !statfs( m_destItem->value(), &fs ) )
186 { 185 {
187 long mult = fs.f_bsize / 1024; 186 long mult = fs.f_bsize / 1024;
188 long div = 1024 / fs.f_bsize; 187 long div = 1024 / fs.f_bsize;
189 188
190 if ( !mult ) mult = 1; 189 if ( !mult ) mult = 1;
191 if ( !div ) div = 1; 190 if ( !div ) div = 1;
192 long avail = fs.f_bavail * mult / div; 191 long avail = fs.f_bavail * mult / div;
193 192
194 space = tr( "%1 Kb" ).arg( avail ); 193 space = tr( "%1 Kb" ).arg( avail );
195 } 194 }
196 } 195 }
197 196
198 // Display available space 197 // Display available space
199 m_availSpace->setText( space ); 198 m_availSpace->setText( space );
200} 199}
201 200
202void InstallDlg::slotBtnStart() 201void InstallDlg::slotBtnStart()
203{ 202{
204 QString btnText = m_btnStart->text(); 203 QString btnText = m_btnStart->text();
205 if ( btnText == tr( "Abort" ) ) 204 if ( btnText == tr( "Abort" ) )
206 { 205 {
207 // Prevent unexecuted commands from executing 206 // Prevent unexecuted commands from executing
208 m_currCommand = 999; 207 m_currCommand = 999;
209 208
210 // Allow user to close dialog 209 // Allow user to close dialog
211 m_btnStart->setText( tr( "Close" ) ); 210 m_btnStart->setText( tr( "Close" ) );
212 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 211 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
213 return; 212 return;
214 } 213 }
215 else if ( btnText == tr( "Close" ) ) 214 else if ( btnText == tr( "Close" ) )
216 { 215 {
217 // TODO - force reload of package data 216 // TODO - force reload of package data
218 emit closeInstallDlg(); 217 emit closeInstallDlg();
219 return; 218 return;
220 } 219 }
221 220
222 // Start was clicked, start executing 221 // Start was clicked, start executing
222 QString dest;
223 if ( m_destination )
224 {
225 dest = m_destination->currentText();
226 m_destination->setEnabled( false );
227 }
228
223 m_btnOptions->setEnabled( false ); 229 m_btnOptions->setEnabled( false );
224 if ( m_numCommands > 1 ) 230 if ( m_numCommands > 1 )
225 { 231 {
226 m_btnStart->setText( tr( "Abort" ) ); 232 m_btnStart->setText( tr( "Abort" ) );
227 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); 233 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) );
228 } 234 }
229 else 235 else
230 { 236 {
231 m_btnStart->setEnabled( false ); 237 m_btnStart->setEnabled( false );
232 } 238 }
233 239
234 QString dest;
235 if ( m_destination )
236 dest = m_destination->currentText();
237
238 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) 240 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
239 { 241 {
240 // Execute next command 242 // Execute next command
241 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, 243 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
242 this, SLOT(slotOutput(char*)), true ); 244 this, SLOT(slotOutput(char*)), true );
243 } 245 }
246 slotProcessDone(0l);
247
248 // Get destination
249/*
250 if ( dest == "root" )
251 {
252 slotProcessDone(0l);
253 return;
254 }
255
256 m_destItem = m_packman->findConfItem( OConfItem::Destination, dest );
257 if ( m_destItem )
258 {
259 QString path = m_destItem->value();
260 Opie::Core::OProcess *process = new Opie::Core::OProcess( this, "ipkg-link process" );
261 connect( process, SIGNAL(processExited(Opie::Core::OProcess*)),
262 this, SLOT(slotProcessDone(Opie::Core::OProcess*)) );
263
264 *process << "ipkg-link" << "mount" << path;
265 if ( !process->start( Opie::Core::OProcess::NotifyOnExit,
266 Opie::Core::OProcess::NoCommunication ) )
267 slotProcessDone( 0l );
268 m_output->append( tr( "Starting ipkg-link to link installed applications." ) );
269 m_output->setCursorPosition( m_output->numLines(), 0 );
270 }
271*/
272}
273
274void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc )
275{
276 delete proc;
277
278 m_output->append( tr( "The package linking is done." ) );
279 m_output->setCursorPosition( m_output->numLines(), 0 );
244 280
245 // All commands executed, allow user to close dialog 281 // All commands executed, allow user to close dialog
246 m_btnStart->setEnabled( true ); 282 m_btnStart->setEnabled( true );
247 m_btnStart->setText( tr( "Close" ) ); 283 m_btnStart->setText( tr( "Close" ) );
248 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 284 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
249 285
250 m_btnOptions->setEnabled( true ); 286 m_btnOptions->setEnabled( true );
251 m_btnOptions->setText( tr( "Save output" ) ); 287 m_btnOptions->setText( tr( "Save output" ) );
252 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); 288 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
253} 289}
254 290
255void InstallDlg::slotBtnOptions() 291void InstallDlg::slotBtnOptions()
256{ 292{
257 QString btnText = m_btnOptions->text(); 293 QString btnText = m_btnOptions->text();
258 if ( btnText == tr( "Options" ) ) 294 if ( btnText == tr( "Options" ) )
259 { 295 {
260 // Display configuration dialog (only options tab is enabled) 296 // Display configuration dialog (only options tab is enabled)
261 m_packman->configureDlg( true ); 297 m_packman->configureDlg( true );
262 return; 298 return;
263 } 299 }
264 300
265 // Save output was clicked 301 // Save output was clicked
266 QMap<QString, QStringList> map; 302 QMap<QString, QStringList> map;
267 map.insert( tr( "All" ), QStringList() ); 303 map.insert( tr( "All" ), QStringList() );
@@ -273,25 +309,28 @@ void InstallDlg::slotBtnOptions()
273 309
274 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 310 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
275 if( !filename.isEmpty() ) 311 if( !filename.isEmpty() )
276 { 312 {
277 QString currentFileName = QFileInfo( filename ).fileName(); 313 QString currentFileName = QFileInfo( filename ).fileName();
278 DocLnk doc; 314 DocLnk doc;
279 doc.setType( "text/plain" ); 315 doc.setType( "text/plain" );
280 doc.setFile( filename ); 316 doc.setFile( filename );
281 doc.setName( currentFileName ); 317 doc.setName( currentFileName );
282 FileManager fm; 318 FileManager fm;
283 fm.saveFile( doc, m_output->text() ); 319 fm.saveFile( doc, m_output->text() );
284 } 320 }
285} 321}
286 322
287void InstallDlg::slotOutput( char *msg ) 323void InstallDlg::slotOutput( char *msg )
288{ 324{
289 // Allow processing of other events 325 // Allow processing of other events
290 qApp->processEvents(); 326 qApp->processEvents();
291 327
292 QString lineStr = msg; 328 QString lineStr = msg;
293 if ( lineStr[lineStr.length()-1] == '\n' ) 329 if ( lineStr[lineStr.length()-1] == '\n' )
294 lineStr.truncate( lineStr.length() - 1 ); 330 lineStr.truncate( lineStr.length() - 1 );
295 m_output->append( lineStr ); 331 m_output->append( lineStr );
296 m_output->setCursorPosition( m_output->numLines(), 0 ); 332 m_output->setCursorPosition( m_output->numLines(), 0 );
333
334 // Update available space
335 slotDisplayAvailSpace( QString::null );
297} 336}
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h
index cddc911..f45c17c 100644
--- a/noncore/settings/packagemanager/installdlg.h
+++ b/noncore/settings/packagemanager/installdlg.h
@@ -18,71 +18,81 @@ _;:, .> :=|. This file is free software; you can
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 INSTALLDLG_H 30#ifndef INSTALLDLG_H
31#define INSTALLDLG_H 31#define INSTALLDLG_H
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35#include "opackage.h" 35#include "opackage.h"
36 36
37class QComboBox; 37class QComboBox;
38class QLabel; 38class QLabel;
39class QMultiLineEdit; 39class QMultiLineEdit;
40class QPushButton; 40class QPushButton;
41 41
42class OConfItem;
42class OPackageManager; 43class OPackageManager;
43 44
45namespace Opie
46{
47 namespace Core
48 {
49 class OProcess;
50 }
51}
52
44class InstallDlg : public QWidget 53class InstallDlg : public QWidget
45{ 54{
46 Q_OBJECT 55 Q_OBJECT
47 56
48public: 57public:
49 InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null, 58 InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null,
50 bool showDestInfo = true, 59 bool showDestInfo = true,
51 OPackage::Command command1 = OPackage::NotDefined, 60 OPackage::Command command1 = OPackage::NotDefined,
52 const QStringList &packages1 = QStringList(), 61 const QStringList &packages1 = QStringList(),
53 OPackage::Command command2 = OPackage::NotDefined, 62 OPackage::Command command2 = OPackage::NotDefined,
54 const QStringList &packages2 = QStringList(), 63 const QStringList &packages2 = QStringList(),
55 OPackage::Command command3 = OPackage::NotDefined, 64 OPackage::Command command3 = OPackage::NotDefined,
56 const QStringList &packages3 = QStringList() ); 65 const QStringList &packages3 = QStringList() );
57 ~InstallDlg();
58 66
59private: 67private:
60 OPackageManager *m_packman; // Pointer to application instance of package manager 68 OPackageManager *m_packman; // Pointer to application instance of package manager
61 69
62 // UI controls 70 // UI controls
63 QComboBox *m_destination; // Destination selection list 71 QComboBox *m_destination; // Destination selection list
64 QLabel *m_availSpace; // Text label to display available space on selected destination 72 QLabel *m_availSpace; // Text label to display available space on selected destination
65 QMultiLineEdit *m_output; // Multi-line edit to display status 73 QMultiLineEdit *m_output; // Multi-line edit to display status
66 QPushButton *m_btnStart; // Start/abort/close button 74 QPushButton *m_btnStart; // Start/abort/close button
67 QPushButton *m_btnOptions; // Installation options button 75 QPushButton *m_btnOptions; // Installation options button
68 76
69 // Commands and packages to execute 77 // Commands and packages to execute
70 int m_numCommands; // Number of commands to be executed 78 int m_numCommands; // Number of commands to be executed
71 int m_currCommand; // Number of currently executing command 79 int m_currCommand; // Number of currently executing command
72 OPackage::Command m_command[3]; // List of commands to be executed 80 OPackage::Command m_command[3]; // List of commands to be executed
73 QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) 81 QStringList m_packages[3]; // Lists of package names associated to commands (m_command[])
82 OConfItem *m_destItem; // Pointer to destination for package installation
74 83
75private slots: 84private slots:
76 // UI control slots 85 // UI control slots
77 void slotDisplayAvailSpace( const QString &destination ); 86 void slotDisplayAvailSpace( const QString &destination );
78 void slotBtnStart(); 87 void slotBtnStart();
79 void slotBtnOptions(); 88 void slotBtnOptions();
80 89 void slotProcessDone( Opie::Core::OProcess *proc );
90
81 // Execution slots 91 // Execution slots
82 void slotOutput( char *msg ); 92 void slotOutput( char *msg );
83 93
84signals: 94signals:
85 void closeInstallDlg(); 95 void closeInstallDlg();
86}; 96};
87 97
88#endif 98#endif
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 5e15874..459a75b 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -510,49 +510,49 @@ void MainWindow::slotApply()
510 } 510 }
511 } 511 }
512 } 512 }
513 } 513 }
514 514
515 // If nothing is selected, display message and exit 515 // If nothing is selected, display message and exit
516 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) 516 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() )
517 { 517 {
518 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 518 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
519 return; 519 return;
520 } 520 }
521 521
522 // Send command only if there are packages to process 522 // Send command only if there are packages to process
523 OPackage::Command removeCmd = OPackage::NotDefined; 523 OPackage::Command removeCmd = OPackage::NotDefined;
524 if ( !removeList.isEmpty() ) 524 if ( !removeList.isEmpty() )
525 removeCmd = OPackage::Remove; 525 removeCmd = OPackage::Remove;
526 OPackage::Command installCmd = OPackage::NotDefined; 526 OPackage::Command installCmd = OPackage::NotDefined;
527 if ( !installList.isEmpty() ) 527 if ( !installList.isEmpty() )
528 installCmd = OPackage::Install; 528 installCmd = OPackage::Install;
529 OPackage::Command upgradeCmd = OPackage::NotDefined; 529 OPackage::Command upgradeCmd = OPackage::NotDefined;
530 if ( !upgradeList.isEmpty() ) 530 if ( !upgradeList.isEmpty() )
531 upgradeCmd = OPackage::Upgrade; 531 upgradeCmd = OPackage::Upgrade;
532 532
533 // Create package manager output widget 533 // Create package manager output widget
534 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 534 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), !installList.isEmpty(),
535 removeCmd, removeList, 535 removeCmd, removeList,
536 installCmd, installList, 536 installCmd, installList,
537 upgradeCmd, upgradeList ); 537 upgradeCmd, upgradeList );
538 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 538 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
539 539
540 // Display widget 540 // Display widget
541 m_widgetStack.addWidget( dlg, 3 ); 541 m_widgetStack.addWidget( dlg, 3 );
542 m_widgetStack.raiseWidget( dlg ); 542 m_widgetStack.raiseWidget( dlg );
543} 543}
544 544
545void MainWindow::slotInstallLocal() 545void MainWindow::slotInstallLocal()
546{ 546{
547 // Display file open dialog with only package files 547 // Display file open dialog with only package files
548 MimeTypes type; 548 MimeTypes type;
549 QStringList packages; 549 QStringList packages;
550 packages << "application/ipkg"; 550 packages << "application/ipkg";
551 type.insert( tr( "Application Packages" ), packages ); 551 type.insert( tr( "Application Packages" ), packages );
552 QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, 552 QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL,
553 "/", QString::null, type ); 553 "/", QString::null, type );
554 if ( !package.isNull() ) 554 if ( !package.isNull() )
555 installLocalPackage( package ); 555 installLocalPackage( package );
556} 556}
557 557
558void MainWindow::slotCloseDlg() 558void MainWindow::slotCloseDlg()