diff --git a/core/EventHandler.cpp b/core/EventHandler.cpp
index 9c2334c..0aabd9f 100644
--- a/core/EventHandler.cpp
+++ b/core/EventHandler.cpp
@@ -49,10 +49,19 @@ QvPlugin_EventHandler(SimpleEventHandler, Connectivity)
{
_command.replace("$$INBOUND_" + protocol, QString::number(pluginEvent.inboundPorts[protocol]));
}
- auto returnvalue = QProcess::execute(_command);
- if (returnvalue != 0)
+ bool detached = _command.contains("$$CALL");
+ _command.replace("$$CALL", "");
+ if (detached)
{
- CommandPlugin::instance->PluginLog("Failed to execute command : \"" + action + "\"");
+ auto returnvalue = QProcess::execute(_command);
+ if (returnvalue != 0)
+ {
+ CommandPlugin::instance->PluginLog("Failed to execute command : \"" + action + "\"");
+ }
+ }
+ else
+ {
+ QProcess::startDetached(_command);
}
}
}
@@ -83,10 +92,19 @@ QvPlugin_EventHandler(SimpleEventHandler, SystemProxy)
auto _command = action;
_command.replace("$$HTTP", QString::number(pluginEvent.systemProxyPortSettings[Events::SystemProxy::SystemProxy_HTTP]));
_command.replace("$$SOCKS", QString::number(pluginEvent.systemProxyPortSettings[Events::SystemProxy::SystemProxy_SOCKS]));
- auto returnvalue = QProcess::execute(_command);
- if (returnvalue != 0)
+ bool detached = _command.contains("$$CALL");
+ _command.replace("$$CALL", "");
+ if (detached)
+ {
+ auto returnvalue = QProcess::execute(_command);
+ if (returnvalue != 0)
+ {
+ CommandPlugin::instance->PluginLog("Failed to execute command : \"" + action + "\"");
+ }
+ }
+ else
{
- CommandPlugin::instance->PluginLog("Failed to execute command : \"" + action + "\"");
+ QProcess::startDetached(_command);
}
}
}
@@ -127,10 +145,19 @@ QvPlugin_EventHandler(SimpleEventHandler, ConnectionEntry)
auto _command = action;
_command.replace("$$DISPLAYNAME", pluginEvent.displayName);
_command.replace("$$ORIGINAL_NAME", pluginEvent.originalDisplayName);
- auto returnvalue = QProcess::execute(_command);
- if (returnvalue != 0)
+ bool detached = _command.contains("$$CALL");
+ _command.replace("$$CALL", "");
+ if (detached)
+ {
+ auto returnvalue = QProcess::execute(_command);
+ if (returnvalue != 0)
+ {
+ CommandPlugin::instance->PluginLog("Failed to execute command : \"" + action + "\"");
+ }
+ }
+ else
{
- CommandPlugin::instance->PluginLog("Failed to execute command : \"" + action + "\"");
+ QProcess::startDetached(_command);
}
}
}
diff --git a/ui/CommandPluginSettings.ui b/ui/CommandPluginSettings.ui
index d068df4..924c349 100644
--- a/ui/CommandPluginSettings.ui
+++ b/ui/CommandPluginSettings.ui
@@ -14,7 +14,7 @@
Form
- -
+
-
0
@@ -201,6 +201,13 @@ $$SOCKS: SOCKS port (could be 0)
+ -
+
+
+ Commands start with "$$CALL" will make program start detached.
+
+
+