author | andyq <andyq> | 2002-12-17 22:31:10 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-17 22:31:10 (UTC) |
commit | 995f9ff51e4a687471500765ff40aea27a677197 (patch) (unidiff) | |
tree | 376f3f7351a0192d42f0c2e351f39b1e1e0a38f7 | |
parent | 01640bfdce16d2fd23722a59004a6efd4600c0cf (diff) | |
download | opie-995f9ff51e4a687471500765ff40aea27a677197.zip opie-995f9ff51e4a687471500765ff40aea27a677197.tar.gz opie-995f9ff51e4a687471500765ff40aea27a677197.tar.bz2 |
Added abort functionality
-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 | |||
@@ -40,4 +40,5 @@ using namespace std; | |||
40 | Ipkg :: Ipkg() | 40 | Ipkg :: Ipkg() |
41 | { | 41 | { |
42 | proc = 0; | ||
42 | } | 43 | } |
43 | 44 | ||
@@ -138,4 +139,7 @@ bool Ipkg :: runIpkg( ) | |||
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 | { |
@@ -257,6 +261,15 @@ void Ipkg :: removeStatusEntry() | |||
257 | int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString option ) | 261 | int 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 |
@@ -318,8 +331,17 @@ void 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 | ||
338 | void Ipkg :: abort() | ||
339 | { | ||
340 | if ( proc ) | ||
341 | { | ||
342 | proc->kill(); | ||
343 | aborted = true; | ||
344 | } | ||
345 | } | ||
324 | 346 | ||
325 | /* | 347 | /* |
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 | |||
@@ -60,8 +60,10 @@ public slots: | |||
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 | ||
64 | private: | 65 | private: |
65 | bool createLinks; | 66 | bool createLinks; |
67 | bool aborted; | ||
66 | QString option; | 68 | QString option; |
67 | QString package; | 69 | QString package; |