Fixed notifications not being appearing in the model nor in the plasmoid
The parent of the QDbusAdaptor has to be a Device, and now it was a KdeConnectPlugin for the Notifications plugin. Instead of passing the parent (that is actually a Device) to the QDbusAdaptor as we were doing in the Battery plugin, I preferred to get the actual Device from the KdeConnectPlugin, even though it needs a const_cast.
This commit is contained in:
parent
d72ebc4cf7
commit
3147067fbf
5 changed files with 15 additions and 6 deletions
|
@ -20,10 +20,11 @@
|
|||
|
||||
#include "batterydbusinterface.h"
|
||||
|
||||
#include <core/device.h>
|
||||
#include <core/kdebugnamespace.h>
|
||||
|
||||
BatteryDbusInterface::BatteryDbusInterface(QObject *parent)
|
||||
: QDBusAbstractAdaptor(parent)
|
||||
BatteryDbusInterface::BatteryDbusInterface(const Device *device)
|
||||
: QDBusAbstractAdaptor(const_cast<Device*>(device))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <QDBusAbstractAdaptor>
|
||||
|
||||
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; }
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -26,18 +26,22 @@
|
|||
#include <KIcon>
|
||||
#include <KMD5>
|
||||
|
||||
#include <core/device.h>
|
||||
#include <core/kdeconnectplugin.h>
|
||||
#include <core/kdebugnamespace.h>
|
||||
#include <core/filetransferjob.h>
|
||||
|
||||
#include "notificationsplugin.h"
|
||||
|
||||
NotificationsDbusInterface::NotificationsDbusInterface(KdeConnectPlugin* plugin)
|
||||
: QDBusAbstractAdaptor(plugin)
|
||||
: QDBusAbstractAdaptor(const_cast<Device*>(plugin->device()))
|
||||
, mDevice(plugin->device())
|
||||
, mPlugin(plugin)
|
||||
, mLastId(0)
|
||||
, imagesDir(QDir::temp().absoluteFilePath("kdeconnect"))
|
||||
{
|
||||
imagesDir.mkpath(imagesDir.absolutePath());
|
||||
|
||||
}
|
||||
|
||||
NotificationsDbusInterface::~NotificationsDbusInterface()
|
||||
|
|
|
@ -27,9 +27,11 @@
|
|||
#include <QStringList>
|
||||
#include <QDir>
|
||||
|
||||
#include <core/device.h>
|
||||
#include "notification.h"
|
||||
|
||||
class KdeConnectPlugin;
|
||||
class Device;
|
||||
|
||||
class NotificationsDbusInterface
|
||||
: public QDBusAbstractAdaptor
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue