File suspend-lock.diff of Package kdebase4-wallpapers

Subject: Use Solid suspend method that also locks screen
From: Lubos Lunak
Bug: bnc#326848
Patch-upstream: No

I don't understand what the difference between the two Solid suspend methods
is (or even why there are two), but the one ksmserver in 4.1 uses does not
lock the screen, and this one does.

Index: ksmserver/shutdowndlg.cpp
===================================================================
--- ksmserver/shutdowndlg.cpp.orig
+++ ksmserver/shutdowndlg.cpp
@@ -43,6 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE
 #include <kiconloader.h>
 #include <klocale.h>
 #include <kuser.h>
+#include <solid/powermanagement.h>
 #include <solid/control/powermanager.h>
 #include <kwindowsystem.h>
 #include <netwm.h>
@@ -651,9 +652,16 @@ void KSMShutdownDlg::slotSuspend(QAction
 {
     m_bootOption.clear();
     Solid::Control::PowerManager::SuspendMethod spdMethod = action->data().value<Solid::Control::PowerManager::SuspendMethod>();
+    if( spdMethod == Solid::Control::PowerManager::ToRam )
+        Solid::PowerManagement::requestSleep(Solid::PowerManagement::SuspendState,0,0);
+    else if( spdMethod == Solid::Control::PowerManager::ToDisk )
+        Solid::PowerManagement::requestSleep(Solid::PowerManagement::HibernateState,0,0);
+    else
+    {
     KJob *job = Solid::Control::PowerManager::suspend( spdMethod );
     if (job != 0)
        job->start();
+    }
     reject();
 }
 
openSUSE Build Service is sponsored by