summaryrefslogtreecommitdiff
path: root/noncore
authordrw <drw>2003-04-17 20:19:52 (UTC)
committer drw <drw>2003-04-17 20:19:52 (UTC)
commitfabadbc7caba39006fcdda5167c29fa287e23cc3 (patch) (unidiff)
treebcd0fe44cd443001514ff4f9e50af5e9da093fcc /noncore
parent187e3c56ab0bb2f562c9d6347a99edb440c18d6c (diff)
downloadopie-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.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp58
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h1
-rw-r--r--noncore/settings/aqpkg/instoptionsimpl.cpp27
-rw-r--r--noncore/settings/aqpkg/instoptionsimpl.h5
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp6
-rw-r--r--noncore/settings/aqpkg/ipkg.h3
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
@@ -16,9 +16,12 @@
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>
@@ -27,6 +30,7 @@
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>
@@ -63,6 +67,7 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da
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
@@ -190,17 +195,45 @@ void InstallDlgImpl :: init( bool displayextrainfo )
190 195
191void InstallDlgImpl :: optionsSelected() 196void 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
206void InstallDlgImpl :: installSelected() 239void InstallDlgImpl :: installSelected()
@@ -272,14 +305,14 @@ void InstallDlgImpl :: installSelected()
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 {
@@ -303,7 +336,7 @@ void InstallDlgImpl :: installSelected()
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
@@ -315,6 +348,9 @@ void InstallDlgImpl :: installSelected()
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() );
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
@@ -59,6 +59,7 @@ private:
59 QList<InstallData> removeList; 59 QList<InstallData> removeList;
60 QList<InstallData> updateList; 60 QList<InstallData> updateList;
61 int flags; 61 int flags;
62 int infoLevel;
62 Ipkg *pIpkg; 63 Ipkg *pIpkg;
63 bool upgradePackages; 64 bool upgradePackages;
64 65
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
@@ -20,14 +20,16 @@
20#endif 20#endif
21 21
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>
25 27
26#include "global.h" 28#include "global.h"
27#include "instoptionsimpl.h" 29#include "instoptionsimpl.h"
28#include "ipkg.h" 30#include "ipkg.h"
29 31
30InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const char* name, bool modal, WFlags fl ) 32InstallOptionsDlgImpl::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 )
32{ 34{
33 setCaption( tr( "Options" ) ); 35 setCaption( tr( "Options" ) );
@@ -55,8 +57,18 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const
55 forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox ); 57 forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox );
56 grplayout->addWidget( forceOverwrite ); 58 grplayout->addWidget( forceOverwrite );
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
61 if ( flags & FORCE_DEPENDS ) 73 if ( flags & FORCE_DEPENDS )
62 forceDepends->setChecked( true ); 74 forceDepends->setChecked( true );
@@ -66,8 +78,8 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const
66 forceRemove->setChecked( true ); 78 forceRemove->setChecked( true );
67 if ( flags & FORCE_OVERWRITE ) 79 if ( flags & FORCE_OVERWRITE )
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 )
72 // makeLinks->setChecked( true ); 84 // makeLinks->setChecked( true );
73 85
@@ -97,3 +109,8 @@ int InstallOptionsDlgImpl :: getFlags()
97 109
98 return flags; 110 return flags;
99} 111}
112
113int 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
@@ -20,14 +20,16 @@
20#include <qdialog.h> 20#include <qdialog.h>
21 21
22class QCheckBox; 22class QCheckBox;
23class QComboBox;
23 24
24class InstallOptionsDlgImpl : public QDialog 25class InstallOptionsDlgImpl : public QDialog
25{ 26{
26 Q_OBJECT 27 Q_OBJECT
27public: 28public:
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
32private: 34private:
33 QCheckBox* forceDepends; 35 QCheckBox* forceDepends;
@@ -35,6 +37,7 @@ private:
35 QCheckBox* forceRemove; 37 QCheckBox* forceRemove;
36 QCheckBox* forceOverwrite; 38 QCheckBox* forceOverwrite;
37 QCheckBox* verboseWget; 39 QCheckBox* verboseWget;
40 QComboBox* verboseIpkg;
38}; 41};
39 42
40#endif 43#endif
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
@@ -69,7 +69,7 @@ bool Ipkg :: runIpkg( )
69 commands << runtimeDir; 69 commands << runtimeDir;
70 commands << ";"; 70 commands << ";";
71 } 71 }
72 commands << "ipkg" << "-force-defaults"; 72 commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults";
73 73
74 // only set the destination for an install operation 74 // only set the destination for an install operation
75 if ( option == "install" ) 75 if ( option == "install" )
@@ -86,7 +86,7 @@ bool Ipkg :: runIpkg( )
86 commands << "-force-removal-of-essential-packages"; 86 commands << "-force-removal-of-essential-packages";
87 if ( flags & FORCE_OVERWRITE ) 87 if ( flags & FORCE_OVERWRITE )
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";
91 91
92 // Handle make links 92 // Handle make links
@@ -253,7 +253,7 @@ void Ipkg :: removeStatusEntry()
253 rename( outStatusFile, statusFile ); 253 rename( outStatusFile, statusFile );
254} 254}
255 255
256int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option ) 256int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
257{ 257{
258 // If one is already running - should never be but just to be safe 258 // If one is already running - should never be but just to be safe
259 if ( proc ) 259 if ( proc )
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
@@ -49,7 +49,7 @@ public:
49 void setPackage( const char *pkg ) { package = pkg; } 49 void setPackage( const char *pkg ) { package = pkg; }
50 void setDestination( const char *dest ) { destination = dest; } 50 void setDestination( const char *dest ) { destination = dest; }
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; }
54 54
55signals: 55signals:
@@ -73,6 +73,7 @@ private:
73 QString runtimeDir; 73 QString runtimeDir;
74 OProcess *proc; 74 OProcess *proc;
75 int flags; 75 int flags;
76 int infoLevel;
76 bool finished; 77 bool finished;
77 78
78 QList<QString> *dependantPackages; 79 QList<QString> *dependantPackages;