From dd2951393f39967bcda55c03eb1b8d67c0c3d504 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 19 Sep 2015 18:57:39 -0500 Subject: Prevent saver from starting while valid card is inserted --- kdesktop/lockeng.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'kdesktop') diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc index 5173916c9..0c7558f9b 100644 --- a/kdesktop/lockeng.cc +++ b/kdesktop/lockeng.cc @@ -247,21 +247,20 @@ void SaverEngine::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) KUser user; if (login_name == user.loginName()) { mValidCryptoCardInserted = true; - // Disable saver startup - enable(false); } } } void SaverEngine::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { if (mValidCryptoCardInserted) { + mValidCryptoCardInserted = false; + // Restore saver timeout configure(); // Force lock lockScreen(); } - mValidCryptoCardInserted = false; } //--------------------------------------------------------------------------- @@ -279,6 +278,10 @@ void SaverEngine::lock() // void SaverEngine::lockScreen(bool DCOP) { + if (mValidCryptoCardInserted) { + return; + } + bool ok = true; if (mState != Saving) { @@ -328,9 +331,10 @@ void SaverEngine::saverLockReady() //--------------------------------------------------------------------------- void SaverEngine::save() { - if (mState == Waiting) - { - startLockProcess( DefaultLock ); + if (!mValidCryptoCardInserted) { + if (mState == Waiting) { + startLockProcess( DefaultLock ); + } } } @@ -727,10 +731,12 @@ void SaverEngine::lockProcessWaiting() // void SaverEngine::idleTimeout() { - // disable X screensaver - XForceScreenSaver(tqt_xdisplay(), ScreenSaverReset ); - XSetScreenSaver(tqt_xdisplay(), 0, mXInterval, PreferBlanking, DontAllowExposures); - startLockProcess( DefaultLock ); + if (!mValidCryptoCardInserted) { + // disable X screensaver + XForceScreenSaver(tqt_xdisplay(), ScreenSaverReset ); + XSetScreenSaver(tqt_xdisplay(), 0, mXInterval, PreferBlanking, DontAllowExposures); + startLockProcess( DefaultLock ); + } } xautolock_corner_t SaverEngine::applyManualSettings(int action) -- cgit v1.2.1