Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
Show All 26 Lines | |||||
27 | #include <QtQml> | 27 | #include <QtQml> | ||
28 | 28 | | |||
29 | #include "objectfactory.h" | 29 | #include "objectfactory.h" | ||
30 | #include "responsewaiter.h" | 30 | #include "responsewaiter.h" | ||
31 | 31 | | |||
32 | #include "interfaces/devicessortproxymodel.h" | 32 | #include "interfaces/devicessortproxymodel.h" | ||
33 | #include "interfaces/devicesmodel.h" | 33 | #include "interfaces/devicesmodel.h" | ||
34 | #include "interfaces/notificationsmodel.h" | 34 | #include "interfaces/notificationsmodel.h" | ||
35 | #include <remotecommandsmodel.h> | ||||
35 | 36 | | |||
36 | QObject* createDeviceDbusInterface(const QVariant& deviceId) | 37 | QObject* createDeviceDbusInterface(const QVariant& deviceId) | ||
37 | { | 38 | { | ||
38 | return new DeviceDbusInterface(deviceId.toString()); | 39 | return new DeviceDbusInterface(deviceId.toString()); | ||
39 | } | 40 | } | ||
40 | 41 | | |||
41 | QObject* createDeviceBatteryDbusInterface(const QVariant& deviceId) | 42 | QObject* createDeviceBatteryDbusInterface(const QVariant& deviceId) | ||
42 | { | 43 | { | ||
Show All 36 Lines | 79 | { | |||
79 | return new TelephonyDbusInterface(deviceId.toString()); | 80 | return new TelephonyDbusInterface(deviceId.toString()); | ||
80 | } | 81 | } | ||
81 | 82 | | |||
82 | QObject* createDBusResponse() | 83 | QObject* createDBusResponse() | ||
83 | { | 84 | { | ||
84 | return new DBusAsyncResponse(); | 85 | return new DBusAsyncResponse(); | ||
85 | } | 86 | } | ||
86 | 87 | | |||
88 | QObject* createRemoteCommandsInterface(const QVariant& deviceId) | ||||
89 | { | ||||
90 | return new RemoteCommandsDbusInterface(deviceId.toString()); | ||||
91 | } | ||||
92 | | ||||
87 | void KdeConnectDeclarativePlugin::registerTypes(const char* uri) | 93 | void KdeConnectDeclarativePlugin::registerTypes(const char* uri) | ||
88 | { | 94 | { | ||
89 | qmlRegisterType<DevicesModel>(uri, 1, 0, "DevicesModel"); | 95 | qmlRegisterType<DevicesModel>(uri, 1, 0, "DevicesModel"); | ||
90 | qmlRegisterType<NotificationsModel>(uri, 1, 0, "NotificationsModel"); | 96 | qmlRegisterType<NotificationsModel>(uri, 1, 0, "NotificationsModel"); | ||
97 | qmlRegisterType<RemoteCommandsModel>(uri, 1, 0, "RemoteCommandsModel"); | ||||
apol: I would always write upper-case C on RemoteCommands. | |||||
91 | qmlRegisterType<DBusAsyncResponse>(uri, 1, 0, "DBusAsyncResponse"); | 98 | qmlRegisterType<DBusAsyncResponse>(uri, 1, 0, "DBusAsyncResponse"); | ||
92 | qmlRegisterType<DevicesSortProxyModel>(uri, 1, 0, "DevicesSortProxyModel"); | 99 | qmlRegisterType<DevicesSortProxyModel>(uri, 1, 0, "DevicesSortProxyModel"); | ||
93 | qmlRegisterUncreatableType<MprisDbusInterface>(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | 100 | qmlRegisterUncreatableType<MprisDbusInterface>(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | ||
94 | qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | 101 | qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | ||
95 | qmlRegisterUncreatableType<FindMyPhoneDeviceDbusInterface>(uri, 1, 0, "FindMyPhoneDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | 102 | qmlRegisterUncreatableType<FindMyPhoneDeviceDbusInterface>(uri, 1, 0, "FindMyPhoneDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | ||
96 | qmlRegisterUncreatableType<RemoteKeyboardDbusInterface>(uri, 1, 0, "RemoteKeyboardDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | 103 | qmlRegisterUncreatableType<RemoteKeyboardDbusInterface>(uri, 1, 0, "RemoteKeyboardDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | ||
97 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | 104 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | ||
105 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "RemoteCommandsDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); | ||||
98 | qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface", | 106 | qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface", | ||
99 | [](QQmlEngine*, QJSEngine*) -> QObject* { | 107 | [](QQmlEngine*, QJSEngine*) -> QObject* { | ||
100 | return new DaemonDbusInterface; | 108 | return new DaemonDbusInterface; | ||
101 | } | 109 | } | ||
102 | ); | 110 | ); | ||
103 | } | 111 | } | ||
104 | 112 | | |||
105 | void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri) | 113 | void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri) | ||
Show All 27 Lines | 114 | { | |||
133 | engine->rootContext()->setContextProperty(QStringLiteral("TelephonyDbusInterfaceFactory") | 141 | engine->rootContext()->setContextProperty(QStringLiteral("TelephonyDbusInterfaceFactory") | ||
134 | , new ObjectFactory(engine, createTelephonyInterface)); | 142 | , new ObjectFactory(engine, createTelephonyInterface)); | ||
135 | 143 | | |||
136 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseFactory") | 144 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseFactory") | ||
137 | , new ObjectFactory(engine, createDBusResponse)); | 145 | , new ObjectFactory(engine, createDBusResponse)); | ||
138 | 146 | | |||
139 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseWaiter") | 147 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseWaiter") | ||
140 | , DBusResponseWaiter::instance()); | 148 | , DBusResponseWaiter::instance()); | ||
149 | | ||||
150 | engine->rootContext()->setContextProperty(QStringLiteral("RemoteCommandsDbusInterfaceFactory") | ||||
151 | , new ObjectFactory(engine, createRemoteCommandsInterface)); | ||||
141 | } | 152 | } |
I would always write upper-case C on RemoteCommands.