Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index e122064..a924daf 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -88,34 +88,31 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d { removeList.push_back( item ); remove += " " + item.packageName + "\n"; } else if ( item.option == "U" ) { updateList.push_back( item ); upgrade += " " + item.packageName + "\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 ) +InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, 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 &))); + pIpkg = ipkg; + output->setText( initialText ); } InstallDlgImpl::~InstallDlgImpl() { } bool InstallDlgImpl :: showDlg() { showMaximized(); bool ret = exec(); @@ -146,91 +143,94 @@ void InstallDlgImpl :: optionsSelected() } void InstallDlgImpl :: installSelected() { if ( btnInstall->text() == "Close" ) { done( 1 ); return; } btnInstall->setEnabled( false ); - if ( upgradePackages ) + if ( pIpkg ) { output->setText( "" ); - Ipkg ipkg; - connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); - ipkg.setOption( "upgrade" ); - ipkg.runIpkg(); + connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + pIpkg->runIpkg(); } else { output->setText( "" ); Destination *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; - ipkg.setOption( "remove" ); + pIpkg->setOption( "remove" ); for ( it = removeList.begin() ; it != removeList.end() ; ++it ) { - ipkg.setDestination( it->destination->getDestinationName() ); - ipkg.setDestinationDir( it->destination->getDestinationPath() ); - ipkg.setPackage( it->packageName ); + pIpkg->setDestination( it->destination->getDestinationName() ); + pIpkg->setDestinationDir( it->destination->getDestinationPath() ); + pIpkg->setPackage( it->packageName ); int tmpFlags = flags; if ( it->destination->linkToRoot() ) tmpFlags |= MAKE_LINKS; - ipkg.setFlags( tmpFlags ); - ipkg.runIpkg(); + pIpkg->setFlags( tmpFlags ); + pIpkg->runIpkg(); } - ipkg.setOption( "install" ); - ipkg.setDestination( dest ); - ipkg.setDestinationDir( destDir ); - ipkg.setFlags( instFlags ); + pIpkg->setOption( "install" ); + pIpkg->setDestination( dest ); + pIpkg->setDestinationDir( destDir ); + pIpkg->setFlags( instFlags ); for ( it = installList.begin() ; it != installList.end() ; ++it ) { - ipkg.setPackage( it->packageName ); - ipkg.runIpkg(); + pIpkg->setPackage( it->packageName ); + pIpkg->runIpkg(); } flags |= FORCE_REINSTALL; - ipkg.setOption( "reinstall" ); + pIpkg->setOption( "reinstall" ); for ( it = updateList.begin() ; it != updateList.end() ; ++it ) { - ipkg.setDestination( it->destination->getDestinationName() ); - ipkg.setDestinationDir( it->destination->getDestinationPath() ); - ipkg.setPackage( it->packageName ); + 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; - ipkg.setFlags( tmpFlags ); - ipkg.runIpkg(); + pIpkg->setFlags( tmpFlags ); + pIpkg->runIpkg(); } + + delete pIpkg; } 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 ); } |