Changeset View
Changeset View
Standalone View
Standalone View
plugins/remotecommands/remotecommandsplugin.h
- This file was copied to plugins/remotecommands/remotecommand.h, plugins/remotecommands/remotecommandsdbusinterface.h.
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef REMOTECOMMANDSPLUGIN_H | 21 | #ifndef REMOTECOMMANDSPLUGIN_H | ||
22 | #define REMOTECOMMANDSPLUGIN_H | 22 | #define REMOTECOMMANDSPLUGIN_H | ||
23 | 23 | | |||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | 25 | | |||
26 | #include <core/kdeconnectplugin.h> | 26 | #include <core/kdeconnectplugin.h> | ||
27 | #include <QFile> | 27 | | ||
28 | #include <QFileSystemWatcher> | 28 | #include <QLoggingCategory> | ||
29 | #include <QMap> | 29 | | ||
30 | #include <QPair> | 30 | class RemoteCommandsDbusInterface; | ||
31 | #include <QString> | 31 | | ||
32 | Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTECOMMANDS) | ||||
32 | 33 | | |||
33 | class Q_DECL_EXPORT RemoteCommandsPlugin | 34 | class Q_DECL_EXPORT RemoteCommandsPlugin | ||
34 | : public KdeConnectPlugin | 35 | : public KdeConnectPlugin | ||
35 | { | 36 | { | ||
36 | Q_OBJECT | 37 | Q_OBJECT | ||
37 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecommands") | | |||
38 | Q_PROPERTY(QByteArray commands READ commands NOTIFY commandsChanged) | | |||
39 | 38 | | |||
40 | public: | 39 | public: | ||
41 | explicit RemoteCommandsPlugin(QObject* parent, const QVariantList& args); | 40 | explicit RemoteCommandsPlugin(QObject* parent, const QVariantList& args); | ||
42 | ~RemoteCommandsPlugin() override; | 41 | ~RemoteCommandsPlugin() override; | ||
43 | 42 | | |||
44 | Q_SCRIPTABLE void triggerCommand(const QString& key); | | |||
45 | QByteArray commands() const { return m_commands; } | | |||
46 | | ||||
47 | bool receivePacket(const NetworkPacket& np) override; | 43 | bool receivePacket(const NetworkPacket& np) override; | ||
48 | void connected() override; | 44 | void connected() override; | ||
49 | QString dbusPath() const override; | 45 | QString dbusPath() const override; | ||
50 | 46 | | |||
51 | Q_SIGNALS: | | |||
52 | void commandsChanged(const QByteArray& commands); | | |||
53 | | ||||
54 | private: | 47 | private: | ||
55 | void setCommands(const QByteArray& commands); | 48 | RemoteCommandsDbusInterface* m_iface; | ||
56 | | ||||
57 | QByteArray m_commands; | | |||
58 | }; | 49 | }; | ||
59 | 50 | | |||
60 | #endif | 51 | #endif |