summaryrefslogtreecommitdiffstats
path: root/kicker/kicker/ui/k_new_mnu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kicker/kicker/ui/k_new_mnu.cpp')
-rw-r--r--kicker/kicker/ui/k_new_mnu.cpp122
1 files changed, 82 insertions, 40 deletions
diff --git a/kicker/kicker/ui/k_new_mnu.cpp b/kicker/kicker/ui/k_new_mnu.cpp
index cdb542a31..fb13a9067 100644
--- a/kicker/kicker/ui/k_new_mnu.cpp
+++ b/kicker/kicker/ui/k_new_mnu.cpp
@@ -140,6 +140,17 @@
#define DOC_ID_BASE 10 + (IDS_PER_CATEGORY * 12)
#define OTHER_ID_BASE 10 + (IDS_PER_CATEGORY * 13)
+namespace SuspendType {
+enum SuspendType {
+ NotSpecified = 0,
+ Freeze,
+ Standby,
+ Suspend,
+ Hibernate,
+ HybridSuspend
+};
+};
+
static TQString calculate(const TQString &exp)
{
TQString result, cmd;
@@ -1345,11 +1356,11 @@ void KMenu::insertStaticExitItems()
m_exitView->leftView()->insertSeparator( nId++, i18n("Session"), index++ );
if (kapp->authorize("logout"))
- m_exitView->leftView()->insertItem( "edit-undo", i18n( "Logout" ),
- i18n( "End session" ), "kicker:/logout", nId++, index++ );
+ m_exitView->leftView()->insertItem( "edit-undo", i18n( "Log out" ),
+ i18n( "End current session" ), "kicker:/logout", nId++, index++ );
if (kapp->authorize("lock_screen"))
m_exitView->leftView()->insertItem( "system-lock-screen", i18n( "Lock" ),
- i18n( "Lock screen" ), "kicker:/lock", nId++, index++ );
+ i18n( "Lock computer screen" ), "kicker:/lock", nId++, index++ );
TDEConfig ksmserver("ksmserverrc", false, false);
ksmserver.setGroup("General");
@@ -1380,11 +1391,11 @@ void KMenu::insertStaticExitItems()
if ( maysd )
{
m_exitView->leftView()->insertSeparator( nId++, i18n("System"), index++ );
- m_exitView->leftView()->insertItem( "system-log-out", i18n( "Shutdown Computer" ),
+ m_exitView->leftView()->insertItem( "system-log-out", i18n( "Shutdown" ),
i18n( "Turn off computer" ), "kicker:/shutdown", nId++, index++ );
- m_exitView->leftView()->insertItem( "reload", i18n( "&Restart Computer" ).replace("&",""),
- i18n( "Restart and boot the default system" ),
+ m_exitView->leftView()->insertItem( "reload", i18n( "&Restart" ).replace("&",""),
+ i18n( "Restart computer and boot the default system" ),
"kicker:/restart", nId++, index++ );
insertSuspendOption(nId, index);
@@ -2725,17 +2736,20 @@ void KMenu::slotStartURL(const TQString& u)
kapp->dcopClient()->send("ksmserver", "default", "logoutTimed(int,int,TQString)", params);
}
- else if ( u == "kicker:/suspend_disk" ) {
- slotSuspend( 1 );
+ else if ( u == "kicker:/suspend_freeze" ) {
+ slotSuspend( SuspendType::Freeze );
+ }
+ else if ( u == "kicker:/standby" ) {
+ slotSuspend( SuspendType::Standby );
}
else if ( u == "kicker:/suspend_ram" ) {
- slotSuspend( 2 );
+ slotSuspend( SuspendType::Suspend );
}
- else if ( u == "kicker:/suspend_freeze" ) {
- slotSuspend( 4 );
+ else if ( u == "kicker:/suspend_disk" ) {
+ slotSuspend( SuspendType::Hibernate );
}
- else if ( u == "kicker:/standby" ) {
- slotSuspend( 3 );
+ else if ( u == "kicker:/hybrid_suspend" ) {
+ slotSuspend( SuspendType::HybridSuspend );
}
else if ( u == "kicker:/savesession" ) {
TQByteArray data;
@@ -3800,6 +3814,7 @@ void KMenu::insertSuspendOption( int &nId, int &index )
bool suspend_freeze = false;
bool standby = false;
bool suspend_disk = false;
+ bool hybrid_suspend = false;
#if defined(COMPILE_HALBACKEND)
suspend_ram = libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
@@ -3815,6 +3830,11 @@ void KMenu::insertSuspendOption( int &nId, int &index )
"/org/freedesktop/Hal/devices/computer",
"power_management.can_hibernate",
NULL);
+
+ hybrid_suspend = libhal_device_get_property_bool(m_halCtx,
+ "/org/freedesktop/Hal/devices/computer",
+ "power_management.can_suspend_hybrid",
+ NULL);
#elif defined(__TDE_HAVE_TDEHWLIB) // COMPILE_HALBACKEND
TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
if (rootDevice) {
@@ -3822,44 +3842,55 @@ void KMenu::insertSuspendOption( int &nId, int &index )
suspend_freeze = rootDevice->canFreeze();
standby = rootDevice->canStandby();
suspend_disk = rootDevice->canHibernate();
+ hybrid_suspend = rootDevice->canHybridSuspend();
}
#endif
+ m_exitView->leftView()->insertSeparator( nId++, i18n("Suspend"), index++ );
+
// respect disable suspend/hibernate settings from power-manager
TDEConfig config("power-managerrc");
bool disableSuspend = config.readBoolEntry("disableSuspend", false);
bool disableHibernate = config.readBoolEntry("disableHibernate", false);
- if ( suspend_disk && !disableHibernate ) {
+ if ( suspend_freeze && !disableSuspend ) {
m_exitView->leftView()->insertItem(
- "suspend2disk",
- i18n( "Suspend to Disk" ),
+ "suspend2ram",
+ i18n( "Freeze" ),
+ i18n( "Put the computer in software idle mode" ),
+ "kicker:/suspend_freeze", nId++, index++ );
+ }
+
+ if ( standby && !disableSuspend ) {
+ m_exitView->leftView()->insertItem(
+ "media-playback-pause",
+ i18n( "Standby" ),
i18n( "Pause without logging out" ),
- "kicker:/suspend_disk", nId++, index++ );
+ "kicker:/standby", nId++, index++ );
}
if ( suspend_ram && !disableSuspend ) {
m_exitView->leftView()->insertItem(
"suspend2ram",
+ i18n( "Sleep" ),
i18n( "Suspend to RAM" ),
- i18n( "Pause without logging out" ),
"kicker:/suspend_ram", nId++, index++ );
}
- if ( suspend_freeze && !disableSuspend ) {
+ if ( suspend_disk && !disableHibernate ) {
m_exitView->leftView()->insertItem(
- "suspend2ram",
- i18n( "Freeze" ),
- i18n( "Pause without logging out" ),
- "kicker:/suspend_freeze", nId++, index++ );
+ "suspend2disk",
+ i18n( "Hibernate" ),
+ i18n( "Suspend to Disk" ),
+ "kicker:/suspend_disk", nId++, index++ );
}
- if ( standby && !disableSuspend ) {
+ if ( hybrid_suspend && !disableSuspend && !disableHibernate ) {
m_exitView->leftView()->insertItem(
- "media-playback-pause",
- i18n( "Standby" ),
- i18n( "Pause without logging out" ),
- "kicker:/standby", nId++, index++ );
+ "suspend2disk",
+ i18n( "Hybrid Suspend" ),
+ i18n( "Suspend to RAM + Disk" ),
+ "kicker:/hybrid_suspend", nId++, index++ );
}
}
@@ -3880,13 +3911,14 @@ void KMenu::slotSuspend(int id)
DBusMessage* msg = NULL;
if (m_dbusConn) {
- if (id == 1) {
+ // No Freeze support in HAL
+ if (id == SuspendType::Standby) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
- "Hibernate");
- } else if (id == 2) {
+ "Standby");
+ } else if (id == SuspendType::Suspend) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
@@ -3894,12 +3926,20 @@ void KMenu::slotSuspend(int id)
"Suspend");
int wakeup=0;
dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
- } else if (id == 3) {
+ } else if (id == SuspendType::Hibernate) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
- "Standby");
+ "Hibernate");
+ } else if (id == SuspendType::HybridSuspend) {
+ msg = dbus_message_new_method_call(
+ "org.freedesktop.Hal",
+ "/org/freedesktop/Hal/devices/computer",
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
+ "SuspendHybrid");
+ int wakeup=0;
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
} else {
return;
}
@@ -3912,14 +3952,16 @@ void KMenu::slotSuspend(int id)
#elif defined(__TDE_HAVE_TDEHWLIB) // 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 if (id == 4) {
+ if (id == SuspendType::Freeze) {
error = !rootDevice->setPowerState(TDESystemPowerState::Freeze);
+ } else if (id == SuspendType::Standby) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::Standby);
+ } else if (id == SuspendType::Suspend) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::Suspend);
+ } else if (id == SuspendType::Hibernate) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::Hibernate);
+ } else if (id == SuspendType::HybridSuspend) {
+ error = !rootDevice->setPowerState(TDESystemPowerState::HybridSuspend);
} else {
return;
}