summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp22
-rw-r--r--noncore/settings/aqpkg/ipkg.h2
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;
38#include "global.h" 38#include "global.h"
39 39
40Ipkg :: Ipkg() 40Ipkg :: Ipkg()
41{ 41{
42 proc = 0;
42} 43}
43 44
44Ipkg :: ~Ipkg() 45Ipkg :: ~Ipkg()
45{ 46{
@@ -136,8 +137,11 @@ bool Ipkg :: runIpkg( )
136 dependantPackages->setAutoDelete( true ); 137 dependantPackages->setAutoDelete( true );
137 138
138 ret = executeIpkgCommand( commands, option ); 139 ret = executeIpkgCommand( commands, option );
139 140
141 if ( aborted )
142 return false;
143
140 if ( option == "install" || option == "reinstall" ) 144 if ( option == "install" || option == "reinstall" )
141 { 145 {
142 // If we are not removing packages and make links option is selected 146 // If we are not removing packages and make links option is selected
143 // create the links 147 // create the links
@@ -255,10 +259,19 @@ void Ipkg :: removeStatusEntry()
255} 259}
256 260
257int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option ) 261int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option )
258{ 262{
263 // If one is already running - should never be but just to be safe
264 if ( proc )
265 {
266 delete proc;
267 proc = 0;
268 }
269
259 // OK we're gonna use OProcess to run this thing 270 // OK we're gonna use OProcess to run this thing
260 proc = new OProcess(); 271 proc = new OProcess();
272 aborted = false;
273
261 274
262 // Connect up our slots 275 // Connect up our slots
263 connect(proc, SIGNAL(processExited(OProcess *)), 276 connect(proc, SIGNAL(processExited(OProcess *)),
264 this, SLOT( processFinished())); 277 this, SLOT( processFinished()));
@@ -316,12 +329,21 @@ void Ipkg::commandStderr(OProcess*, char *buffer, int buflen)
316 329
317void Ipkg::processFinished() 330void Ipkg::processFinished()
318{ 331{
319 delete proc; 332 delete proc;
333 proc = 0;
320 finished = true; 334 finished = true;
321} 335}
322 336
323 337
338void Ipkg :: abort()
339{
340 if ( proc )
341 {
342 proc->kill();
343 aborted = true;
344 }
345}
324 346
325/* 347/*
326int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) 348int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
327{ 349{
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:
58public slots: 58public slots:
59 void commandStdout(OProcess*, char *buffer, int buflen); 59 void commandStdout(OProcess*, char *buffer, int buflen);
60 void commandStderr(OProcess*, char *buffer, int buflen); 60 void commandStderr(OProcess*, char *buffer, int buflen);
61 void processFinished(); 61 void processFinished();
62 void abort();
62 63
63 64
64private: 65private:
65 bool createLinks; 66 bool createLinks;
67 bool aborted;
66 QString option; 68 QString option;
67 QString package; 69 QString package;
68 QString destination; 70 QString destination;
69 QString destDir; 71 QString destDir;