diff --git a/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/declarativeplugin/kdeconnectdeclarativeplugin.cpp --- a/declarativeplugin/kdeconnectdeclarativeplugin.cpp +++ b/declarativeplugin/kdeconnectdeclarativeplugin.cpp @@ -90,6 +90,11 @@ return new RemoteCommandsDbusInterface(deviceId.toString()); } +QObject* createShareInterface(const QVariant& deviceId) +{ + return new ShareDbusInterface(deviceId.toString()); +} + void KdeConnectDeclarativePlugin::registerTypes(const char* uri) { qmlRegisterType(uri, 1, 0, "DevicesModel"); @@ -103,6 +108,7 @@ qmlRegisterUncreatableType(uri, 1, 0, "RemoteKeyboardDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); qmlRegisterUncreatableType(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); qmlRegisterUncreatableType(uri, 1, 0, "RemoteCommandsDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); + qmlRegisterUncreatableType(uri, 1, 0, "ShareDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces")); qmlRegisterSingletonType(uri, 1, 0, "DaemonDbusInterface", [](QQmlEngine*, QJSEngine*) -> QObject* { return new DaemonDbusInterface; @@ -149,4 +155,7 @@ engine->rootContext()->setContextProperty(QStringLiteral("RemoteCommandsDbusInterfaceFactory") , new ObjectFactory(engine, createRemoteCommandsInterface)); + + engine->rootContext()->setContextProperty(QStringLiteral("ShareDbusInterfaceFactory") + , new ObjectFactory(engine, createShareInterface)); } diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -50,6 +50,7 @@ geninterface(${CMAKE_SOURCE_DIR}/plugins/remotekeyboard/remotekeyboardplugin.h remotekeyboardinterface) geninterface(${CMAKE_SOURCE_DIR}/plugins/sms/smsplugin.h smsinterface) geninterface(${CMAKE_SOURCE_DIR}/plugins/sms/conversationsdbusinterface.h conversationsinterface) +geninterface(${CMAKE_SOURCE_DIR}/plugins/share/shareplugin.h shareinterface) add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC}) diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h --- a/interfaces/dbusinterfaces.h +++ b/interfaces/dbusinterfaces.h @@ -37,6 +37,7 @@ #include "interfaces/remotekeyboardinterface.h" #include "interfaces/smsinterface.h" #include "interfaces/conversationsinterface.h" +#include "interfaces/shareinterface.h" /** * Using these "proxy" classes just in case we need to rename the @@ -219,6 +220,15 @@ ~SmsDbusInterface() override; }; +class KDECONNECTINTERFACES_EXPORT ShareDbusInterface + : public OrgKdeKdeconnectDeviceShareInterface +{ + Q_OBJECT +public: + explicit ShareDbusInterface(const QString& deviceId, QObject* parent = nullptr); + ~ShareDbusInterface() override; +}; + template static void setWhenAvailable(const QDBusPendingReply& pending, W func, QObject* parent) { diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -182,3 +182,10 @@ } SmsDbusInterface::~SmsDbusInterface() = default; + +ShareDbusInterface::ShareDbusInterface(const QString& deviceId, QObject* parent): + OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/share", QDBusConnection::sessionBus(), parent) +{ +} + +ShareDbusInterface::~ShareDbusInterface() = default;