Only poll YubiKey for currently visible tab

This commit is contained in:
Janek Bevendorff 2017-02-21 02:19:11 +01:00
parent 8e91a89a37
commit 91761a2bea
No known key found for this signature in database
GPG Key ID: CFEC2F6850BFFA53
5 changed files with 15 additions and 15 deletions

View File

@ -102,6 +102,10 @@ void DatabaseOpenWidget::showEvent(QShowEvent* event)
{
DialogyWidget::showEvent(event);
m_ui->editPassword->setFocus();
#ifdef WITH_XC_YUBIKEY
pollYubikey();
#endif
}
void DatabaseOpenWidget::load(const QString& filename)
@ -118,11 +122,6 @@ void DatabaseOpenWidget::load(const QString& filename)
}
}
#ifdef WITH_XC_YUBIKEY
m_ui->comboChallengeResponse->clear();
pollYubikey();
#endif
m_ui->editPassword->setFocus();
}
@ -229,7 +228,7 @@ CompositeKey DatabaseOpenWidget::databaseKey()
void DatabaseOpenWidget::reject()
{
Q_EMIT editFinished(false);
emit editFinished(false);
}
void DatabaseOpenWidget::activatePassword()

View File

@ -41,18 +41,21 @@ public:
void enterKey(const QString& pw, const QString& keyFile);
Database* database();
Q_SIGNALS:
public slots:
void pollYubikey();
signals:
void editFinished(bool accepted);
protected:
void showEvent(QShowEvent* event) override;
CompositeKey databaseKey();
protected Q_SLOTS:
protected slots:
virtual void openDatabase();
void reject();
private Q_SLOTS:
private slots:
void activatePassword();
void activateKeyFile();
void activateChallengeResponse();
@ -60,10 +63,8 @@ private Q_SLOTS:
void browseKeyFile();
void yubikeyDetected(int slot, bool blocking);
void noYubikeyFound();
void pollYubikey();
protected:
const QScopedPointer<Ui::DatabaseOpenWidget> m_ui;
Database* m_db;
QString m_filename;

View File

@ -156,7 +156,7 @@
<item row="1" column="1">
<widget class="QPushButton" name="buttonRedetectYubikey">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Refresh</string>

View File

@ -53,7 +53,7 @@ const int DatabaseTabWidget::LastDatabasesCount = 5;
DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
: QTabWidget(parent)
, m_dbWidgetSateSync(new DatabaseWidgetStateSync(this))
, m_dbWidgetStateSync(new DatabaseWidgetStateSync(this))
{
DragTabBar* tabBar = new DragTabBar(this);
setTabBar(tabBar);
@ -61,7 +61,7 @@ DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeDatabase(int)));
connect(this, SIGNAL(currentChanged(int)), SLOT(emitActivateDatabaseChanged()));
connect(this, SIGNAL(activateDatabaseChanged(DatabaseWidget*)), m_dbWidgetSateSync, SLOT(setActive(DatabaseWidget*)));
connect(this, SIGNAL(activateDatabaseChanged(DatabaseWidget*)), m_dbWidgetStateSync, SLOT(setActive(DatabaseWidget*)));
connect(autoType(), SIGNAL(globalShortcutTriggered()), SLOT(performGlobalAutoType()));
}

View File

@ -116,7 +116,7 @@ private:
KeePass2Writer m_writer;
QHash<Database*, DatabaseManagerStruct> m_dbList;
DatabaseWidgetStateSync* m_dbWidgetSateSync;
DatabaseWidgetStateSync* m_dbWidgetStateSync;
};
#endif // KEEPASSX_DATABASETABWIDGET_H