Changeset View
Changeset View
Standalone View
Standalone View
plugins/remotecommands/remotecommandsplugin.h
Show All 30 Lines | |||||
31 | #include <QString> | 31 | #include <QString> | ||
32 | 32 | | |||
33 | class Q_DECL_EXPORT RemoteCommandsPlugin | 33 | class Q_DECL_EXPORT RemoteCommandsPlugin | ||
34 | : public KdeConnectPlugin | 34 | : public KdeConnectPlugin | ||
35 | { | 35 | { | ||
36 | Q_OBJECT | 36 | Q_OBJECT | ||
37 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecommands") | 37 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecommands") | ||
38 | Q_PROPERTY(QByteArray commands READ commands NOTIFY commandsChanged) | 38 | Q_PROPERTY(QByteArray commands READ commands NOTIFY commandsChanged) | ||
39 | Q_PROPERTY(QString deviceId READ deviceId CONSTANT) | ||||
40 | Q_PROPERTY(bool canAddCommand READ canAddCommand CONSTANT) | ||||
39 | 41 | | |||
40 | public: | 42 | public: | ||
41 | explicit RemoteCommandsPlugin(QObject* parent, const QVariantList& args); | 43 | explicit RemoteCommandsPlugin(QObject* parent, const QVariantList& args); | ||
42 | ~RemoteCommandsPlugin() override; | 44 | ~RemoteCommandsPlugin() override; | ||
43 | 45 | | |||
44 | Q_SCRIPTABLE void triggerCommand(const QString& key); | 46 | Q_SCRIPTABLE void triggerCommand(const QString& key); | ||
47 | Q_SCRIPTABLE void editCommands(); | ||||
48 | | ||||
45 | QByteArray commands() const { return m_commands; } | 49 | QByteArray commands() const { return m_commands; } | ||
50 | QString deviceId() const { return device()->id(); } | ||||
51 | bool canAddCommand() const { return m_canAddCommand; } | ||||
46 | 52 | | |||
47 | bool receivePacket(const NetworkPacket& np) override; | 53 | bool receivePacket(const NetworkPacket& np) override; | ||
48 | void connected() override; | 54 | void connected() override; | ||
49 | QString dbusPath() const override; | 55 | QString dbusPath() const override; | ||
50 | 56 | | |||
51 | Q_SIGNALS: | 57 | Q_SIGNALS: | ||
52 | void commandsChanged(const QByteArray& commands); | 58 | void commandsChanged(const QByteArray& commands); | ||
53 | 59 | | |||
54 | private: | 60 | private: | ||
55 | void setCommands(const QByteArray& commands); | 61 | void setCommands(const QByteArray& commands); | ||
56 | 62 | | |||
57 | QByteArray m_commands; | 63 | QByteArray m_commands; | ||
64 | bool m_canAddCommand; | ||||
58 | }; | 65 | }; | ||
59 | 66 | | |||
60 | #endif | 67 | #endif |