summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--kdoctools/customization/entities/general.entities4
-rw-r--r--tdecore/CMakeLists.txt4
-rw-r--r--tdecore/tdehardwaredevices.cpp130
-rw-r--r--tdecore/tdehardwaredevices.h8
5 files changed, 144 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a152c9ccf..ccb8fb709 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,9 +83,10 @@ OPTION( WITH_PCRE "Enable pcre regex support for kjs" ON )
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_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} )
+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} )
+option( WITH_CONSOLEKIT "Enable ConsoleKit support" ${WITH_ALL_OPTIONS} )
OPTION( WITH_NETWORK_MANAGER_BACKEND "Enable network-manager support" OFF )
OPTION( WITH_SUDO_TDESU_BACKEND "Use sudo as backend for tdesu (default is su)" OFF )
OPTION( WITH_OLD_XDG_STD "Use the pre R14.0.0 XDG standard where both TDE and KDE are recognized in desktop files" OFF )
diff --git a/kdoctools/customization/entities/general.entities b/kdoctools/customization/entities/general.entities
index 313b848fc..e51ebea6d 100644
--- a/kdoctools/customization/entities/general.entities
+++ b/kdoctools/customization/entities/general.entities
@@ -423,3 +423,7 @@
<!ENTITY kscore "<application>KScore</application>">
<!ENTITY ttdemidi "<application>ttdemidi</application>">
<!ENTITY quanta "<application>Quanta</application>">
+
+<!ENTITY tde-release-version "R14.0.0 [DEVELOPMENT]">
+<!ENTITY tde-release-date "April 25, 2013">
+<!ENTITY tde-copyright-date "2010-2013">
diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt
index 179a8aa7a..bff0e51d0 100644
--- a/tdecore/CMakeLists.txt
+++ b/tdecore/CMakeLists.txt
@@ -37,6 +37,10 @@ if( WITH_UDISKS2 )
add_definitions( -DWITH_UDISKS2 )
endif( )
+if( WITH_CONSOLEKIT )
+ add_definitions( -DWITH_CONSOLEKIT )
+endif( )
+
if( WITH_LIBART )
add_subdirectory( svgicons )
set( KDESVGICONS kdesvgicons-static )
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 473d17312..f4fde484f 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -1167,7 +1167,7 @@ bool TDECPUDevice::canSetGovernor() {
if (dbusConn.isConnected()) {
TQT_DBusProxy hardwareControl("org.trinitydesktop.hardwarecontrol", "/org/trinitydesktop/hardwarecontrol", "org.trinitydesktop.hardwarecontrol,CPUGovernor", dbusConn);
- // can set brightness?
+ // can set CPU governor?
TQValueList<TQT_DBusData> params;
params << TQT_DBusData::fromInt32(coreNumber());
TQT_DBusMessage reply = hardwareControl.sendWithReply("CanSetCPUGovernor", params);
@@ -1201,7 +1201,7 @@ void TDECPUDevice::setGovernor(TQString gv) {
if (dbusConn.isConnected()) {
TQT_DBusProxy hardwareControl("org.trinitydesktop.hardwarecontrol", "/org/trinitydesktop/hardwarecontrol", "org.trinitydesktop.hardwarecontrol.CPUGovernor", dbusConn);
- // set brightness
+ // set CPU governor
TQValueList<TQT_DBusData> params;
params << TQT_DBusData::fromInt32(coreNumber()) << TQT_DBusData::fromString(gv.lower());
hardwareControl.sendWithReply("SetCPUGovernor", params);
@@ -1407,20 +1407,79 @@ bool TDERootSystemDevice::canHibernate() {
}
bool TDERootSystemDevice::canPowerOff() {
+ TDEConfig *config = TDEGlobal::config();
+ config->reparseConfiguration(); // config may have changed in the KControl module
+
+ config->setGroup("General" );
+ bool maysd = false;
+#ifdef WITH_CONSOLEKIT
+ if (config->readBoolEntry( "offerShutdown", true )) {
+ TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
+ if (dbusConn.isConnected()) {
+ TQT_DBusProxy consoleKitManager("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", dbusConn);
+
+ // can power off?
+ TQValueList<TQT_DBusData> params;
+ TQT_DBusMessage reply = consoleKitManager.sendWithReply("CanStop", params);
+ if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
+ maysd = reply[0].toBool();
+ }
+ else {
+ maysd = false;
+ }
+ }
+ else {
+ maysd = false;
+ }
+ }
+#else // WITH_CONSOLEKIT
// FIXME
// Can we power down this system?
// This should probably be checked via DCOP and therefore interface with KDM
+ if (config->readBoolEntry( "offerShutdown", true )/* && DM().canShutdown()*/) { // FIXME
+ maysd = true;
+ }
+#endif // WITH_CONSOLEKIT
+ return maysd;
+}
+
+bool TDERootSystemDevice::canReboot() {
TDEConfig *config = TDEGlobal::config();
config->reparseConfiguration(); // config may have changed in the KControl module
config->setGroup("General" );
- bool maysd = false;
+ bool mayrb = false;
+#ifdef WITH_CONSOLEKIT
+ if (config->readBoolEntry( "offerShutdown", true )) {
+ TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
+ if (dbusConn.isConnected()) {
+ TQT_DBusProxy consoleKitManager("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", dbusConn);
+
+ // can reboot?
+ TQValueList<TQT_DBusData> params;
+ TQT_DBusMessage reply = consoleKitManager.sendWithReply("CanRestart", params);
+ if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
+ mayrb = reply[0].toBool();
+ }
+ else {
+ mayrb = false;
+ }
+ }
+ else {
+ mayrb = false;
+ }
+ }
+#else // WITH_CONSOLEKIT
+ // FIXME
+ // Can we power down this system?
+ // This should probably be checked via DCOP and therefore interface with KDM
if (config->readBoolEntry( "offerShutdown", true )/* && DM().canShutdown()*/) { // FIXME
- maysd = true;
+ mayrb = true;
}
+#endif // WITH_CONSOLEKIT
- return maysd;
+ return mayrb;
}
void TDERootSystemDevice::setHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm) {
@@ -1505,6 +1564,30 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
}
}
else if (ps == TDESystemPowerState::PowerOff) {
+#ifdef WITH_CONSOLEKIT
+ TDEConfig *config = TDEGlobal::config();
+ config->reparseConfiguration(); // config may have changed in the KControl module
+ config->setGroup("General" );
+ if (config->readBoolEntry( "offerShutdown", true )) {
+ TQT_DBusConnection dbusConn;
+ dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
+ if ( dbusConn.isConnected() ) {
+ TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
+ "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager",
+ "Stop");
+ dbusConn.sendWithReply(msg);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+#else // WITH_CONSOLEKIT
// Power down the system using a DCOP command
// Values are explained at http://lists.kde.org/?l=kde-linux&m=115770988603387
TQByteArray data;
@@ -1514,6 +1597,43 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
return true;
}
return false;
+#endif // WITH_CONSOLEKIT
+ }
+ else if (ps == TDESystemPowerState::Reboot) {
+#ifdef WITH_CONSOLEKIT
+ TDEConfig *config = TDEGlobal::config();
+ config->reparseConfiguration(); // config may have changed in the KControl module
+ config->setGroup("General" );
+ if (config->readBoolEntry( "offerShutdown", true )) {
+ TQT_DBusConnection dbusConn;
+ dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
+ if ( dbusConn.isConnected() ) {
+ TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
+ "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager",
+ "Restart");
+ dbusConn.sendWithReply(msg);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+#else // WITH_CONSOLEKIT
+ // Power down the system using a DCOP command
+ // Values are explained at http://lists.kde.org/?l=kde-linux&m=115770988603387
+ TQByteArray data;
+ TQDataStream arg(data, IO_WriteOnly);
+ arg << (int)0 << (int)1 << (int)2;
+ if ( kapp->dcopClient()->send("ksmserver", "default", "logout(int,int,int)", data) ) {
+ return true;
+ }
+ return false;
+#endif // WITH_CONSOLEKIT
}
else if (ps == TDESystemPowerState::Active) {
// Ummm...we're already active...
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index 4c9b74940..1fe962207 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -1576,7 +1576,8 @@ enum TDESystemPowerState {
Standby,
Suspend,
Hibernate,
- PowerOff
+ PowerOff,
+ Reboot
};
};
@@ -1659,6 +1660,11 @@ class TDECORE_EXPORT TDERootSystemDevice : public TDEGenericDevice
bool canPowerOff();
/**
+ * @return TRUE if permissions allow the system to be rebooted, FALSE if not
+ */
+ bool canReboot();
+
+ /**
* @param hm a TDESystemHibernationMethod::TDESystemHibernationMethod with the desired hibernation method
*/
void setHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm);