Changeset View
Changeset View
Standalone View
Standalone View
src/solid/devices/backends/upower/upowerdevice.cpp
Show All 26 Lines | |||||
27 | 27 | | |||
28 | #include <solid/genericinterface.h> | 28 | #include <solid/genericinterface.h> | ||
29 | #include <solid/device.h> | 29 | #include <solid/device.h> | ||
30 | 30 | | |||
31 | #include <QStringList> | 31 | #include <QStringList> | ||
32 | #include <QDebug> | 32 | #include <QDebug> | ||
33 | #include <QDBusReply> | 33 | #include <QDBusReply> | ||
34 | 34 | | |||
35 | #include <QElapsedTimer> | ||||
apol: unneeded? | |||||
36 | | ||||
35 | using namespace Solid::Backends::UPower; | 37 | using namespace Solid::Backends::UPower; | ||
36 | 38 | | |||
37 | UPowerDevice::UPowerDevice(const QString &udi) | 39 | UPowerDevice::UPowerDevice(const QString &udi) | ||
38 | : Solid::Ifaces::Device() | 40 | : Solid::Ifaces::Device() | ||
39 | , m_device(UP_DBUS_SERVICE, | 41 | , m_device(UP_DBUS_SERVICE, | ||
40 | udi, | 42 | udi, | ||
41 | UP_DBUS_INTERFACE_DEVICE, | | |||
42 | QDBusConnection::systemBus()) | 43 | QDBusConnection::systemBus()) | ||
43 | , m_udi(udi) | 44 | , m_udi(udi) | ||
44 | { | 45 | { | ||
45 | if (m_device.isValid()) { | 46 | if (m_device.isValid()) { | ||
46 | if (m_device.metaObject()->indexOfSignal("Changed()") != -1) { | | |||
47 | connect(&m_device, SIGNAL(Changed()), this, SLOT(slotChanged())); | | |||
48 | } else { | | |||
49 | // for UPower >= 0.99.0, missing Changed() signal | | |||
50 | QDBusConnection::systemBus().connect(UP_DBUS_SERVICE, m_udi, "org.freedesktop.DBus.Properties", "PropertiesChanged", this, | 47 | QDBusConnection::systemBus().connect(UP_DBUS_SERVICE, m_udi, "org.freedesktop.DBus.Properties", "PropertiesChanged", this, | ||
51 | SLOT(onPropertiesChanged(QString,QVariantMap,QStringList))); | 48 | SLOT(onPropertiesChanged(QString,QVariantMap,QStringList))); | ||
52 | } | | |||
53 | 49 | | |||
54 | // TODO port this to Solid::Power, we can't link against kdelibs4support for this signal | 50 | // TODO port this to Solid::Power, we can't link against kdelibs4support for this signal | ||
55 | // older upower versions not affected | 51 | // older upower versions not affected | ||
56 | QDBusConnection::systemBus().connect("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "PrepareForSleep", | 52 | QDBusConnection::systemBus().connect("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "PrepareForSleep", | ||
57 | this, SLOT(login1Resuming(bool))); | 53 | this, SLOT(login1Resuming(bool))); | ||
58 | } | 54 | } | ||
59 | } | 55 | } | ||
60 | 56 | | |||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |
unneeded?