summaryrefslogtreecommitdiffstats
path: root/kicker
diff options
context:
space:
mode:
Diffstat (limited to 'kicker')
-rw-r--r--kicker/kicker/ui/k_new_mnu.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/kicker/kicker/ui/k_new_mnu.cpp b/kicker/kicker/ui/k_new_mnu.cpp
index 2b05eb417..3711a914f 100644
--- a/kicker/kicker/ui/k_new_mnu.cpp
+++ b/kicker/kicker/ui/k_new_mnu.cpp
@@ -52,6 +52,7 @@
#include <kdebug.h>
#include <tdeglobal.h>
#include <tdeglobalsettings.h>
+#include <tdehardwaredevices.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <tdelocale.h>
@@ -3761,6 +3762,13 @@ void KMenu::insertSuspendOption( int &nId, int &index )
"/org/freedesktop/Hal/devices/computer",
"power_management.can_hibernate",
NULL);
+#else // COMPILE_HALBACKEND
+ TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
+ if (rootDevice) {
+ suspend_ram = rootDevice->canSuspend();
+ standby = rootDevice->canStandby();
+ suspend_disk = rootDevice->canHibernate();
+ }
#endif
if ( suspend_disk ) {
@@ -3824,6 +3832,19 @@ void KMenu::slotSuspend(int id)
}
dbus_message_unref(msg);
}
+#else // COMPILE_HALBACKEND
+ TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
+ if (rootDevice) {
+ if (id == 1) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::Hibernate);
+ } else if (id == 2) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::Suspend);
+ } else if (id == 3) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::Standby);
+ } else {
+ return;
+ }
+ }
#endif
if (error)
KMessageBox::error(this, i18n("Suspend failed"));