From a7cf39c7cd07fd27eb3d521403ad92d69ef4cf74 Mon Sep 17 00:00:00 2001 From: Kyle Manna Date: Sat, 14 Jan 2017 17:36:14 -0800 Subject: [PATCH] gui: ChangeMasterKeyWidget: Clear YubiKeys detected * Clear the YubiKey detected list on each load. * In the event the YubiKey was removed, it will no longer be displayed. * If it's still present it won't be duplicated. --- src/gui/ChangeMasterKeyWidget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/ChangeMasterKeyWidget.cpp b/src/gui/ChangeMasterKeyWidget.cpp index c69cf2dcc..f2cf3b8d9 100644 --- a/src/gui/ChangeMasterKeyWidget.cpp +++ b/src/gui/ChangeMasterKeyWidget.cpp @@ -41,6 +41,10 @@ ChangeMasterKeyWidget::ChangeMasterKeyWidget(QWidget* parent) m_ui->repeatPasswordEdit->enableVerifyMode(m_ui->enterPasswordEdit); connect(m_ui->createKeyFileButton, SIGNAL(clicked()), SLOT(createKeyFile())); connect(m_ui->browseKeyFileButton, SIGNAL(clicked()), SLOT(browseKeyFile())); + + connect(YubiKey::instance(), SIGNAL(detected(int,bool)), + SLOT(ykDetected(int,bool)), + Qt::QueuedConnection); } ChangeMasterKeyWidget::~ChangeMasterKeyWidget() @@ -88,10 +92,8 @@ void ChangeMasterKeyWidget::clearForms() m_ui->challengeResponseGroup->setChecked(false); m_ui->challengeResponseCombo->clear(); - /* YubiKey init is slow */ - connect(YubiKey::instance(), SIGNAL(detected(int,bool)), - SLOT(ykDetected(int,bool)), - Qt::QueuedConnection); + /* YubiKey init is slow, detect asynchronously to not block the UI */ + m_ui->challengeResponseCombo->clear(); QtConcurrent::run(YubiKey::instance(), &YubiKey::detect); m_ui->enterPasswordEdit->setFocus();