diff options
author | Timothy Pearson <[email protected]> | 2012-05-20 18:22:04 -0500 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2012-06-03 03:27:30 +0200 |
commit | b16a917f80d6d5b98627dd179f02d734ee71ffa6 (patch) | |
tree | 1651ff2dfaedba37513258681a0518c0e016f48f /ksmserver/shutdowndlg.cpp | |
parent | 79c512a168677b441ee6141d5dbe6b0a9d778386 (diff) | |
download | tdebase-b16a917f80d6d5b98627dd179f02d734ee71ffa6.tar.gz tdebase-b16a917f80d6d5b98627dd179f02d734ee71ffa6.zip |
Fix desktop lock not engaging on suspend
This closes Bug 1003
(cherry picked from commit 193d9afcdb186902317c5bef5d6c769fc8933f1a)
Diffstat (limited to 'ksmserver/shutdowndlg.cpp')
-rw-r--r-- | ksmserver/shutdowndlg.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index d235879df..235ec3fcf 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -665,14 +665,17 @@ void KSMShutdownIPFeedback::slotPaintEffect() ////// KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, - bool maysd, KApplication::ShutdownType sdtype ) - : TQDialog( parent, 0, TRUE, (WFlags)WType_Popup ), targets(0) + bool maysd, KApplication::ShutdownType sdtype, int* selection ) + : TQDialog( parent, 0, TRUE, (WFlags)WType_Popup ), targets(0), m_selection(selection) // this is a WType_Popup on purpose. Do not change that! Not // having a popup here has severe side effects. { TQVBoxLayout* vbox = new TQVBoxLayout( this ); + if (m_selection) { + *m_selection = 0; + } TQFrame* frame = new TQFrame( this ); frame->setFrameStyle( TQFrame::StyledPanel | TQFrame::Raised ); @@ -1069,17 +1072,15 @@ void KSMShutdownDlg::slotHalt() void KSMShutdownDlg::slotSuspend() { -#ifdef COMPILE_HALBACKEND - if (m_lockOnResume) { - DCOPRef("kdesktop", "KScreensaverIface").send("lock"); - } + *m_selection = 1; // Suspend - if (m_dbusConn) +#ifdef COMPILE_HALBACKEND + if (m_dbusConn) { DBusMessage *msg = dbus_message_new_method_call( "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", + "/org/freedesktop/Hal/devices/computer", + "org.freedesktop.Hal.Device.SystemPowerManagement", "Suspend"); int wakeup=0; @@ -1089,41 +1090,37 @@ void KSMShutdownDlg::slotSuspend() dbus_message_unref(msg); } - - reject(); // continue on resume #endif + reject(); // continue on resume } void KSMShutdownDlg::slotHibernate() { -#ifdef COMPILE_HALBACKEND - if (m_lockOnResume) { - DCOPRef("kdesktop", "KScreensaverIface").send("lock"); - } + *m_selection = 2; // Hibernate - if (m_dbusConn) +#ifdef COMPILE_HALBACKEND + if (m_dbusConn) { DBusMessage *msg = dbus_message_new_method_call( "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", + "/org/freedesktop/Hal/devices/computer", + "org.freedesktop.Hal.Device.SystemPowerManagement", "Hibernate"); dbus_connection_send(m_dbusConn, msg, NULL); dbus_message_unref(msg); } - - reject(); // continue on resume #endif + reject(); // continue on resume } -bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bootOption ) +bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bootOption, int* selection ) { kapp->enableStyles(); KSMShutdownDlg* l = new KSMShutdownDlg( 0, //KSMShutdownFeedback::self(), - maysd, sdtype ); + maysd, sdtype, selection ); // Show dialog (will save the background in showEvent) TQSize sh = l->sizeHint(); |