patch_for_bug_989.txt

Steven Mizuno, 2008-03-21 06:01 PM

Download (1.33 KB)

 
1
Index: src/core/qgsrunprocess.cpp
2
===================================================================
3
--- src/core/qgsrunprocess.cpp	(revision 8254)
4
+++ src/core/qgsrunprocess.cpp	(working copy)
5
@@ -24,6 +24,7 @@
6
 #include "qgslogger.h"
7
 #include "qgsmessageoutput.h"
8
 #include <QProcess>
9
+#include <QMessageBox>
10
 
11
 QgsRunProcess::QgsRunProcess(const QString& action, bool capture)
12
   : mProcess(NULL), mOutput(NULL)
13
@@ -45,13 +46,10 @@
14
     // the output from the process, hence this connect() call is
15
     // inside the capture if() statement.
16
     connect(mProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)));
17
-  }
18
 
19
-  // start the process!
20
-  mProcess->start(action);
21
+    // start the process!
22
+    mProcess->start(action);
23
   
24
-  if (capture)
25
-  {
26
     // Use QgsMessageOutput for displaying output to user
27
     // It will delete itself when the dialog box is closed.
28
     mOutput = QgsMessageOutput::createMessageOutput();
29
@@ -69,6 +67,12 @@
30
   }
31
   else
32
   {
33
+    if ( ! mProcess->startDetached(action) )	//let the program run by itself
34
+    {
35
+      QMessageBox::critical(0, tr("Action"), 
36
+			  tr("Unable to run command") + "\n" + action
37
+			  , QMessageBox::Ok, Qt::NoButton);
38
+    } 
39
     // We're not capturing the output from the process, so we don't
40
     // need to exist anymore.
41
     die();