24
24
#include " qgslogger.h"
25
25
#include " qgsmessageoutput.h"
26
26
#include < QProcess>
27
+ #include < QMessageBox>
27
28
28
29
QgsRunProcess::QgsRunProcess (const QString& action, bool capture)
29
30
: mProcess(NULL ), mOutput(NULL )
@@ -45,13 +46,10 @@ QgsRunProcess::QgsRunProcess(const QString& action, bool capture)
45
46
// the output from the process, hence this connect() call is
46
47
// inside the capture if() statement.
47
48
connect (mProcess , SIGNAL (finished (int ,QProcess::ExitStatus)), this , SLOT (processExit (int ,QProcess::ExitStatus)));
48
- }
49
49
50
- // start the process!
51
- mProcess ->start (action);
50
+ // start the process!
51
+ mProcess ->start (action);
52
52
53
- if (capture)
54
- {
55
53
// Use QgsMessageOutput for displaying output to user
56
54
// It will delete itself when the dialog box is closed.
57
55
mOutput = QgsMessageOutput::createMessageOutput ();
@@ -69,6 +67,12 @@ QgsRunProcess::QgsRunProcess(const QString& action, bool capture)
69
67
}
70
68
else
71
69
{
70
+ if ( ! mProcess ->startDetached (action) ) // let the program run by itself
71
+ {
72
+ QMessageBox::critical (0 , tr (" Action" ),
73
+ tr (" Unable to run command" ) + " \n " + action
74
+ , QMessageBox::Ok, Qt::NoButton);
75
+ }
72
76
// We're not capturing the output from the process, so we don't
73
77
// need to exist anymore.
74
78
die ();
0 commit comments