|
|
--- tdelibs/CMakeLists.txt.OR 2013-07-24 10:36:44.409135030 +0200
|
|
|
+++ tdelibs/CMakeLists.txt 2013-07-24 10:37:09.619389250 +0200
|
|
|
@@ -83,6 +83,7 @@
|
|
|
OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
|
|
|
OPTION( WITH_INOTIFY "Enable inotify support for tdeio" ON )
|
|
|
OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} )
|
|
|
+option( WITH_DEVKITPOWER "Enable DevKit Power support" OFF )
|
|
|
option( WITH_UPOWER "Enable uPower support" ${WITH_ALL_OPTIONS} )
|
|
|
option( WITH_UDISKS "Enable uDisks support" ${WITH_ALL_OPTIONS} )
|
|
|
option( WITH_UDISKS2 "Enable uDisks2 support" ${WITH_ALL_OPTIONS} )
|
|
|
--- tdelibs/tdecore/CMakeLists.txt.ORI 2013-07-24 10:40:06.480153460 +0200
|
|
|
+++ tdelibs/tdecore/CMakeLists.txt 2013-07-24 10:40:38.037254501 +0200
|
|
|
@@ -21,6 +21,13 @@
|
|
|
|
|
|
if( WITH_UPOWER )
|
|
|
add_definitions( -DWITH_UPOWER )
|
|
|
+endif ( )
|
|
|
+
|
|
|
+if( WITH_DEVKITPOWER )
|
|
|
+ add_definitions( -DWITH_DEVKITPOWER )
|
|
|
+endif ( )
|
|
|
+
|
|
|
+if( WITH_UPOWER OR WITH_DEVKITPOWER )
|
|
|
set ( TDEUPOWER_INCLUDE_DIRECTORIES
|
|
|
${DBUS_TQT_INCLUDE_DIRS}
|
|
|
)
|
|
|
--- tdelibs/tdecore/tdehardwaredevices.cpp.ORI 2013-07-24 10:42:27.499248218 +0200
|
|
|
+++ tdelibs/tdecore/tdehardwaredevices.cpp 2013-07-24 10:55:02.895355871 +0200
|
|
|
@@ -70,13 +70,13 @@
|
|
|
#endif // WITH_NETWORK_MANAGER_BACKEND
|
|
|
|
|
|
// uPower and uDisks2 integration
|
|
|
-#if defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2)
|
|
|
+#if defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_DEVKITPOWER)
|
|
|
#include <tqdbusdata.h>
|
|
|
#include <tqdbusmessage.h>
|
|
|
#include <tqdbusproxy.h>
|
|
|
#include <tqdbusvariant.h>
|
|
|
#include <tqdbusconnection.h>
|
|
|
-#endif // defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2)
|
|
|
+#endif // defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_DEVKITPOWER)
|
|
|
#if defined(WITH_UDISKS) || defined(WITH_UDISKS2)
|
|
|
#include <tqdbuserror.h>
|
|
|
#include <tqdbusdatamap.h>
|
|
|
@@ -85,6 +85,14 @@
|
|
|
#if defined(WITH_UDISKS)
|
|
|
#include "tqdbusdatalist.h"
|
|
|
#endif // ddefined(WITH_UDISKS)
|
|
|
+#ifdef WITH_DEVKITPOWER
|
|
|
+#define DBUS_POWER_CONNECTION_NAME "org.freedesktop.DeviceKit.Power"
|
|
|
+#define DBUS_POWER_OBJECT_PATH "/org/freedesktop/DeviceKit/Power"
|
|
|
+#endif // WITH_DEVKITPOWER
|
|
|
+#ifdef WITH_UPOWER
|
|
|
+#define DBUS_POWER_CONNECTION_NAME "org.freedesktop.UPower"
|
|
|
+#define DBUS_POWER_OBJECT_PATH "/org/freedesktop/UPower"
|
|
|
+#endif // WITH_UPOWER
|
|
|
|
|
|
// BEGIN BLOCK
|
|
|
// Copied from include/linux/genhd.h
|
|
|
@@ -1364,10 +1372,10 @@
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
-#ifdef WITH_UPOWER
|
|
|
+#if defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
if (dbusConn.isConnected()) {
|
|
|
- TQT_DBusProxy upowerProperties("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", dbusConn);
|
|
|
+ TQT_DBusProxy upowerProperties(DBUS_POWER_CONNECTION_NAME, DBUS_POWER_OBJECT_PATH, "org.freedesktop.DBus.Properties", dbusConn);
|
|
|
if (upowerProperties.canSend()) {
|
|
|
// can suspend?
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
@@ -1387,9 +1395,9 @@
|
|
|
else {
|
|
|
return FALSE;
|
|
|
}
|
|
|
-#else // WITH_UPOWER
|
|
|
+#else // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
return FALSE;
|
|
|
-#endif// WITH_UPOWER
|
|
|
+#endif// defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1405,10 +1413,10 @@
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
-#ifdef WITH_UPOWER
|
|
|
+#if defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
if (dbusConn.isConnected()) {
|
|
|
- TQT_DBusProxy upowerProperties("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", dbusConn);
|
|
|
+ TQT_DBusProxy upowerProperties(DBUS_POWER_CONNECTION_NAME, DBUS_POWER_OBJECT_PATH, "org.freedesktop.DBus.Properties", dbusConn);
|
|
|
if (upowerProperties.canSend()) {
|
|
|
// can hibernate?
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
@@ -1428,9 +1436,9 @@
|
|
|
else {
|
|
|
return FALSE;
|
|
|
}
|
|
|
-#else // WITH_UPOWER
|
|
|
+#else // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
return FALSE;
|
|
|
-#endif// WITH_UPOWER
|
|
|
+#endif// defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1565,24 +1573,24 @@
|
|
|
return true;
|
|
|
}
|
|
|
else {
|
|
|
-#ifdef WITH_UPOWER
|
|
|
+#if defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
TQT_DBusConnection dbusConn;
|
|
|
dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
if ( dbusConn.isConnected() ) {
|
|
|
if (ps == TDESystemPowerState::Suspend) {
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
- "org.freedesktop.UPower",
|
|
|
- "/org/freedesktop/UPower",
|
|
|
- "org.freedesktop.UPower",
|
|
|
+ DBUS_POWER_CONNECTION_NAME,
|
|
|
+ DBUS_POWER_OBJECT_PATH,
|
|
|
+ DBUS_POWER_CONNECTION_NAME,
|
|
|
"Suspend");
|
|
|
dbusConn.sendWithReply(msg);
|
|
|
return true;
|
|
|
}
|
|
|
else if (ps == TDESystemPowerState::Hibernate) {
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
- "org.freedesktop.UPower",
|
|
|
- "/org/freedesktop/UPower",
|
|
|
- "org.freedesktop.UPower",
|
|
|
+ DBUS_POWER_CONNECTION_NAME,
|
|
|
+ DBUS_POWER_OBJECT_PATH,
|
|
|
+ DBUS_POWER_CONNECTION_NAME,
|
|
|
"Hibernate");
|
|
|
dbusConn.sendWithReply(msg);
|
|
|
return true;
|
|
|
@@ -1594,9 +1602,9 @@
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
-#else // WITH_UPOWER
|
|
|
+#else // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
return false;
|
|
|
-#endif // WITH_UPOWER
|
|
|
+#endif // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
|
|
|
}
|
|
|
}
|
|
|
else if (ps == TDESystemPowerState::PowerOff) {
|