Changeset View
Changeset View
Standalone View
Standalone View
plugins/runcommand/runcommandplugin.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 59 | if (np.has(QStringLiteral("key"))) { | |||
---|---|---|---|---|---|
63 | QJsonValue value = commands[key]; | 63 | QJsonValue value = commands[key]; | ||
64 | if (value == QJsonValue::Undefined) { | 64 | if (value == QJsonValue::Undefined) { | ||
65 | qCWarning(KDECONNECT_PLUGIN_RUNCOMMAND) << key << "is not a configured command"; | 65 | qCWarning(KDECONNECT_PLUGIN_RUNCOMMAND) << key << "is not a configured command"; | ||
66 | } | 66 | } | ||
67 | const QJsonObject commandJson = value.toObject(); | 67 | const QJsonObject commandJson = value.toObject(); | ||
68 | qCInfo(KDECONNECT_PLUGIN_RUNCOMMAND) << "Running:" << "/bin/sh" << "-c" << commandJson[QStringLiteral("command")].toString(); | 68 | qCInfo(KDECONNECT_PLUGIN_RUNCOMMAND) << "Running:" << "/bin/sh" << "-c" << commandJson[QStringLiteral("command")].toString(); | ||
69 | QProcess::startDetached(QStringLiteral("/bin/sh"), QStringList()<< QStringLiteral("-c") << commandJson[QStringLiteral("command")].toString()); | 69 | QProcess::startDetached(QStringLiteral("/bin/sh"), QStringList()<< QStringLiteral("-c") << commandJson[QStringLiteral("command")].toString()); | ||
70 | return true; | 70 | return true; | ||
71 | } else if (np.has("setup")) { | ||||
72 | QProcess::startDetached(QStringLiteral("kcmshell5"), {QStringLiteral("--args"), QString(device()->id() + QStringLiteral(":kdeconnect_runcommand")) }); | ||||
nicolasfella: Why not separate by space instead of ':'? Would simplify the logic above | |||||
apol: How would it be simpler? Look closer :p | |||||
Sorry, what I actually meant was passing them in two args instead of one. In bash that would be separating them by space, hence my confusing statement nicolasfella: Sorry, what I actually meant was passing them in two args instead of one. In bash that would be… | |||||
Ah, we are only getting one string from the --args kcmshell argument, there's not a whole lot we can do there. apol: Ah, we are only getting one string from the --args kcmshell argument, there's not a whole lot… | |||||
71 | } | 73 | } | ||
72 | 74 | | |||
73 | return false; | 75 | return false; | ||
74 | } | 76 | } | ||
75 | 77 | | |||
76 | void RunCommandPlugin::connected() | 78 | void RunCommandPlugin::connected() | ||
77 | { | 79 | { | ||
78 | 80 | | |||
Show All 15 Lines |
Why not separate by space instead of ':'? Would simplify the logic above