author | andyq <andyq> | 2002-10-16 18:58:39 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-16 18:58:39 (UTC) |
commit | 0feff4043ce813c63e501d6bbd3114e7fcfd8ce6 (patch) (side-by-side diff) | |
tree | e6b8c256adf0f615280417a042a7b0edcb989dc7 | |
parent | 7569cbeec99b6bfcf960cfa1941e7d43bfb93a4d (diff) | |
download | opie-0feff4043ce813c63e501d6bbd3114e7fcfd8ce6.zip opie-0feff4043ce813c63e501d6bbd3114e7fcfd8ce6.tar.gz opie-0feff4043ce813c63e501d6bbd3114e7fcfd8ce6.tar.bz2 |
Changed dialog to work with upgrading all packages
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index d4f751c..b92a245 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -14,48 +14,49 @@ * (at your option) any later version. * * * ***************************************************************************/ #ifdef QWS #include <qpe/config.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<QString> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) : InstallDlg( parent, name, modal, fl ) { + upgradePackages = false; dataMgr = dataManager; vector<Destination>::iterator dit; QString defaultDest = "root"; #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); defaultDest = cfg.readEntry( "dest", "root" ); // Grab flags - Turn MAKE_LINKS on by default (if no flags found) flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); #else flags = 0; #endif // Output text is read only output->setReadOnly( true ); QFont f( "helvetica" ); f.setPointSize( 10 ); output->setFont( f ); // setup destination data int defIndex = 0; @@ -78,120 +79,141 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM { QString name = *it; if ( name.startsWith( "I" ) ) { installList.push_back( name.mid(1) ); install += " " + name.mid(1) + "\n"; } else if ( name.startsWith( "D" ) ) { removeList.push_back( name.mid(1) ); remove += " " + name.mid(1) + "\n"; } else if ( name.startsWith( "U" ) ) { updateList.push_back( name.mid(1) ); upgrade += " " + name.mid(1) + "\n"; } } output->setText( remove + install + upgrade ); connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); } +InstallDlgImpl::InstallDlgImpl( QWidget *parent, const char *name, bool modal, WFlags fl ) + : InstallDlg( parent, name, modal, fl ) +{ + upgradePackages = true; + output->setText( "Upgrading installed packages" ); + connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); +} + + InstallDlgImpl::~InstallDlgImpl() { } bool InstallDlgImpl :: showDlg() { showMaximized(); bool ret = exec(); 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; if ( opt.makeLinks->isChecked() ) flags |= MAKE_LINKS; #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "installFlags", flags ); #endif } void InstallDlgImpl :: installSelected() { if ( btnInstall->text() == "Close" ) { done( 1 ); return; } btnInstall->setEnabled( false ); + if ( upgradePackages ) + { + output->setText( "" ); + + Ipkg ipkg; + connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + ipkg.setOption( "upgrade" ); + ipkg.runIpkg(); + } + else + { output->setText( "" ); Destination *d = dataMgr->getDestination( destination->currentText() ); QString dest = d->getDestinationName(); QString destDir = d->getDestinationPath(); #ifdef QWS // Save settings Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "dest", dest ); #endif // First run through the remove list, then the install list then the upgrade list vector<QString>::iterator it; ipkg.setOption( "remove" ); ipkg.setDestination( dest ); ipkg.setDestinationDir( destDir ); ipkg.setFlags( flags ); for ( it = removeList.begin() ; it != removeList.end() ; ++it ) { ipkg.setPackage( *it ); ipkg.runIpkg(); } ipkg.setOption( "install" ); for ( it = installList.begin() ; it != installList.end() ; ++it ) { ipkg.setPackage( *it ); ipkg.runIpkg(); } flags |= FORCE_REINSTALL; ipkg.setFlags( flags ); for ( it = updateList.begin() ; it != updateList.end() ; ++it ) { ipkg.setPackage( *it ); ipkg.runIpkg(); } + } 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 ); } |