From 0feff4043ce813c63e501d6bbd3114e7fcfd8ce6 Mon Sep 17 00:00:00 2001 From: andyq Date: Wed, 16 Oct 2002 18:58:39 +0000 Subject: Changed dialog to work with upgrading all packages --- (limited to 'noncore/settings') 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 @@ -35,6 +35,7 @@ InstallDlgImpl::InstallDlgImpl( vector &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) : InstallDlg( parent, name, modal, fl ) { + upgradePackages = false; dataMgr = dataManager; vector::iterator dit; @@ -99,6 +100,15 @@ InstallDlgImpl::InstallDlgImpl( vector &packageList, DataManager *dataM 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() { } @@ -146,43 +156,55 @@ void InstallDlgImpl :: installSelected() btnInstall->setEnabled( false ); - 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::iterator it; - ipkg.setOption( "remove" ); - ipkg.setDestination( dest ); - ipkg.setDestinationDir( destDir ); - ipkg.setFlags( flags ); - for ( it = removeList.begin() ; it != removeList.end() ; ++it ) + if ( upgradePackages ) { - ipkg.setPackage( *it ); + output->setText( "" ); + + Ipkg ipkg; + connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + ipkg.setOption( "upgrade" ); ipkg.runIpkg(); } - - ipkg.setOption( "install" ); - for ( it = installList.begin() ; it != installList.end() ; ++it ) + else { - ipkg.setPackage( *it ); - ipkg.runIpkg(); - } + output->setText( "" ); + Destination *d = dataMgr->getDestination( destination->currentText() ); + QString dest = d->getDestinationName(); + QString destDir = d->getDestinationPath(); - flags |= FORCE_REINSTALL; - ipkg.setFlags( flags ); - for ( it = updateList.begin() ; it != updateList.end() ; ++it ) - { - ipkg.setPackage( *it ); - ipkg.runIpkg(); +#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::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 ); -- cgit v0.9.0.2