diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-05-09 19:19:42 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-05-09 19:19:59 +0200 |
commit | 7a982ffaa1fe1612f1f14bbc1eb5babdacd0e0c6 (patch) | |
tree | 083e7c839a38fc2415c5ef6d5b3febe9af9b3af4 /kicker | |
parent | bbdb95ed648dbce49fbb07fb092793af6dad6080 (diff) | |
download | tdebase-7a982ffaa1fe1612f1f14bbc1eb5babdacd0e0c6.tar.gz tdebase-7a982ffaa1fe1612f1f14bbc1eb5babdacd0e0c6.zip |
Kickoff menu: Allow suspend features using tdehw library
Diffstat (limited to 'kicker')
-rw-r--r-- | kicker/kicker/ui/k_new_mnu.cpp | 21 |
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")); |