Added a getter for dbus path in Device
This commit is contained in:
parent
40c4f1654b
commit
8627c8da51
3 changed files with 4 additions and 3 deletions
|
@ -27,7 +27,7 @@ Device::Device(const QString& id, const QString& name)
|
|||
reloadPlugins();
|
||||
|
||||
//Register in bus
|
||||
QDBusConnection::sessionBus().registerObject("/modules/kdeconnect/devices/"+id, this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
|
||||
QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
|
||||
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ Device::Device(const QString& id, const QString& name, DeviceLink* link)
|
|||
reloadPlugins();
|
||||
|
||||
//Register in bus
|
||||
QDBusConnection::sessionBus().registerObject("/modules/kdeconnect/devices/"+id, this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
|
||||
QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
QString id() const { return m_deviceId; }
|
||||
QString name() const { return m_deviceName; }
|
||||
QString dbusPath() const { return "/modules/kdeconnect/devices/"+id(); }
|
||||
|
||||
//Add and remove links
|
||||
void addLink(DeviceLink*);
|
||||
|
|
|
@ -43,7 +43,7 @@ BatteryPlugin::BatteryPlugin(QObject *parent, const QVariantList &args)
|
|||
BatteryPlugin::~BatteryPlugin()
|
||||
{
|
||||
//FIXME: Qt dbus does not allow to remove an adaptor! (it causes a crash in
|
||||
// the next access to device via dbus). The implication of not deleting this
|
||||
// the next dbus access to its parent). The implication of not deleting this
|
||||
// is that disabling the plugin does not remove the interface (that will
|
||||
// return outdated values) and that enabling it again instantiates a second
|
||||
// adaptor. This is a partial memory leak (the memory will be freed when the
|
||||
|
|
Loading…
Reference in a new issue