author | drw <drw> | 2003-04-17 20:19:52 (UTC) |
---|---|---|
committer | drw <drw> | 2003-04-17 20:19:52 (UTC) |
commit | fabadbc7caba39006fcdda5167c29fa287e23cc3 (patch) (unidiff) | |
tree | bcd0fe44cd443001514ff4f9e50af5e9da093fcc /noncore/settings/aqpkg | |
parent | 187e3c56ab0bb2f562c9d6347a99edb440c18d6c (diff) | |
download | opie-fabadbc7caba39006fcdda5167c29fa287e23cc3.zip opie-fabadbc7caba39006fcdda5167c29fa287e23cc3.tar.gz opie-fabadbc7caba39006fcdda5167c29fa287e23cc3.tar.bz2 |
Added better verbosity options and option to save ipkg output to a file (per 'bugs' #856 & #857). Also fixed Ok/Cancel behavior on install options dialog.
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 58 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 1 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.cpp | 27 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.h | 5 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.h | 3 |
6 files changed, 79 insertions, 21 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 | |||
@@ -18,2 +18,4 @@ | |||
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | |||
20 | #include <opie/ofiledialog.h> | ||
19 | 21 | ||
@@ -21,2 +23,3 @@ | |||
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> |
@@ -29,2 +32,3 @@ | |||
29 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qfileinfo.h> | ||
30 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
@@ -65,2 +69,3 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da | |||
65 | flags = cfg.readNumEntry( "installFlags", 0 ); | 69 | flags = cfg.readNumEntry( "installFlags", 0 ); |
70 | infoLevel = cfg.readNumEntry( "infoLevel", 1 ); | ||
66 | #else | 71 | #else |
@@ -192,13 +197,41 @@ 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 | } |
@@ -274,3 +307,3 @@ void InstallDlgImpl :: installSelected() | |||
274 | 307 | ||
275 | pIpkg->setFlags( tmpFlags ); | 308 | pIpkg->setFlags( tmpFlags, infoLevel ); |
276 | pIpkg->runIpkg(); | 309 | pIpkg->runIpkg(); |
@@ -281,3 +314,3 @@ void InstallDlgImpl :: installSelected() | |||
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 ); |
@@ -305,3 +338,3 @@ void InstallDlgImpl :: installSelected() | |||
305 | tmpFlags |= MAKE_LINKS; | 338 | tmpFlags |= MAKE_LINKS; |
306 | pIpkg->setFlags( tmpFlags ); | 339 | pIpkg->setFlags( tmpFlags, infoLevel ); |
307 | pIpkg->runIpkg(); | 340 | pIpkg->runIpkg(); |
@@ -317,2 +350,5 @@ void InstallDlgImpl :: installSelected() | |||
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 | ||
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index c30963e..15cf427 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h | |||
@@ -61,2 +61,3 @@ private: | |||
61 | int flags; | 61 | int flags; |
62 | int infoLevel; | ||
62 | Ipkg *pIpkg; | 63 | Ipkg *pIpkg; |
diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp index 47b250d..72d794f 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.cpp +++ b/noncore/settings/aqpkg/instoptionsimpl.cpp | |||
@@ -22,3 +22,5 @@ | |||
22 | #include <qcheckbox.h> | 22 | #include <qcheckbox.h> |
23 | #include <qcombobox.h> | ||
23 | #include <qgroupbox.h> | 24 | #include <qgroupbox.h> |
25 | #include <qlabel.h> | ||
24 | #include <qlayout.h> | 26 | #include <qlayout.h> |
@@ -29,3 +31,3 @@ | |||
29 | 31 | ||
30 | InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const char* name, bool modal, WFlags fl ) | 32 | InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) |
31 | : QDialog( parent, name, modal, fl ) | 33 | : QDialog( parent, name, modal, fl ) |
@@ -57,4 +59,14 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const | |||
57 | 59 | ||
58 | verboseWget = new QCheckBox( tr( "Verbose WGet" ), grpbox ); | 60 | QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); |
59 | grplayout->addWidget( verboseWget ); | 61 | grplayout->addWidget( l ); |
62 | |||
63 | verboseIpkg = new QComboBox( grpbox ); | ||
64 | verboseIpkg->insertItem( tr( "Errors only" ) ); | ||
65 | verboseIpkg->insertItem( tr( "Normal messages" ) ); | ||
66 | verboseIpkg->insertItem( tr( "Informative messages" ) ); | ||
67 | verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | ||
68 | verboseIpkg->setCurrentItem( verb ); | ||
69 | grplayout->addWidget( verboseIpkg ); | ||
70 | |||
71 | grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | ||
60 | 72 | ||
@@ -68,4 +80,4 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const | |||
68 | forceOverwrite->setChecked( true ); | 80 | forceOverwrite->setChecked( true ); |
69 | if ( flags & VERBOSE_WGET ) | 81 | // if ( flags & VERBOSE_WGET ) |
70 | verboseWget->setChecked( true ); | 82 | // verboseWget->setChecked( true ); |
71 | // if ( flags & MAKE_LINKS ) | 83 | // if ( flags & MAKE_LINKS ) |
@@ -99 +111,6 @@ int InstallOptionsDlgImpl :: getFlags() | |||
99 | } | 111 | } |
112 | |||
113 | int InstallOptionsDlgImpl :: getInfoLevel() | ||
114 | { | ||
115 | return verboseIpkg->currentItem(); | ||
116 | } | ||
diff --git a/noncore/settings/aqpkg/instoptionsimpl.h b/noncore/settings/aqpkg/instoptionsimpl.h index f4724a0..1312afd 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.h +++ b/noncore/settings/aqpkg/instoptionsimpl.h | |||
@@ -22,2 +22,3 @@ | |||
22 | class QCheckBox; | 22 | class QCheckBox; |
23 | class QComboBox; | ||
23 | 24 | ||
@@ -27,5 +28,6 @@ class InstallOptionsDlgImpl : public QDialog | |||
27 | public: | 28 | public: |
28 | InstallOptionsDlgImpl( int flags, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 29 | InstallOptionsDlgImpl( int, int, QWidget * = 0, const char * = 0, bool = false, WFlags = 0 ); |
29 | ~InstallOptionsDlgImpl(); | 30 | ~InstallOptionsDlgImpl(); |
30 | int getFlags(); | 31 | int getFlags(); |
32 | int getInfoLevel(); | ||
31 | 33 | ||
@@ -37,2 +39,3 @@ private: | |||
37 | QCheckBox* verboseWget; | 39 | QCheckBox* verboseWget; |
40 | QComboBox* verboseIpkg; | ||
38 | }; | 41 | }; |
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index e66c02d..7df643e 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp | |||
@@ -71,3 +71,3 @@ bool Ipkg :: runIpkg( ) | |||
71 | } | 71 | } |
72 | commands << "ipkg" << "-force-defaults"; | 72 | commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults"; |
73 | 73 | ||
@@ -88,3 +88,3 @@ bool Ipkg :: runIpkg( ) | |||
88 | commands << "-force-overwrite"; | 88 | commands << "-force-overwrite"; |
89 | if ( flags & VERBOSE_WGET ) | 89 | if ( infoLevel == 3 ) |
90 | commands << "-verbose_wget"; | 90 | commands << "-verbose_wget"; |
@@ -255,3 +255,3 @@ void Ipkg :: removeStatusEntry() | |||
255 | 255 | ||
256 | int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option ) | 256 | int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) |
257 | { | 257 | { |
diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h index d49bb04..531bfc0 100644 --- a/noncore/settings/aqpkg/ipkg.h +++ b/noncore/settings/aqpkg/ipkg.h | |||
@@ -51,3 +51,3 @@ public: | |||
51 | void setDestinationDir( const char *dir ) { destDir = dir; } | 51 | void setDestinationDir( const char *dir ) { destDir = dir; } |
52 | void setFlags( int fl ) { flags = fl; } | 52 | void setFlags( int fl, int il ) { flags = fl; infoLevel = il; } |
53 | void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } | 53 | void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } |
@@ -75,2 +75,3 @@ private: | |||
75 | int flags; | 75 | int flags; |
76 | int infoLevel; | ||
76 | bool finished; | 77 | bool finished; |