author | andyq <andyq> | 2002-11-22 16:11:49 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-22 16:11:49 (UTC) |
commit | 34ca473739286557b3d0c73525740f0b8b01fd4b (patch) (side-by-side diff) | |
tree | 727fa7f17d0bafa7b2e4ae30eed2c80f80b770d9 | |
parent | 8366956992e07a9fc77b9e126bb429b32fd4ad9a (diff) | |
download | opie-34ca473739286557b3d0c73525740f0b8b01fd4b.zip opie-34ca473739286557b3d0c73525740f0b8b01fd4b.tar.gz opie-34ca473739286557b3d0c73525740f0b8b01fd4b.tar.bz2 |
Added verbose_wget flags (doesn't yet work properly though coz ipkg is sending crap)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 55 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptions.ui | 218 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.cpp | 21 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.h | 1 |
4 files changed, 163 insertions, 132 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index db9a259..485fe3d 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -1,43 +1,44 @@ /*************************************************************************** installdlgimpl.cpp - description ------------------- begin : Mon Aug 26 2002 copyright : (C) 2002 by Andy Qua email : andy.qua@blueyonder.co.uk ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifdef QWS #include <qpe/config.h> +#include <qpe/qpeapplication.h> #endif #include <qmultilineedit.h> #include <qdialog.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qpushbutton.h> #include "datamgr.h" #include "instoptionsimpl.h" #include "destination.h" #include "installdlgimpl.h" #include "global.h" InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) : InstallDlg( parent, name, modal, fl ) { pIpkg = 0; upgradePackages = false; dataMgr = dataManager; vector<Destination>::iterator dit; QString defaultDest = "root"; @@ -70,173 +71,169 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d } destination->setCurrentItem( defIndex ); vector<InstallData>::iterator it; // setup package data QString remove = "Remove\n"; QString install = "\nInstall\n"; QString upgrade = "\nUpgrade\n"; for ( it = packageList.begin() ; it != packageList.end() ; ++it ) { InstallData item = *it; if ( item.option == "I" ) { installList.push_back( item ); install += " " + item.packageName + "\n"; } else if ( item.option == "D" ) { removeList.push_back( item ); remove += " " + item.packageName + "\n"; } else if ( item.option == "U" || item.option == "R" ) { - updateList.push_back( item ); + updateList.push_back( item ); QString type = " (Upgrade)"; if ( item.option == "R" ) type = " (ReInstall)"; - upgrade += " " + item.packageName + type + "\n"; - } - } + upgrade += " " + item.packageName + type + "\n"; + } + } - output->setText( remove + install + upgrade ); + output->setText( remove + install + upgrade ); } InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) : InstallDlg( parent, name, modal, fl ) { pIpkg = ipkg; output->setText( initialText ); } InstallDlgImpl::~InstallDlgImpl() { } bool InstallDlgImpl :: showDlg() { - showMaximized(); - bool ret = exec(); + showMaximized(); + bool ret = exec(); - return ret; + return ret; } void InstallDlgImpl :: optionsSelected() { - InstallOptionsDlgImpl opt( flags, this, "Option", true ); - opt.exec(); - - // set options selected from dialog - flags = 0; - if ( opt.forceDepends->isChecked() ) - flags |= FORCE_DEPENDS; - if ( opt.forceReinstall->isChecked() ) - flags |= FORCE_REINSTALL; - if ( opt.forceRemove->isChecked() ) - flags |= FORCE_REMOVE; - if ( opt.forceOverwrite->isChecked() ) - flags |= FORCE_OVERWRITE; + InstallOptionsDlgImpl opt( flags, this, "Option", true ); + opt.exec(); + + // set options selected from dialog + flags = opt.getFlags(); #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "installFlags", flags ); #endif } void InstallDlgImpl :: installSelected() { - if ( btnInstall->text() == "Close" ) - { - done( 1 ); - return; - } + + if ( btnInstall->text() == "Close" ) + { + done( 1 ); + return; + } - btnInstall->setEnabled( false ); + // Disable buttons + btnOptions->setEnabled( false ); + btnInstall->setEnabled( false ); if ( pIpkg ) { output->setText( "" ); connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); pIpkg->runIpkg(); } else { output->setText( "" ); vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); QString dest = d->getDestinationName(); QString destDir = d->getDestinationPath(); int instFlags = flags; if ( d->linkToRoot() ) instFlags |= MAKE_LINKS; #ifdef QWS // Save settings Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "dest", dest ); #endif pIpkg = new Ipkg; connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); // First run through the remove list, then the install list then the upgrade list - vector<InstallData>::iterator it; + vector<InstallData>::iterator it; pIpkg->setOption( "remove" ); for ( it = removeList.begin() ; it != removeList.end() ; ++it ) { pIpkg->setDestination( it->destination->getDestinationName() ); pIpkg->setDestinationDir( it->destination->getDestinationPath() ); pIpkg->setPackage( it->packageName ); int tmpFlags = flags; if ( it->destination->linkToRoot() ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } pIpkg->setOption( "install" ); pIpkg->setDestination( dest ); pIpkg->setDestinationDir( destDir ); pIpkg->setFlags( instFlags ); for ( it = installList.begin() ; it != installList.end() ; ++it ) { pIpkg->setPackage( it->packageName ); pIpkg->runIpkg(); } flags |= FORCE_REINSTALL; for ( it = updateList.begin() ; it != updateList.end() ; ++it ) { if ( it->option == "R" ) pIpkg->setOption( "reinstall" ); else pIpkg->setOption( "upgrade" ); pIpkg->setDestination( it->destination->getDestinationName() ); pIpkg->setDestinationDir( it->destination->getDestinationPath() ); pIpkg->setPackage( it->packageName ); int tmpFlags = flags; if ( it->destination->linkToRoot() && it->recreateLinks ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags ); pIpkg->runIpkg(); } delete pIpkg; } - btnInstall->setEnabled( true ); + btnOptions->setEnabled( true ); + btnInstall->setEnabled( true ); btnInstall->setText( tr( "Close" ) ); } void InstallDlgImpl :: displayText(const QString &text ) { QString t = output->text() + "\n" + text; output->setText( t ); output->setCursorPosition( output->numLines(), 0 ); } diff --git a/noncore/settings/aqpkg/instoptions.ui b/noncore/settings/aqpkg/instoptions.ui index 52897dd..00eab1e 100644 --- a/noncore/settings/aqpkg/instoptions.ui +++ b/noncore/settings/aqpkg/instoptions.ui @@ -1,155 +1,167 @@ <!DOCTYPE UI><UI> <class>InstallOptionsDlg</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>InstallOptionsDlg</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>154</width> - <height>205</height> + <width>283</width> + <height>274</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Options</string> </property> <property stdset="1"> <name>sizeGripEnabled</name> <bool>false</bool> </property> - <widget> - <class>QGroupBox</class> + <vbox> <property stdset="1"> - <name>name</name> - <cstring>GroupBox1</cstring> + <name>margin</name> + <number>11</number> </property> <property stdset="1"> - <name>geometry</name> - <rect> - <x>11</x> - <y>11</y> - <width>136</width> - <height>120</height> - </rect> - </property> - <property stdset="1"> - <name>title</name> - <string>Options</string> + <name>spacing</name> + <number>6</number> </property> <widget> - <class>QCheckBox</class> + <class>QGroupBox</class> <property stdset="1"> <name>name</name> - <cstring>forceDepends</cstring> + <cstring>GroupBox1</cstring> </property> <property stdset="1"> - <name>geometry</name> - <rect> - <x>11</x> - <y>19</y> - <width>114</width> - <height>19</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Force Depends</string> + <name>title</name> + <string>Options</string> </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>forceDepends</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>12</x> + <y>20</y> + <width>110</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Force Depends</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>forceReinstall</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>12</x> + <y>45</y> + <width>107</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Force Reinstall</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>forceRemove</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>12</x> + <y>70</y> + <width>105</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Force Remove</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>forceOverwrite</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>12</x> + <y>95</y> + <width>114</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Force Overwrite</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>verboseWget</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>12</x> + <y>120</y> + <width>104</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Verbose WGet</string> + </property> + </widget> </widget> <widget> - <class>QCheckBox</class> + <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>forceReinstall</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>11</x> - <y>44</y> - <width>114</width> - <height>19</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Force Reinstall</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>forceOverwrite</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>11</x> - <y>94</y> - <width>114</width> - <height>19</height> - </rect> + <cstring>btnOK</cstring> </property> <property stdset="1"> <name>text</name> - <string>Force Overwrite</string> + <string>OK</string> </property> </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>forceRemove</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>11</x> - <y>69</y> - <width>114</width> - <height>19</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Force Remove</string> - </property> - </widget> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>btnOK</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>11</x> - <y>166</y> - <width>136</width> - <height>28</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>OK</string> - </property> - </widget> + </vbox> </widget> <connections> <connection> <sender>btnOK</sender> <signal>clicked()</signal> <receiver>InstallOptionsDlg</receiver> <slot>accept()</slot> </connection> </connections> </UI> diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp index dd996e0..3a37eec 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.cpp +++ b/noncore/settings/aqpkg/instoptionsimpl.cpp @@ -16,34 +16,55 @@ ***************************************************************************/ #ifdef QWS #include <qpe/config.h> #endif #include <qdialog.h> #include <qcheckbox.h> #include "instoptionsimpl.h" #include "ipkg.h" #include "global.h" InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const char* name, bool modal, WFlags fl ) : InstallOptionsDlg( parent, name, modal, fl ) { if ( flags & FORCE_DEPENDS ) forceDepends->setChecked( true ); if ( flags & FORCE_REINSTALL ) forceReinstall->setChecked( true ); if ( flags & FORCE_REMOVE ) forceRemove->setChecked( true ); if ( flags & FORCE_OVERWRITE ) forceOverwrite->setChecked( true ); + if ( flags & VERBOSE_WGET ) + verboseWget->setChecked( true ); // if ( flags & MAKE_LINKS ) // makeLinks->setChecked( true ); showMaximized(); } InstallOptionsDlgImpl::~InstallOptionsDlgImpl() { } + + +int InstallOptionsDlgImpl :: getFlags() +{ + int flags = 0; + + if ( forceDepends->isChecked() ) + flags |= FORCE_DEPENDS; + if ( forceReinstall->isChecked() ) + flags |= FORCE_REINSTALL; + if ( forceRemove->isChecked() ) + flags |= FORCE_REMOVE; + if ( forceOverwrite->isChecked() ) + flags |= FORCE_OVERWRITE; + if ( verboseWget->isChecked() ) + flags |= VERBOSE_WGET; + + return flags; +}
\ No newline at end of file diff --git a/noncore/settings/aqpkg/instoptionsimpl.h b/noncore/settings/aqpkg/instoptionsimpl.h index 08ec616..893f9bb 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.h +++ b/noncore/settings/aqpkg/instoptionsimpl.h @@ -3,31 +3,32 @@ ------------------- begin : Mon Aug 26 2002 copyright : (C) 2002 by Andy Qua email : andy.qua@blueyonder.co.uk ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef INSTALLOPTIONSIMPL_H #define INSTALLOPTIONSIMPL_H #include "instoptions.h" class InstallOptionsDlgImpl : public InstallOptionsDlg { public: InstallOptionsDlgImpl( int flags, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); ~InstallOptionsDlgImpl(); + int getFlags(); protected: private: }; #endif |