Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 2bb8b4d..76d0a80 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -13,23 +13,27 @@ | |||
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | |||
20 | #include <opie/ofiledialog.h> | ||
19 | 21 | ||
20 | #ifdef QWS | 22 | #ifdef QWS |
21 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/fileselector.h> | ||
22 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
24 | #include <qpe/storage.h> | 27 | #include <qpe/storage.h> |
25 | #endif | 28 | #endif |
26 | 29 | ||
27 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
28 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
29 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qfileinfo.h> | ||
30 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
31 | #include <qmultilineedit.h> | 35 | #include <qmultilineedit.h> |
32 | #include <qlabel.h> | 36 | #include <qlabel.h> |
33 | #include <qlayout.h> | 37 | #include <qlayout.h> |
34 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
35 | 39 | ||
@@ -60,12 +64,13 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da | |||
60 | Config cfg( "aqpkg" ); | 64 | Config cfg( "aqpkg" ); |
61 | cfg.setGroup( "settings" ); | 65 | cfg.setGroup( "settings" ); |
62 | defaultDest = cfg.readEntry( "dest", "root" ); | 66 | defaultDest = cfg.readEntry( "dest", "root" ); |
63 | 67 | ||
64 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 68 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
65 | flags = cfg.readNumEntry( "installFlags", 0 ); | 69 | flags = cfg.readNumEntry( "installFlags", 0 ); |
70 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); | ||
66 | #else | 71 | #else |
67 | flags = 0; | 72 | flags = 0; |
68 | #endif | 73 | #endif |
69 | 74 | ||
70 | // Output text is read only | 75 | // Output text is read only |
71 | output->setReadOnly( true ); | 76 | output->setReadOnly( true ); |
@@ -187,23 +192,51 @@ void InstallDlgImpl :: init( bool displayextrainfo ) | |||
187 | layout->addWidget( btnOptions, 3, 1 ); | 192 | layout->addWidget( btnOptions, 3, 1 ); |
188 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); | 193 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); |
189 | } | 194 | } |
190 | 195 | ||
191 | void InstallDlgImpl :: optionsSelected() | 196 | void InstallDlgImpl :: optionsSelected() |
192 | { | 197 | { |
193 | InstallOptionsDlgImpl opt( flags, this, "Option", true ); | 198 | if ( btnOptions->text() == tr( "Options" ) ) |
194 | opt.exec(); | 199 | { |
195 | 200 | InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); | |
196 | // set options selected from dialog | 201 | if ( opt.exec() == QDialog::Accepted ) |
197 | flags = opt.getFlags(); | 202 | { |
203 | // set options selected from dialog | ||
204 | flags = opt.getFlags(); | ||
205 | infoLevel = opt.getInfoLevel(); | ||
198 | 206 | ||
199 | #ifdef QWS | 207 | #ifdef QWS |
200 | Config cfg( "aqpkg" ); | 208 | Config cfg( "aqpkg" ); |
201 | cfg.setGroup( "settings" ); | 209 | cfg.setGroup( "settings" ); |
202 | cfg.writeEntry( "installFlags", flags ); | 210 | cfg.writeEntry( "installFlags", flags ); |
211 | cfg.writeEntry( "infoLevel", infoLevel ); | ||
203 | #endif | 212 | #endif |
213 | } | ||
214 | } | ||
215 | else // Save output | ||
216 | { | ||
217 | QMap<QString, QStringList> map; | ||
218 | map.insert( tr( "All" ), QStringList() ); | ||
219 | QStringList text; | ||
220 | text << "text/*"; | ||
221 | map.insert(tr( "Text" ), text ); | ||
222 | text << "*"; | ||
223 | map.insert( tr( "All" ), text ); | ||
224 | |||
225 | QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | ||
226 | if( !filename.isEmpty() ) | ||
227 | { | ||
228 | QString currentFileName = QFileInfo( filename ).fileName(); | ||
229 | DocLnk doc; | ||
230 | doc.setType( "text/plain" ); | ||
231 | doc.setFile( filename ); | ||
232 | doc.setName( currentFileName ); | ||
233 | FileManager fm; | ||
234 | fm.saveFile( doc, output->text() ); | ||
235 | } | ||
236 | } | ||
204 | } | 237 | } |
205 | 238 | ||
206 | void InstallDlgImpl :: installSelected() | 239 | void InstallDlgImpl :: installSelected() |
207 | { | 240 | { |
208 | if ( btnInstall->text() == tr( "Abort" ) ) | 241 | if ( btnInstall->text() == tr( "Abort" ) ) |
209 | { | 242 | { |
@@ -269,20 +302,20 @@ void InstallDlgImpl :: installSelected() | |||
269 | pIpkg->setPackage( idata->packageName ); | 302 | pIpkg->setPackage( idata->packageName ); |
270 | 303 | ||
271 | int tmpFlags = flags; | 304 | int tmpFlags = flags; |
272 | if ( idata->destination->linkToRoot() ) | 305 | if ( idata->destination->linkToRoot() ) |
273 | tmpFlags |= MAKE_LINKS; | 306 | tmpFlags |= MAKE_LINKS; |
274 | 307 | ||
275 | pIpkg->setFlags( tmpFlags ); | 308 | pIpkg->setFlags( tmpFlags, infoLevel ); |
276 | pIpkg->runIpkg(); | 309 | pIpkg->runIpkg(); |
277 | } | 310 | } |
278 | 311 | ||
279 | pIpkg->setOption( "install" ); | 312 | pIpkg->setOption( "install" ); |
280 | pIpkg->setDestination( dest ); | 313 | pIpkg->setDestination( dest ); |
281 | pIpkg->setDestinationDir( destDir ); | 314 | pIpkg->setDestinationDir( destDir ); |
282 | pIpkg->setFlags( instFlags ); | 315 | pIpkg->setFlags( instFlags, infoLevel ); |
283 | QListIterator<InstallData> it2( installList ); | 316 | QListIterator<InstallData> it2( installList ); |
284 | for ( ; it2.current(); ++it2 ) | 317 | for ( ; it2.current(); ++it2 ) |
285 | { | 318 | { |
286 | pIpkg->setPackage( it2.current()->packageName ); | 319 | pIpkg->setPackage( it2.current()->packageName ); |
287 | pIpkg->runIpkg(); | 320 | pIpkg->runIpkg(); |
288 | } | 321 | } |
@@ -300,24 +333,27 @@ void InstallDlgImpl :: installSelected() | |||
300 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); | 333 | pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); |
301 | pIpkg->setPackage( idata->packageName ); | 334 | pIpkg->setPackage( idata->packageName ); |
302 | 335 | ||
303 | int tmpFlags = flags; | 336 | int tmpFlags = flags; |
304 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) | 337 | if ( idata->destination->linkToRoot() && idata->recreateLinks ) |
305 | tmpFlags |= MAKE_LINKS; | 338 | tmpFlags |= MAKE_LINKS; |
306 | pIpkg->setFlags( tmpFlags ); | 339 | pIpkg->setFlags( tmpFlags, infoLevel ); |
307 | pIpkg->runIpkg(); | 340 | pIpkg->runIpkg(); |
308 | } | 341 | } |
309 | 342 | ||
310 | delete pIpkg; | 343 | delete pIpkg; |
311 | pIpkg = 0; | 344 | pIpkg = 0; |
312 | } | 345 | } |
313 | 346 | ||
314 | btnOptions->setEnabled( true ); | 347 | btnOptions->setEnabled( true ); |
315 | // btnInstall->setEnabled( true ); | 348 | // btnInstall->setEnabled( true ); |
316 | btnInstall->setText( tr( "Close" ) ); | 349 | btnInstall->setText( tr( "Close" ) ); |
317 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | 350 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); |
351 | |||
352 | btnOptions->setText( tr( "Save output" ) ); | ||
353 | btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
318 | 354 | ||
319 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) | 355 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
320 | displayAvailableSpace( destination->currentText() ); | 356 | displayAvailableSpace( destination->currentText() ); |
321 | } | 357 | } |
322 | 358 | ||
323 | 359 | ||