Changeset View
Changeset View
Standalone View
Standalone View
declarativeplugin/kdeconnectdeclarativeplugin.cpp
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 84 | { | |||
---|---|---|---|---|---|
85 | return new DBusAsyncResponse(); | 85 | return new DBusAsyncResponse(); | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | QObject* createRemoteCommandsInterface(const QVariant& deviceId) | 88 | QObject* createRemoteCommandsInterface(const QVariant& deviceId) | ||
89 | { | 89 | { | ||
90 | return new RemoteCommandsDbusInterface(deviceId.toString()); | 90 | return new RemoteCommandsDbusInterface(deviceId.toString()); | ||
91 | } | 91 | } | ||
92 | 92 | | |||
93 | QObject* createShareInterface(const QVariant& deviceId) | ||||
94 | { | ||||
95 | return new ShareDbusInterface(deviceId.toString()); | ||||
96 | } | ||||
97 | | ||||
93 | void KdeConnectDeclarativePlugin::registerTypes(const char* uri) | 98 | void KdeConnectDeclarativePlugin::registerTypes(const char* uri) | ||
94 | { | 99 | { | ||
95 | qmlRegisterType<DevicesModel>(uri, 1, 0, "DevicesModel"); | 100 | qmlRegisterType<DevicesModel>(uri, 1, 0, "DevicesModel"); | ||
96 | qmlRegisterType<NotificationsModel>(uri, 1, 0, "NotificationsModel"); | 101 | qmlRegisterType<NotificationsModel>(uri, 1, 0, "NotificationsModel"); | ||
97 | qmlRegisterType<RemoteCommandsModel>(uri, 1, 0, "RemoteCommandsModel"); | 102 | qmlRegisterType<RemoteCommandsModel>(uri, 1, 0, "RemoteCommandsModel"); | ||
98 | qmlRegisterType<DBusAsyncResponse>(uri, 1, 0, "DBusAsyncResponse"); | 103 | qmlRegisterType<DBusAsyncResponse>(uri, 1, 0, "DBusAsyncResponse"); | ||
99 | qmlRegisterType<DevicesSortProxyModel>(uri, 1, 0, "DevicesSortProxyModel"); | 104 | qmlRegisterType<DevicesSortProxyModel>(uri, 1, 0, "DevicesSortProxyModel"); | ||
100 | qmlRegisterUncreatableType<MprisDbusInterface>(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | 105 | qmlRegisterUncreatableType<MprisDbusInterface>(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||
101 | qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | 106 | qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||
102 | qmlRegisterUncreatableType<FindMyPhoneDeviceDbusInterface>(uri, 1, 0, "FindMyPhoneDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | 107 | qmlRegisterUncreatableType<FindMyPhoneDeviceDbusInterface>(uri, 1, 0, "FindMyPhoneDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||
103 | qmlRegisterUncreatableType<RemoteKeyboardDbusInterface>(uri, 1, 0, "RemoteKeyboardDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | 108 | qmlRegisterUncreatableType<RemoteKeyboardDbusInterface>(uri, 1, 0, "RemoteKeyboardDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||
104 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | 109 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||
105 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "RemoteCommandsDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | 110 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "RemoteCommandsDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||
111 | qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "ShareDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); | ||||
106 | qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface", | 112 | qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface", | ||
107 | [](QQmlEngine*, QJSEngine*) -> QObject* { | 113 | [](QQmlEngine*, QJSEngine*) -> QObject* { | ||
108 | return new DaemonDbusInterface; | 114 | return new DaemonDbusInterface; | ||
109 | } | 115 | } | ||
110 | ); | 116 | ); | ||
111 | } | 117 | } | ||
112 | 118 | | |||
113 | void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri) | 119 | void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri) | ||
Show All 30 Lines | 120 | { | |||
144 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseFactory") | 150 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseFactory") | ||
145 | , new ObjectFactory(engine, createDBusResponse)); | 151 | , new ObjectFactory(engine, createDBusResponse)); | ||
146 | 152 | | |||
147 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseWaiter") | 153 | engine->rootContext()->setContextProperty(QStringLiteral("DBusResponseWaiter") | ||
148 | , DBusResponseWaiter::instance()); | 154 | , DBusResponseWaiter::instance()); | ||
149 | 155 | | |||
150 | engine->rootContext()->setContextProperty(QStringLiteral("RemoteCommandsDbusInterfaceFactory") | 156 | engine->rootContext()->setContextProperty(QStringLiteral("RemoteCommandsDbusInterfaceFactory") | ||
151 | , new ObjectFactory(engine, createRemoteCommandsInterface)); | 157 | , new ObjectFactory(engine, createRemoteCommandsInterface)); | ||
158 | | ||||
159 | engine->rootContext()->setContextProperty(QStringLiteral("ShareDbusInterfaceFactory") | ||||
160 | , new ObjectFactory(engine, createShareInterface)); | ||||
152 | } | 161 | } |