-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 130 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 17 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.h | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 2 |
6 files changed, 116 insertions, 53 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 76d0a80..896e370 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -50,5 +50,5 @@ enum { }; -InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title ) +InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) : QWidget( 0, 0, 0 ) { @@ -102,34 +102,33 @@ InstallDlgImpl::InstallDlgImpl( QList<InstallData> &packageList, DataManager *da InstallData *item = it.current(); InstallData *newitem = new InstallData(); - - newitem->option = item->option; - newitem->packageName = item->packageName; - newitem->destination = item->destination; - newitem->recreateLinks = item->recreateLinks; - - if ( item->option == "I" ) + + newitem->option = item->option; + newitem->packageName = item->packageName; + newitem->destination = item->destination; + newitem->recreateLinks = item->recreateLinks; + packages.append( newitem ); + + if ( item->option == "I" ) { - installList.append( newitem ); install.append( QString( " %1\n" ).arg( item->packageName ) ); } else if ( item->option == "D" ) { - removeList.append( newitem ); remove.append( QString( " %1\n" ).arg( item->packageName ) ); } else if ( item->option == "U" || item->option == "R" ) { - updateList.append( newitem ); - QString type; - if ( item->option == "R" ) - type = tr( "(ReInstall)" ); - else - type = tr( "(Upgrade)" ); - upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); - } - } - output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); + QString type; + if ( item->option == "R" ) + type = tr( "(ReInstall)" ); + else + type = tr( "(Upgrade)" ); + upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); + } + } - displayAvailableSpace( destination->currentText() ); + output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); + + displayAvailableSpace( destination->currentText() ); } @@ -269,4 +268,5 @@ void InstallDlgImpl :: installSelected() output->setText( "" ); connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); pIpkg->runIpkg(); } @@ -290,7 +290,12 @@ void InstallDlgImpl :: installSelected() pIpkg = new Ipkg; connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); + + firstPackage = TRUE; + ipkgFinished(); // First run through the remove list, then the install list then the upgrade list - pIpkg->setOption( "remove" ); +/* + pIpkg->setOption( "remove" ); QListIterator<InstallData> it( removeList ); InstallData *idata; @@ -343,16 +348,6 @@ void InstallDlgImpl :: installSelected() delete pIpkg; pIpkg = 0; +*/ } - - btnOptions->setEnabled( true ); -// btnInstall->setEnabled( true ); - btnInstall->setText( tr( "Close" ) ); - btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); - - btnOptions->setText( tr( "Save output" ) ); - btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); - - if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) - displayAvailableSpace( destination->currentText() ); } @@ -401,2 +396,71 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) } +void InstallDlgImpl :: ipkgFinished() +{ + InstallData *item; + if ( firstPackage ) + item = packages.first(); + else + { + // Create symlinks if necessary before moving on to next package + pIpkg->createSymLinks(); + + item = packages.next(); + } + + firstPackage = FALSE; + if ( item ) + { + pIpkg->setPackage( item->packageName ); + int tmpFlags = flags; + + if ( item->option == "I" ) + { + pIpkg->setOption( "install" ); + Destination *d = dataMgr->getDestination( destination->currentText() ); + pIpkg->setDestination( d->getDestinationName() ); + pIpkg->setDestinationDir( d->getDestinationPath() ); + + if ( d->linkToRoot() ) + tmpFlags |= MAKE_LINKS; + } + else if ( item->option == "D" ) + { + pIpkg->setOption( "remove" ); + pIpkg->setDestination( item->destination->getDestinationName() ); + pIpkg->setDestinationDir( item->destination->getDestinationPath() ); + + if ( item->destination->linkToRoot() ) + tmpFlags |= MAKE_LINKS; + } + else + { + if ( item->option == "R" ) + pIpkg->setOption( "reinstall" ); + else + pIpkg->setOption( "upgrade" ); + + pIpkg->setDestination( item->destination->getDestinationName() ); + pIpkg->setDestinationDir( item->destination->getDestinationPath() ); + pIpkg->setPackage( item->packageName ); + + tmpFlags |= FORCE_REINSTALL; + if ( item->destination->linkToRoot() && item->recreateLinks ) + tmpFlags |= MAKE_LINKS; + } + pIpkg->setFlags( tmpFlags, infoLevel ); + pIpkg->runIpkg(); + } + else + { + btnOptions->setEnabled( true ); + btnInstall->setText( tr( "Close" ) ); + btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); + + btnOptions->setText( tr( "Save output" ) ); + btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); + + if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) + displayAvailableSpace( destination->currentText() ); + } +}
\ No newline at end of file diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 15cf427..9a7dbff 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h @@ -46,5 +46,5 @@ class InstallDlgImpl : public QWidget Q_OBJECT public: - InstallDlgImpl( QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); + InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); ~InstallDlgImpl(); @@ -56,7 +56,6 @@ protected: private: DataManager *dataMgr; - QList<InstallData> installList; - QList<InstallData> removeList; - QList<InstallData> updateList; + QList<InstallData> packages; + bool firstPackage; int flags; int infoLevel; @@ -82,4 +81,5 @@ public slots: void displayText(const QString &text ); void displayAvailableSpace( const QString &text); + void ipkgFinished(); }; diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index e906653..34999ad 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp @@ -56,8 +56,7 @@ Ipkg :: ~Ipkg() // flags is the ipkg options flags // dir is the directory to run ipkg in (defaults to "") -bool Ipkg :: runIpkg( ) +void Ipkg :: runIpkg() { error = false; - bool ret = false; QStringList commands; @@ -138,9 +137,10 @@ bool Ipkg :: runIpkg( ) dependantPackages->setAutoDelete( true ); - ret = executeIpkgCommand( commands, option ); + executeIpkgCommand( commands, option ); - if ( aborted ) - return false; +} +void Ipkg :: createSymLinks() +{ if ( option == "install" || option == "reinstall" || option == "upgrade" ) { @@ -172,5 +172,4 @@ bool Ipkg :: runIpkg( ) emit outputText( "Finished" ); emit outputText( "" ); - return ret; } @@ -296,8 +295,4 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) emit outputText( QString( "Couldn't start ipkg process" ) ); } - - // Now wait for it to finish - while ( !finished ) - qApp->processEvents(); } @@ -355,4 +350,6 @@ void Ipkg::processFinished() proc = 0; finished = true; + + emit ipkgFinished(); } diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h index 531bfc0..a0d38e3 100644 --- a/noncore/settings/aqpkg/ipkg.h +++ b/noncore/settings/aqpkg/ipkg.h @@ -44,5 +44,6 @@ public: Ipkg(); ~Ipkg(); - bool runIpkg( ); + void runIpkg(); + void createSymLinks(); void setOption( const char *opt ) { option = opt; } @@ -55,4 +56,5 @@ public: signals: void outputText( const QString &text ); + void ipkgFinished(); public slots: diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 1aec6a8..58f6feb 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -298,5 +298,5 @@ void MainWindow :: init() stack->raiseWidget( networkPkgWindow ); } -/* + void MainWindow :: setDocument( const QString &doc ) { @@ -328,5 +328,5 @@ void MainWindow :: setDocument( const QString &doc ) } } -*/ + void MainWindow :: displaySettings() { @@ -993,5 +993,5 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) if ( !p->isInstalled() ) { - InstallData *newitem = new InstallData();; + InstallData *newitem = new InstallData(); newitem->option = "I"; newitem->packageName = name; @@ -1000,5 +1000,5 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) else { - InstallData *newitem = new InstallData();; + InstallData *newitem = new InstallData(); newitem->option = "D"; if ( !p->isPackageStoredLocally() ) diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 0295519..c4548b1 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h @@ -107,5 +107,5 @@ private: public slots: -// void setDocument( const QString &doc ); + void setDocument( const QString &doc ); void displayFindBar(); void displayJumpBar(); |