mirror of
https://invent.kde.org/network/kdeconnect-kde.git
synced 2025-12-17 12:00:30 +01:00
Simplify KDEConnectPlugin::recievePacket
- We do not need the return type. If a plugin declares it can handle the packet it should do so. We don't have any fallback logic in place and the packet types are namespaced with the plugin IDs anyway. - Provide a default implementation with a warning, not all plugins need to overwrite this
This commit is contained in:
@@ -37,11 +37,11 @@ RunCommandPlugin::RunCommandPlugin(QObject *parent, const QVariantList &args)
|
||||
connect(config(), &KdeConnectPluginConfig::configChanged, this, &RunCommandPlugin::sendConfig);
|
||||
}
|
||||
|
||||
bool RunCommandPlugin::receivePacket(const NetworkPacket &np)
|
||||
void RunCommandPlugin::receivePacket(const NetworkPacket &np)
|
||||
{
|
||||
if (np.get<bool>(QStringLiteral("requestCommandList"), false)) {
|
||||
sendConfig();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (np.has(QStringLiteral("key"))) {
|
||||
@@ -59,13 +59,10 @@ bool RunCommandPlugin::receivePacket(const NetworkPacket &np)
|
||||
#else
|
||||
QProcess::startDetached(QStringLiteral(COMMAND), QStringList{QStringLiteral(ARGS), commandJson[QStringLiteral("command")].toString()});
|
||||
#endif
|
||||
return true;
|
||||
} else if (np.has(QStringLiteral("setup"))) {
|
||||
OpenConfig oc;
|
||||
oc.openConfiguration(device()->id(), QStringLiteral("kdeconnect_runcommand"));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RunCommandPlugin::connected()
|
||||
|
||||
Reference in New Issue
Block a user