Branch: master

a2af4533 2015-09-19 17:50:30 Timothy Pearson
Fix card unlock
M kdesktop/lock/lockdlg.cc
M kdesktop/lock/lockdlg.h
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc
index 3ae0efa..677b412 100644
--- a/kdesktop/lock/lockdlg.cc
+++ b/kdesktop/lock/lockdlg.cc
@@ -82,7 +82,8 @@
 	mCapsLocked(-1),
 	mUnlockingFailed(false),
 	validUserCardInserted(false),
-	showInfoMessages(true)
+	showInfoMessages(true),
+	mCardLoginInProgress(false)
 {
 	init(plugin);
 }
@@ -96,7 +97,8 @@
 	mPlugin( plugin ),
 	mCapsLocked(-1),
 	mUnlockingFailed(false),
-	showInfoMessages(true)
+	showInfoMessages(true),
+	mCardLoginInProgress(false)
 {
 	m_lockStartDT = lockStartDateTime;
 	init(plugin);
@@ -953,6 +955,11 @@
 }
 
 void PasswordDlg::attemptCardLogin() {
+	if (mCardLoginInProgress) {
+		return;
+	}
+	mCardLoginInProgress = true;
+
 	// FIXME
 	// pam_pkcs11 is extremely chatty with no apparent way to disable the unwanted messages
 	greet->setInfoMessageDisplay(false);
@@ -965,12 +972,13 @@
 	setFixedSize(sizeHint());
 
 	// Attempt authentication if configured
-	TDECryptographicCardDevice* cdevice = static_cast< LockProcess* >(parent())->cryptographicCardDevice();
+	TDECryptographicCardDevice* cdevice = static_cast<LockProcess*>(parent())->cryptographicCardDevice();
 	if (cdevice) {
 		TQString autoPIN = cdevice->autoPIN();
 		if (autoPIN != TQString::null) {
+			greet->start();
 			greet->setPassword(autoPIN);
-			greet->next();
+			TQTimer::singleShot(0, this, SLOT(slotOK()));
 		}
 	}
 }
@@ -987,6 +995,8 @@
 
 	// Restore information message display settings
         greet->setInfoMessageDisplay(showInfoMessages);
+
+	mCardLoginInProgress = false;
 }
 
 #include "lockdlg.moc"
diff --git a/kdesktop/lock/lockdlg.h b/kdesktop/lock/lockdlg.h
index fb28d53..571d825 100644
--- a/kdesktop/lock/lockdlg.h
+++ b/kdesktop/lock/lockdlg.h
@@ -100,6 +100,7 @@
 		TQStringList::iterator currLayout;
 		int         sPid, sFd;
 		TQListView   *lv;
+		bool         mCardLoginInProgress;
 		TQDateTime   m_lockStartDT;
 };