|
|
|
@ -34,20 +34,23 @@
|
|
|
|
|
|
|
|
|
|
Lid::Lid()
|
|
|
|
|
{
|
|
|
|
|
mUPowerInterface = new QDBusInterface("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower",
|
|
|
|
|
mUPowerInterface = new QDBusInterface("org.freedesktop.UPower",
|
|
|
|
|
"/org/freedesktop/UPower",
|
|
|
|
|
"org.freedesktop.UPower",
|
|
|
|
|
QDBusConnection::systemBus(), this);
|
|
|
|
|
mUPowerPropertiesInterface = new QDBusInterface("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties",
|
|
|
|
|
|
|
|
|
|
mUPowerPropertiesInterface = new QDBusInterface("org.freedesktop.UPower",
|
|
|
|
|
"/org/freedesktop/UPower",
|
|
|
|
|
"org.freedesktop.DBus.Properties",
|
|
|
|
|
QDBusConnection::systemBus(), this);
|
|
|
|
|
if (! connect(mUPowerInterface, SIGNAL(Changed()), this, SLOT(uPowerChange())))
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "Could not connect to org.freedesktop.UPower.changed(), connecting to org.freedesktop.DBus.Properties.PropertiesChanged(..) instead";
|
|
|
|
|
QDBusConnection::systemBus().connect("org.freedesktop.UPower",
|
|
|
|
|
|
|
|
|
|
if (!QDBusConnection::systemBus().connect("org.freedesktop.UPower",
|
|
|
|
|
"/org/freedesktop/UPower",
|
|
|
|
|
"org.freedesktop.DBus.Properties",
|
|
|
|
|
"PropertiesChanged",
|
|
|
|
|
this,
|
|
|
|
|
SLOT(uPowerChange()));
|
|
|
|
|
}
|
|
|
|
|
SLOT(uPowerChange())))
|
|
|
|
|
qDebug() << "Could not connect to org.freedesktop.DBus.Properties.PropertiesChanged()";
|
|
|
|
|
|
|
|
|
|
mIsClosed = mUPowerPropertiesInterface->property("LidIsClosed").toBool();
|
|
|
|
|
}
|
|
|
|
@ -62,7 +65,6 @@ bool Lid::onBattery()
|
|
|
|
|
return mUPowerInterface->property("OnBattery").toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Lid::uPowerChange()
|
|
|
|
|
{
|
|
|
|
|
bool newIsClosed = mUPowerInterface->property("LidIsClosed").toBool();
|
|
|
|
|