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
@@ -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
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()
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
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
@@ -56,12 +56,13 @@ protected:
56private: 56private:
57 DataManager *dataMgr; 57 DataManager *dataMgr;
58 QList<InstallData> installList; 58 QList<InstallData> installList;
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
65 QComboBox *destination; 66 QComboBox *destination;
66 QPushButton *btnInstall; 67 QPushButton *btnInstall;
67 QPushButton *btnOptions; 68 QPushButton *btnOptions;
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
@@ -17,20 +17,22 @@
17 17
18#ifdef QWS 18#ifdef QWS
19#include <qpe/config.h> 19#include <qpe/config.h>
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" ) );
34 36
35 QVBoxLayout *layout = new QVBoxLayout( this ); 37 QVBoxLayout *layout = new QVBoxLayout( this );
36 layout->setMargin( 2 ); 38 layout->setMargin( 2 );
@@ -52,25 +54,35 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const
52 forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox ); 54 forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox );
53 grplayout->addWidget( forceRemove ); 55 grplayout->addWidget( forceRemove );
54 56
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 );
63 if ( flags & FORCE_REINSTALL ) 75 if ( flags & FORCE_REINSTALL )
64 forceReinstall->setChecked( true ); 76 forceReinstall->setChecked( true );
65 if ( flags & FORCE_REMOVE ) 77 if ( flags & FORCE_REMOVE )
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
74 showMaximized(); 86 showMaximized();
75 87
76} 88}
@@ -94,6 +106,11 @@ int InstallOptionsDlgImpl :: getFlags()
94 flags |= FORCE_OVERWRITE; 106 flags |= FORCE_OVERWRITE;
95 if ( verboseWget->isChecked() ) 107 if ( verboseWget->isChecked() )
96 flags |= VERBOSE_WGET; 108 flags |= VERBOSE_WGET;
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
@@ -17,24 +17,27 @@
17#ifndef INSTALLOPTIONSIMPL_H 17#ifndef INSTALLOPTIONSIMPL_H
18#define INSTALLOPTIONSIMPL_H 18#define INSTALLOPTIONSIMPL_H
19 19
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;
34 QCheckBox* forceReinstall; 36 QCheckBox* forceReinstall;
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
@@ -66,13 +66,13 @@ bool Ipkg :: runIpkg( )
66 if ( runtimeDir != "" ) 66 if ( runtimeDir != "" )
67 { 67 {
68 commands << "cd "; 68 commands << "cd ";
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" )
76 commands << "-dest" << destination; 76 commands << "-dest" << destination;
77 77
78 78
@@ -83,13 +83,13 @@ bool Ipkg :: runIpkg( )
83 if ( flags & FORCE_REINSTALL ) 83 if ( flags & FORCE_REINSTALL )
84 commands << "-force-reinstall"; 84 commands << "-force-reinstall";
85 if ( flags & FORCE_REMOVE ) 85 if ( flags & FORCE_REMOVE )
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
93 // Rules - If make links is switched on, create links to root 93 // Rules - If make links is switched on, create links to root
94 // if destDir is NOT / 94 // if destDir is NOT /
95 if ( flags & MAKE_LINKS ) 95 if ( flags & MAKE_LINKS )
@@ -250,13 +250,13 @@ void Ipkg :: removeStatusEntry()
250 250
251 // Remove old status file and put tmp stats file in its place 251 // Remove old status file and put tmp stats file in its place
252 remove( statusFile ); 252 remove( statusFile );
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 )
260 { 260 {
261 delete proc; 261 delete proc;
262 proc = 0; 262 proc = 0;
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
@@ -46,13 +46,13 @@ public:
46 bool runIpkg( ); 46 bool runIpkg( );
47 47
48 void setOption( const char *opt ) { option = opt; } 48 void setOption( const char *opt ) { option = opt; }
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:
56 void outputText( const QString &text ); 56 void outputText( const QString &text );
57 57
58public slots: 58public slots:
@@ -70,12 +70,13 @@ private:
70 QString package; 70 QString package;
71 QString destination; 71 QString destination;
72 QString destDir; 72 QString destDir;
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;
79 80
80 int executeIpkgCommand( QStringList &cmd, const QString option ); 81 int executeIpkgCommand( QStringList &cmd, const QString option );
81 void removeStatusEntry(); 82 void removeStatusEntry();