diff --git a/plugins/battery/batterydbusinterface.cpp b/plugins/battery/batterydbusinterface.cpp index 5960da8d7..ea550fb8b 100644 --- a/plugins/battery/batterydbusinterface.cpp +++ b/plugins/battery/batterydbusinterface.cpp @@ -20,10 +20,11 @@ #include "batterydbusinterface.h" +#include #include -BatteryDbusInterface::BatteryDbusInterface(QObject *parent) - : QDBusAbstractAdaptor(parent) +BatteryDbusInterface::BatteryDbusInterface(const Device *device) + : QDBusAbstractAdaptor(const_cast(device)) { } diff --git a/plugins/battery/batterydbusinterface.h b/plugins/battery/batterydbusinterface.h index 2fef9f637..b444ae219 100644 --- a/plugins/battery/batterydbusinterface.h +++ b/plugins/battery/batterydbusinterface.h @@ -23,6 +23,8 @@ #include +class Device; + class BatteryDbusInterface : public QDBusAbstractAdaptor { @@ -30,7 +32,7 @@ class BatteryDbusInterface Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.battery") public: - explicit BatteryDbusInterface(QObject *parent); + explicit BatteryDbusInterface(const Device *device); virtual ~BatteryDbusInterface(); Q_SCRIPTABLE int charge() const { return mCharge; } diff --git a/plugins/battery/batteryplugin.cpp b/plugins/battery/batteryplugin.cpp index 7b677c211..975ebaefa 100644 --- a/plugins/battery/batteryplugin.cpp +++ b/plugins/battery/batteryplugin.cpp @@ -32,7 +32,7 @@ K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_battery", "kdeconnect-plugi BatteryPlugin::BatteryPlugin(QObject *parent, const QVariantList &args) : KdeConnectPlugin(parent, args) - , batteryDbusInterface(new BatteryDbusInterface(parent)) + , batteryDbusInterface(new BatteryDbusInterface(device())) { //TODO: Add battery reporting, could be based on: diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index 75172b20f..412640d71 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -26,18 +26,22 @@ #include #include +#include +#include #include #include + #include "notificationsplugin.h" NotificationsDbusInterface::NotificationsDbusInterface(KdeConnectPlugin* plugin) - : QDBusAbstractAdaptor(plugin) + : QDBusAbstractAdaptor(const_cast(plugin->device())) , mDevice(plugin->device()) , mPlugin(plugin) , mLastId(0) , imagesDir(QDir::temp().absoluteFilePath("kdeconnect")) { imagesDir.mkpath(imagesDir.absolutePath()); + } NotificationsDbusInterface::~NotificationsDbusInterface() diff --git a/plugins/notifications/notificationsdbusinterface.h b/plugins/notifications/notificationsdbusinterface.h index acd67368c..5c1244ef1 100644 --- a/plugins/notifications/notificationsdbusinterface.h +++ b/plugins/notifications/notificationsdbusinterface.h @@ -27,9 +27,11 @@ #include #include -#include #include "notification.h" +class KdeConnectPlugin; +class Device; + class NotificationsDbusInterface : public QDBusAbstractAdaptor {