-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 407abe9..7afe04f 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp @@ -38,8 +38,9 @@ using namespace std; #include "global.h" Ipkg :: Ipkg() { + proc = 0; } Ipkg :: ~Ipkg() { @@ -136,8 +137,11 @@ bool Ipkg :: runIpkg( ) dependantPackages->setAutoDelete( true ); ret = executeIpkgCommand( commands, option ); + if ( aborted ) + return false; + if ( option == "install" || option == "reinstall" ) { // If we are not removing packages and make links option is selected // create the links @@ -255,10 +259,19 @@ void Ipkg :: removeStatusEntry() } int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option ) { + // If one is already running - should never be but just to be safe + if ( proc ) + { + delete proc; + proc = 0; + } + // OK we're gonna use OProcess to run this thing proc = new OProcess(); + aborted = false; + // Connect up our slots connect(proc, SIGNAL(processExited(OProcess *)), this, SLOT( processFinished())); @@ -316,12 +329,21 @@ void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) void Ipkg::processFinished() { delete proc; + proc = 0; finished = true; } +void Ipkg :: abort() +{ + if ( proc ) + { + proc->kill(); + aborted = true; + } +} /* int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) { diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h index 25bae59..f08667b 100644 --- a/noncore/settings/aqpkg/ipkg.h +++ b/noncore/settings/aqpkg/ipkg.h @@ -58,12 +58,14 @@ signals: public slots: void commandStdout(OProcess*, char *buffer, int buflen); void commandStderr(OProcess*, char *buffer, int buflen); void processFinished(); + void abort(); private: bool createLinks; + bool aborted; QString option; QString package; QString destination; QString destDir; |