Diffstat (limited to 'noncore/settings/packagemanager/installdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 0c2ea78..aedd972 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -1,96 +1,96 @@ | |||
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 "installdlg.h" | 30 | #include "installdlg.h" |
31 | 31 | ||
32 | #include <sys/vfs.h> | 32 | #include <sys/vfs.h> |
33 | 33 | ||
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qfileinfo.h> | 36 | #include <qfileinfo.h> |
37 | #include <qgroupbox.h> | 37 | #include <qgroupbox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | #include <qmap.h> | 40 | #include <qmap.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
43 | 43 | ||
44 | #include <qpe/fileselector.h> | 44 | #include <qpe/fileselector.h> |
45 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
46 | #include <qpe/storage.h> | 46 | #include <qpe/storage.h> |
47 | 47 | ||
48 | #include <opie/ofiledialog.h> | 48 | #include <opie2/ofiledialog.h> |
49 | 49 | ||
50 | #include "opackagemanager.h" | 50 | #include "opackagemanager.h" |
51 | 51 | ||
52 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, | 52 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, |
53 | OPackage::Command command1, QStringList *packages1, | 53 | OPackage::Command command1, QStringList *packages1, |
54 | OPackage::Command command2, QStringList *packages2, | 54 | OPackage::Command command2, QStringList *packages2, |
55 | OPackage::Command command3, QStringList *packages3 ) | 55 | OPackage::Command command3, QStringList *packages3 ) |
56 | : QWidget( 0x0 ) | 56 | : QWidget( 0x0 ) |
57 | , m_packman( pm ) | 57 | , m_packman( pm ) |
58 | , m_numCommands( 0 ) | 58 | , m_numCommands( 0 ) |
59 | , m_currCommand( 0 ) | 59 | , m_currCommand( 0 ) |
60 | { | 60 | { |
61 | // Save command/package list information | 61 | // Save command/package list information |
62 | if ( command1 != OPackage::NotDefined ) | 62 | if ( command1 != OPackage::NotDefined ) |
63 | { | 63 | { |
64 | m_command[ m_numCommands ] = command1; | 64 | m_command[ m_numCommands ] = command1; |
65 | m_packages[ m_numCommands ] = packages1; | 65 | m_packages[ m_numCommands ] = packages1; |
66 | ++m_numCommands; | 66 | ++m_numCommands; |
67 | } | 67 | } |
68 | if ( command2 != OPackage::NotDefined ) | 68 | if ( command2 != OPackage::NotDefined ) |
69 | { | 69 | { |
70 | m_command[ m_numCommands ] = command2; | 70 | m_command[ m_numCommands ] = command2; |
71 | m_packages[ m_numCommands ] = packages2; | 71 | m_packages[ m_numCommands ] = packages2; |
72 | ++m_numCommands; | 72 | ++m_numCommands; |
73 | } | 73 | } |
74 | if ( command3 != OPackage::NotDefined ) | 74 | if ( command3 != OPackage::NotDefined ) |
75 | { | 75 | { |
76 | m_command[ m_numCommands ] = command3; | 76 | m_command[ m_numCommands ] = command3; |
77 | m_packages[ m_numCommands ] = packages3; | 77 | m_packages[ m_numCommands ] = packages3; |
78 | ++m_numCommands; | 78 | ++m_numCommands; |
79 | } | 79 | } |
80 | 80 | ||
81 | // Initialize UI | 81 | // Initialize UI |
82 | if ( parent ) | 82 | if ( parent ) |
83 | parent->setCaption( caption ); | 83 | parent->setCaption( caption ); |
84 | 84 | ||
85 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); | 85 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); |
86 | 86 | ||
87 | if ( showDestInfo ) | 87 | if ( showDestInfo ) |
88 | { | 88 | { |
89 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 89 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
90 | layout->addWidget( label, 0, 0 ); | 90 | layout->addWidget( label, 0, 0 ); |
91 | m_destination = new QComboBox( this ); | 91 | m_destination = new QComboBox( this ); |
92 | m_destination->insertStringList( *(m_packman->destinations()) ); | 92 | m_destination->insertStringList( *(m_packman->destinations()) ); |
93 | layout->addWidget( m_destination, 0, 1 ); | 93 | layout->addWidget( m_destination, 0, 1 ); |
94 | connect( m_destination, SIGNAL(highlighted(const QString&)), | 94 | connect( m_destination, SIGNAL(highlighted(const QString&)), |
95 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); | 95 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); |
96 | 96 | ||
@@ -230,72 +230,72 @@ void InstallDlg::slotBtnStart() | |||
230 | m_btnStart->setText( tr( "Abort" ) ); | 230 | m_btnStart->setText( tr( "Abort" ) ); |
231 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | 231 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); |
232 | } | 232 | } |
233 | else | 233 | else |
234 | { | 234 | { |
235 | m_btnStart->setEnabled( false ); | 235 | m_btnStart->setEnabled( false ); |
236 | } | 236 | } |
237 | 237 | ||
238 | QString dest; | 238 | QString dest; |
239 | if ( m_destination ) | 239 | if ( m_destination ) |
240 | dest = m_destination->currentText(); | 240 | dest = m_destination->currentText(); |
241 | 241 | ||
242 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 242 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
243 | { | 243 | { |
244 | // Execute next command | 244 | // Execute next command |
245 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | 245 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, |
246 | this, SLOT(slotOutput(char*)), true ); | 246 | this, SLOT(slotOutput(char*)), true ); |
247 | } | 247 | } |
248 | 248 | ||
249 | // All commands executed, allow user to close dialog | 249 | // All commands executed, allow user to close dialog |
250 | m_btnStart->setEnabled( true ); | 250 | m_btnStart->setEnabled( true ); |
251 | m_btnStart->setText( tr( "Close" ) ); | 251 | m_btnStart->setText( tr( "Close" ) ); |
252 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 252 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); |
253 | 253 | ||
254 | m_btnOptions->setEnabled( true ); | 254 | m_btnOptions->setEnabled( true ); |
255 | m_btnOptions->setText( tr( "Save output" ) ); | 255 | m_btnOptions->setText( tr( "Save output" ) ); |
256 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | 256 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); |
257 | } | 257 | } |
258 | 258 | ||
259 | void InstallDlg::slotBtnOptions() | 259 | void InstallDlg::slotBtnOptions() |
260 | { | 260 | { |
261 | QString btnText = m_btnOptions->text(); | 261 | QString btnText = m_btnOptions->text(); |
262 | if ( btnText == tr( "Options" ) ) | 262 | if ( btnText == tr( "Options" ) ) |
263 | { | 263 | { |
264 | // Display configuration dialog (only options tab is enabled) | 264 | // Display configuration dialog (only options tab is enabled) |
265 | m_packman->configureDlg( true ); | 265 | m_packman->configureDlg( true ); |
266 | return; | 266 | return; |
267 | } | 267 | } |
268 | 268 | ||
269 | // Save output was clicked | 269 | // Save output was clicked |
270 | QMap<QString, QStringList> map; | 270 | QMap<QString, QStringList> map; |
271 | map.insert( tr( "All" ), QStringList() ); | 271 | map.insert( tr( "All" ), QStringList() ); |
272 | QStringList text; | 272 | QStringList text; |
273 | text << "text/*"; | 273 | text << "text/*"; |
274 | map.insert(tr( "Text" ), text ); | 274 | map.insert(tr( "Text" ), text ); |
275 | text << "*"; | 275 | text << "*"; |
276 | map.insert( tr( "All" ), text ); | 276 | map.insert( tr( "All" ), text ); |
277 | 277 | ||
278 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 278 | QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
279 | if( !filename.isEmpty() ) | 279 | if( !filename.isEmpty() ) |
280 | { | 280 | { |
281 | QString currentFileName = QFileInfo( filename ).fileName(); | 281 | QString currentFileName = QFileInfo( filename ).fileName(); |
282 | DocLnk doc; | 282 | DocLnk doc; |
283 | doc.setType( "text/plain" ); | 283 | doc.setType( "text/plain" ); |
284 | doc.setFile( filename ); | 284 | doc.setFile( filename ); |
285 | doc.setName( currentFileName ); | 285 | doc.setName( currentFileName ); |
286 | FileManager fm; | 286 | FileManager fm; |
287 | fm.saveFile( doc, m_output->text() ); | 287 | fm.saveFile( doc, m_output->text() ); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | void InstallDlg::slotOutput( char *msg ) | 291 | void InstallDlg::slotOutput( char *msg ) |
292 | { | 292 | { |
293 | // Allow processing of other events | 293 | // Allow processing of other events |
294 | qApp->processEvents(); | 294 | qApp->processEvents(); |
295 | 295 | ||
296 | QString lineStr = msg; | 296 | QString lineStr = msg; |
297 | if ( lineStr[lineStr.length()-1] == '\n' ) | 297 | if ( lineStr[lineStr.length()-1] == '\n' ) |
298 | lineStr.truncate( lineStr.length() - 1 ); | 298 | lineStr.truncate( lineStr.length() - 1 ); |
299 | m_output->append( lineStr ); | 299 | m_output->append( lineStr ); |
300 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 300 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
301 | } | 301 | } |