From f33cd1541941a088b90f463d457f4a9f86aa712a Mon Sep 17 00:00:00 2001 From: Kyle Manna Date: Sat, 14 Jan 2017 17:08:48 -0800 Subject: [PATCH] gui: Clear YubiKeys detected on each load * 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/DatabaseOpenWidget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 5d3815963..0b63bc0fc 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -64,6 +64,10 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent) connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject())); + + connect(YubiKey::instance(), SIGNAL(detected(int,bool)), + SLOT(ykDetected(int,bool)), + Qt::QueuedConnection); } DatabaseOpenWidget::~DatabaseOpenWidget() @@ -92,10 +96,8 @@ void DatabaseOpenWidget::load(const QString& filename) m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); - /* 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->comboChallengeResponse->clear(); QtConcurrent::run(YubiKey::instance(), &YubiKey::detect); m_ui->editPassword->setFocus();