diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-20 18:22:04 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-06-03 03:27:30 +0200 |
commit | b16a917f80d6d5b98627dd179f02d734ee71ffa6 (patch) | |
tree | 1651ff2dfaedba37513258681a0518c0e016f48f /ksmserver | |
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')
-rw-r--r-- | ksmserver/shutdown.cpp | 12 | ||||
-rw-r--r-- | ksmserver/shutdowndlg.cpp | 41 | ||||
-rw-r--r-- | ksmserver/shutdowndlg.h | 5 |
3 files changed, 33 insertions, 25 deletions
diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 09cb2d743..318718774 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -169,14 +169,24 @@ void KSMServer::shutdownInternal( KApplication::ShutdownConfirm confirm, dialogActive = true; if ( !logoutConfirmed ) { + int selection; KSMShutdownFeedback::start(); // make the screen gray logoutConfirmed = - KSMShutdownDlg::confirmShutdown( maysd, sdtype, bopt ); + KSMShutdownDlg::confirmShutdown( maysd, sdtype, bopt, &selection ); // ###### We can't make the screen remain gray while talking to the apps, // because this prevents interaction ("do you want to save", etc.) // TODO: turn the feedback widget into a list of apps to be closed, // with an indicator of the current status for each. KSMShutdownFeedback::stop(); // make the screen become normal again + if (selection != 0) { + // respect lock on resume & disable suspend/hibernate settings + // from power-manager + KConfig config("power-managerrc"); + bool lockOnResume = config.readBoolEntry("lockOnResume", true); + if (lockOnResume) { + DCOPRef("kdesktop", "KScreensaverIface").send("lock"); + } + } } if ( logoutConfirmed ) { 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(); diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h index fc63b19c6..c28804e5e 100644 --- a/ksmserver/shutdowndlg.h +++ b/ksmserver/shutdowndlg.h @@ -123,7 +123,7 @@ class KSMShutdownDlg : public TQDialog Q_OBJECT public: - static bool confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bopt ); + static bool confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bopt, int* selection=0 ); public slots: void slotLogout(); @@ -137,7 +137,7 @@ protected: ~KSMShutdownDlg(); private: - KSMShutdownDlg( TQWidget* parent, bool maysd, KApplication::ShutdownType sdtype ); + KSMShutdownDlg( TQWidget* parent, bool maysd, KApplication::ShutdownType sdtype, int* selection=0 ); KApplication::ShutdownType m_shutdownType; TQString m_bootOption; TQPopupMenu *targets; @@ -147,6 +147,7 @@ private: DBusConnection *m_dbusConn; #endif bool m_lockOnResume; + int* m_selection; }; // The shutdown-in-progress dialog |