Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index b92a245..bbb0be75 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -29,13 +29,13 @@ #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 ) +InstallDlgImpl::InstallDlgImpl( vector<InstallData> &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; @@ -43,13 +43,14 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM #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 ); +// flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); + flags = 0; #else flags = 0; #endif // Output text is read only output->setReadOnly( true ); @@ -67,34 +68,34 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM if ( dit->getDestinationName() == defaultDest ) defIndex = i; } destination->setCurrentItem( defIndex ); - vector<QString>::iterator it; + 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 ) { - QString name = *it; - if ( name.startsWith( "I" ) ) + InstallData item = *it; + if ( item.option == "I" ) { - installList.push_back( name.mid(1) ); - install += " " + name.mid(1) + "\n"; + installList.push_back( item ); + install += " " + item.packageName + "\n"; } - else if ( name.startsWith( "D" ) ) + else if ( item.option == "D" ) { - removeList.push_back( name.mid(1) ); - remove += " " + name.mid(1) + "\n"; + removeList.push_back( item ); + remove += " " + item.packageName + "\n"; } - else if ( name.startsWith( "U" ) ) + else if ( item.option == "U" ) { - updateList.push_back( name.mid(1) ); - upgrade += " " + name.mid(1) + "\n"; + updateList.push_back( item ); + upgrade += " " + item.packageName + "\n"; } } output->setText( remove + install + upgrade ); connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); @@ -133,14 +134,12 @@ void InstallDlgImpl :: optionsSelected() 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 @@ -168,44 +167,66 @@ void InstallDlgImpl :: installSelected() else { output->setText( "" ); Destination *d = dataMgr->getDestination( destination->currentText() ); QString dest = d->getDestinationName(); QString destDir = d->getDestinationPath(); + int instFlags = 0; + if ( d->linkToRoot() ) + instFlags = MAKE_LINKS; #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; + vector<InstallData>::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.setDestination( it->destination->getDestinationName() ); + ipkg.setDestinationDir( it->destination->getDestinationPath() ); + ipkg.setPackage( it->packageName ); + + int tmpFlags = flags; + if ( it->destination->linkToRoot() ) + tmpFlags |= MAKE_LINKS; + else + tmpFlags ^= MAKE_LINKS; + + ipkg.setFlags( tmpFlags ); ipkg.runIpkg(); } ipkg.setOption( "install" ); + ipkg.setDestination( dest ); + ipkg.setDestinationDir( destDir ); + ipkg.setFlags( instFlags ); for ( it = installList.begin() ; it != installList.end() ; ++it ) { - ipkg.setPackage( *it ); + ipkg.setPackage( it->packageName ); ipkg.runIpkg(); } flags |= FORCE_REINSTALL; - ipkg.setFlags( flags ); + ipkg.setOption( "reinstall" ); for ( it = updateList.begin() ; it != updateList.end() ; ++it ) { - ipkg.setPackage( *it ); + ipkg.setDestination( it->destination->getDestinationName() ); + ipkg.setDestinationDir( it->destination->getDestinationPath() ); + ipkg.setPackage( it->packageName ); + + int tmpFlags = flags; + if ( it->destination->linkToRoot() && it->recreateLinks ) + tmpFlags |= MAKE_LINKS; + else + tmpFlags ^= MAKE_LINKS; + ipkg.setFlags( tmpFlags ); ipkg.runIpkg(); } } btnInstall->setEnabled( true ); btnInstall->setText( tr( "Close" ) ); |