From c8ff4ef743f03d015db000d6f44b4249575c390f Mon Sep 17 00:00:00 2001
From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Sat, 17 Sep 2011 07:28:33 +0000
Subject: Disable SAK key detection in kdesktop when the lock dialog is active

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1254063 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 kdesktop/lockeng.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc
index 0612860a7..62e4855a9 100644
--- a/kdesktop/lockeng.cc
+++ b/kdesktop/lockeng.cc
@@ -83,6 +83,7 @@ void SaverEngine::lock()
     bool ok = true;
     if (mState == Waiting)
     {
+        mSAKProcess->kill(SIGTERM);
         ok = startLockProcess( ForceLock );
 // It takes a while for kdesktop_lock to start and lock the screen.
 // Therefore delay the DCOP call until it tells kdesktop that the locking is in effect.
@@ -127,6 +128,7 @@ void SaverEngine::save()
 {
     if (mState == Waiting)
     {
+        mSAKProcess->kill(SIGTERM);
         startLockProcess( DefaultLock );
     }
 }
@@ -208,9 +210,9 @@ void SaverEngine::handleSecureDialog()
 void SaverEngine::slotSAKProcessExited()
 {
     int retcode = mSAKProcess->exitStatus();
-    if (retcode != 0) trinity_lockeng_sak_available = FALSE;
+    if ((retcode != 0) && (mSAKProcess->normalExit())) trinity_lockeng_sak_available = FALSE;
 
-    if (trinity_lockeng_sak_available == TRUE) {
+    if ((mSAKProcess->normalExit()) && (trinity_lockeng_sak_available == TRUE)) {
         bool ok = true;
         if (mState == Waiting)
         {
@@ -384,6 +386,7 @@ void SaverEngine::idleTimeout()
     // disable X screensaver
     XForceScreenSaver(qt_xdisplay(), ScreenSaverReset );
     XSetScreenSaver(qt_xdisplay(), 0, mXInterval, PreferBlanking, DontAllowExposures);
+    mSAKProcess->kill(SIGTERM);
     startLockProcess( DefaultLock );
 }
 
-- 
cgit v1.2.3

