|
|
|
@ -698,45 +698,36 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_LOGINDPOWER
|
|
|
|
|
{
|
|
|
|
|
// No support for "freeze" in org.freedesktop.login1
|
|
|
|
|
// No support for "freeze" and "standby" in org.freedesktop.login1
|
|
|
|
|
TQT_DBusConnection dbusConn;
|
|
|
|
|
dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if ( dbusConn.isConnected() ) {
|
|
|
|
|
TQT_DBusProxy logindProxy("org.freedesktop.login1", "/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager", dbusConn);
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
params << TQT_DBusData::fromBool(true);
|
|
|
|
|
if (logindProxy.canSend()) {
|
|
|
|
|
if (ps == TDESystemPowerState::Suspend) {
|
|
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
|
|
"org.freedesktop.login1",
|
|
|
|
|
"/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager",
|
|
|
|
|
"Suspend");
|
|
|
|
|
TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
|
|
|
|
|
TQT_DBusMessage reply = logindProxy.sendWithReply("Suspend", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (ps == TDESystemPowerState::Hibernate) {
|
|
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
|
|
"org.freedesktop.login1",
|
|
|
|
|
"/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager",
|
|
|
|
|
"Hibernate");
|
|
|
|
|
TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
|
|
|
|
|
TQT_DBusMessage reply = logindProxy.sendWithReply("Hibernate", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (ps == TDESystemPowerState::HybridSuspend) {
|
|
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
|
|
"org.freedesktop.login1",
|
|
|
|
|
"/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager",
|
|
|
|
|
"HybridSleep");
|
|
|
|
|
TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
|
|
|
|
|
TQT_DBusMessage reply = logindProxy.sendWithReply("HybridSleep", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_LOGINDPOWER
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_UPOWER
|
|
|
|
@ -927,17 +918,18 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
|
|
|
|
|
TQT_DBusConnection dbusConn;
|
|
|
|
|
dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if ( dbusConn.isConnected() ) {
|
|
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
|
|
"org.trinitydesktop.login1",
|
|
|
|
|
"/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager",
|
|
|
|
|
"PowerOff");
|
|
|
|
|
TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
|
|
|
|
|
TQT_DBusProxy logindProxy("org.freedesktop.login1", "/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager", dbusConn);
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
params << TQT_DBusData::fromBool(true);
|
|
|
|
|
if (logindProxy.canSend()) {
|
|
|
|
|
TQT_DBusMessage reply = logindProxy.sendWithReply("PowerOff", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_LOGINDPOWER
|
|
|
|
|
#ifdef WITH_CONSOLEKIT
|
|
|
|
|
{
|
|
|
|
@ -994,17 +986,18 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
|
|
|
|
|
TQT_DBusConnection dbusConn;
|
|
|
|
|
dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if ( dbusConn.isConnected() ) {
|
|
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
|
|
"org.trinitydesktop.login1",
|
|
|
|
|
"/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager",
|
|
|
|
|
"Reboot");
|
|
|
|
|
TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
|
|
|
|
|
TQT_DBusProxy logindProxy("org.freedesktop.login1", "/org/freedesktop/login1",
|
|
|
|
|
"org.freedesktop.login1.Manager", dbusConn);
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
params << TQT_DBusData::fromBool(true);
|
|
|
|
|
if (logindProxy.canSend()) {
|
|
|
|
|
TQT_DBusMessage reply = logindProxy.sendWithReply("Reboot", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_LOGINDPOWER
|
|
|
|
|
#ifdef WITH_CONSOLEKIT
|
|
|
|
|
{
|
|
|
|
|