-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 @@ -17,7 +17,10 @@ #include <stdio.h> + +#include <opie/ofiledialog.h> #ifdef QWS #include <qpe/config.h> +#include <qpe/fileselector.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> @@ -28,4 +31,5 @@ #include <qcombobox.h> #include <qdialog.h> +#include <qfileinfo.h> #include <qgroupbox.h> #include <qmultilineedit.h> @@ -64,4 +68,5 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da // Grab flags - Turn MAKE_LINKS on by default (if no flags found) flags = cfg.readNumEntry( "installFlags", 0 ); + infoLevel = cfg.readNumEntry( "infoLevel", 1 ); #else flags = 0; @@ -191,15 +196,43 @@ void InstallDlgImpl :: init( bool displayextrainfo ) void InstallDlgImpl :: optionsSelected() { - InstallOptionsDlgImpl opt( flags, this, "Option", true ); - opt.exec(); - - // set options selected from dialog - flags = opt.getFlags(); + if ( btnOptions->text() == tr( "Options" ) ) + { + InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); + if ( opt.exec() == QDialog::Accepted ) + { + // set options selected from dialog + flags = opt.getFlags(); + infoLevel = opt.getInfoLevel(); #ifdef QWS - Config cfg( "aqpkg" ); - cfg.setGroup( "settings" ); - cfg.writeEntry( "installFlags", flags ); + Config cfg( "aqpkg" ); + cfg.setGroup( "settings" ); + cfg.writeEntry( "installFlags", flags ); + cfg.writeEntry( "infoLevel", infoLevel ); #endif + } + } + else // Save output + { + QMap<QString, QStringList> map; + map.insert( tr( "All" ), QStringList() ); + QStringList text; + text << "text/*"; + map.insert(tr( "Text" ), text ); + text << "*"; + map.insert( tr( "All" ), text ); + + QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); + if( !filename.isEmpty() ) + { + QString currentFileName = QFileInfo( filename ).fileName(); + DocLnk doc; + doc.setType( "text/plain" ); + doc.setFile( filename ); + doc.setName( currentFileName ); + FileManager fm; + fm.saveFile( doc, output->text() ); + } + } } @@ -273,5 +306,5 @@ void InstallDlgImpl :: installSelected() tmpFlags |= MAKE_LINKS; - pIpkg->setFlags( tmpFlags ); + pIpkg->setFlags( tmpFlags, infoLevel ); pIpkg->runIpkg(); } @@ -280,5 +313,5 @@ void InstallDlgImpl :: installSelected() pIpkg->setDestination( dest ); pIpkg->setDestinationDir( destDir ); - pIpkg->setFlags( instFlags ); + pIpkg->setFlags( instFlags, infoLevel ); QListIterator<InstallData> it2( installList ); for ( ; it2.current(); ++it2 ) @@ -304,5 +337,5 @@ void InstallDlgImpl :: installSelected() if ( idata->destination->linkToRoot() && idata->recreateLinks ) tmpFlags |= MAKE_LINKS; - pIpkg->setFlags( tmpFlags ); + pIpkg->setFlags( tmpFlags, infoLevel ); pIpkg->runIpkg(); } @@ -316,4 +349,7 @@ void InstallDlgImpl :: installSelected() btnInstall->setText( tr( "Close" ) ); btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); + + btnOptions->setText( tr( "Save output" ) ); + btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); if ( destination && destination->currentText() != 0 && 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 @@ -60,4 +60,5 @@ private: QList<InstallData> updateList; int flags; + int infoLevel; Ipkg *pIpkg; bool upgradePackages; 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 @@ -21,5 +21,7 @@ #include <qcheckbox.h> +#include <qcombobox.h> #include <qgroupbox.h> +#include <qlabel.h> #include <qlayout.h> @@ -28,5 +30,5 @@ #include "ipkg.h" -InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const char* name, bool modal, WFlags fl ) +InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { @@ -56,6 +58,16 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const grplayout->addWidget( forceOverwrite ); - verboseWget = new QCheckBox( tr( "Verbose WGet" ), grpbox ); - grplayout->addWidget( verboseWget ); + QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); + grplayout->addWidget( l ); + + verboseIpkg = new QComboBox( grpbox ); + verboseIpkg->insertItem( tr( "Errors only" ) ); + verboseIpkg->insertItem( tr( "Normal messages" ) ); + verboseIpkg->insertItem( tr( "Informative messages" ) ); + verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); + verboseIpkg->setCurrentItem( verb ); + grplayout->addWidget( verboseIpkg ); + + grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); if ( flags & FORCE_DEPENDS ) @@ -67,6 +79,6 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const if ( flags & FORCE_OVERWRITE ) forceOverwrite->setChecked( true ); - if ( flags & VERBOSE_WGET ) - verboseWget->setChecked( true ); +// if ( flags & VERBOSE_WGET ) +// verboseWget->setChecked( true ); // if ( flags & MAKE_LINKS ) // makeLinks->setChecked( true ); @@ -98,2 +110,7 @@ int InstallOptionsDlgImpl :: getFlags() return flags; } + +int InstallOptionsDlgImpl :: getInfoLevel() +{ + return verboseIpkg->currentItem(); +} 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 @@ -21,4 +21,5 @@ class QCheckBox; +class QComboBox; class InstallOptionsDlgImpl : public QDialog @@ -26,7 +27,8 @@ class InstallOptionsDlgImpl : public QDialog Q_OBJECT public: - InstallOptionsDlgImpl( int flags, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); + InstallOptionsDlgImpl( int, int, QWidget * = 0, const char * = 0, bool = false, WFlags = 0 ); ~InstallOptionsDlgImpl(); int getFlags(); + int getInfoLevel(); private: @@ -36,4 +38,5 @@ private: QCheckBox* forceOverwrite; QCheckBox* verboseWget; + QComboBox* verboseIpkg; }; 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 @@ -70,5 +70,5 @@ bool Ipkg :: runIpkg( ) commands << ";"; } - commands << "ipkg" << "-force-defaults"; + commands << "ipkg" << "-V" << QString::number( infoLevel ) << "-force-defaults"; // only set the destination for an install operation @@ -87,5 +87,5 @@ bool Ipkg :: runIpkg( ) if ( flags & FORCE_OVERWRITE ) commands << "-force-overwrite"; - if ( flags & VERBOSE_WGET ) + if ( infoLevel == 3 ) commands << "-verbose_wget"; @@ -254,5 +254,5 @@ void Ipkg :: removeStatusEntry() } -int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option ) +int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) { // If one is already running - should never be but just to be safe 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 @@ -50,5 +50,5 @@ public: void setDestination( const char *dest ) { destination = dest; } void setDestinationDir( const char *dir ) { destDir = dir; } - void setFlags( int fl ) { flags = fl; } + void setFlags( int fl, int il ) { flags = fl; infoLevel = il; } void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; } @@ -74,4 +74,5 @@ private: OProcess *proc; int flags; + int infoLevel; bool finished; |