Prevent saver from starting while valid card is inserted

pull/2/head
Timothy Pearson 10 years ago
parent fcb6161cee
commit dd2951393f

@ -247,21 +247,20 @@ void SaverEngine::cryptographicCardInserted(TDECryptographicCardDevice* cdevice)
KUser user; KUser user;
if (login_name == user.loginName()) { if (login_name == user.loginName()) {
mValidCryptoCardInserted = true; mValidCryptoCardInserted = true;
// Disable saver startup
enable(false);
} }
} }
} }
void SaverEngine::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) { void SaverEngine::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) {
if (mValidCryptoCardInserted) { if (mValidCryptoCardInserted) {
mValidCryptoCardInserted = false;
// Restore saver timeout // Restore saver timeout
configure(); configure();
// Force lock // Force lock
lockScreen(); lockScreen();
} }
mValidCryptoCardInserted = false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -279,6 +278,10 @@ void SaverEngine::lock()
// //
void SaverEngine::lockScreen(bool DCOP) void SaverEngine::lockScreen(bool DCOP)
{ {
if (mValidCryptoCardInserted) {
return;
}
bool ok = true; bool ok = true;
if (mState != Saving) if (mState != Saving)
{ {
@ -328,10 +331,11 @@ void SaverEngine::saverLockReady()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void SaverEngine::save() void SaverEngine::save()
{ {
if (mState == Waiting) if (!mValidCryptoCardInserted) {
{ if (mState == Waiting) {
startLockProcess( DefaultLock ); startLockProcess( DefaultLock );
} }
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -727,10 +731,12 @@ void SaverEngine::lockProcessWaiting()
// //
void SaverEngine::idleTimeout() void SaverEngine::idleTimeout()
{ {
if (!mValidCryptoCardInserted) {
// disable X screensaver // disable X screensaver
XForceScreenSaver(tqt_xdisplay(), ScreenSaverReset ); XForceScreenSaver(tqt_xdisplay(), ScreenSaverReset );
XSetScreenSaver(tqt_xdisplay(), 0, mXInterval, PreferBlanking, DontAllowExposures); XSetScreenSaver(tqt_xdisplay(), 0, mXInterval, PreferBlanking, DontAllowExposures);
startLockProcess( DefaultLock ); startLockProcess( DefaultLock );
}
} }
xautolock_corner_t SaverEngine::applyManualSettings(int action) xautolock_corner_t SaverEngine::applyManualSettings(int action)

Loading…
Cancel
Save