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