From 7a982ffaa1fe1612f1f14bbc1eb5babdacd0e0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 9 May 2013 19:19:42 +0200 Subject: Kickoff menu: Allow suspend features using tdehw library --- kicker/kicker/ui/k_new_mnu.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'kicker') 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 #include #include +#include #include #include #include @@ -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")); -- cgit v1.2.1