Changeset View
Changeset View
Standalone View
Standalone View
plugins/remotecommands/remotecommandsplugin.cpp
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 52 | if (np.has(QStringLiteral("commandList"))) { | |||
---|---|---|---|---|---|
53 | setCommands(np.get<QByteArray>(QStringLiteral("commandList"))); | 53 | setCommands(np.get<QByteArray>(QStringLiteral("commandList"))); | ||
54 | return true; | 54 | return true; | ||
55 | } | 55 | } | ||
56 | 56 | | |||
57 | return false; | 57 | return false; | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | void RemoteCommandsPlugin::connected() | 60 | void RemoteCommandsPlugin::connected() | ||
61 | { | 61 | { | ||
62 | QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents); | | |||
63 | | ||||
64 | NetworkPackage np(PACKAGE_TYPE_RUNCOMMAND_REQUEST, {{"requestCommandList", true}}); | 62 | NetworkPackage np(PACKAGE_TYPE_RUNCOMMAND_REQUEST, {{"requestCommandList", true}}); | ||
albertvaka: What do you think about exposing always both things (properties and scriptableinvokables), even… | |||||
65 | sendPackage(np); | 63 | sendPackage(np); | ||
66 | } | 64 | } | ||
67 | 65 | | |||
68 | QString RemoteCommandsPlugin::dbusPath() const | 66 | QString RemoteCommandsPlugin::dbusPath() const | ||
69 | { | 67 | { | ||
70 | return "/modules/kdeconnect/devices/" + device()->id() + "/remotecommands"; | 68 | return "/modules/kdeconnect/devices/" + device()->id() + "/remotecommands"; | ||
71 | } | 69 | } | ||
72 | 70 | | |||
Show All 15 Lines |
What do you think about exposing always both things (properties and scriptableinvokables), even on plugins where there are no properties or no dbus slots? This way if we add any it will already work. Also, this is a line I tend to copy-paste when writing a new plugin, so it's better if it "just works" wherever I copy it from.