mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-23 15:00:47 -04:00
Show a clear error if no slots on hardware key(s) are configured (#11609)
Fixes #11543 Also fix delayed polling on window activation --------- Co-authored-by: w15dev <w15developer@proton.me> Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
parent
8b24e48fde
commit
8a3de7334b
13 changed files with 89 additions and 58 deletions
|
@ -112,7 +112,7 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
|
|||
m_ui->hardwareKeyProgress->setSizePolicy(sp);
|
||||
|
||||
#ifdef WITH_XC_YUBIKEY
|
||||
connect(m_deviceListener, SIGNAL(devicePlugged(bool, void*, void*)), this, SLOT(pollHardwareKey()));
|
||||
connect(m_deviceListener, &DeviceListener::devicePlugged, this, [this] { pollHardwareKey(false, 500); });
|
||||
connect(YubiKey::instance(), SIGNAL(detectComplete(bool)), SLOT(hardwareKeyResponse(bool)), Qt::QueuedConnection);
|
||||
|
||||
connect(YubiKey::instance(), &YubiKey::userInteractionRequest, this, [this] {
|
||||
|
@ -152,7 +152,12 @@ void DatabaseOpenWidget::toggleHardwareKeyComponent(bool state)
|
|||
m_ui->hardwareKeyProgress->setVisible(false);
|
||||
m_ui->hardwareKeyComponent->setVisible(state);
|
||||
m_ui->hardwareKeyCombo->setVisible(state && m_ui->hardwareKeyCombo->count() != 1);
|
||||
|
||||
m_ui->noHardwareKeysFoundLabel->setVisible(!state && m_manualHardwareKeyRefresh);
|
||||
m_ui->noHardwareKeysFoundLabel->setText(YubiKey::instance()->connectedKeys() > 0
|
||||
? tr("Hardware keys found, but no slots are configured.")
|
||||
: tr("No hardware keys found."));
|
||||
|
||||
if (!state) {
|
||||
m_ui->useHardwareKeyCheckBox->setChecked(false);
|
||||
}
|
||||
|
@ -546,7 +551,7 @@ bool DatabaseOpenWidget::browseKeyFile()
|
|||
return true;
|
||||
}
|
||||
|
||||
void DatabaseOpenWidget::pollHardwareKey(bool manualTrigger)
|
||||
void DatabaseOpenWidget::pollHardwareKey(bool manualTrigger, int delay)
|
||||
{
|
||||
if (m_pollingHardwareKey) {
|
||||
return;
|
||||
|
@ -560,9 +565,6 @@ void DatabaseOpenWidget::pollHardwareKey(bool manualTrigger)
|
|||
m_pollingHardwareKey = true;
|
||||
m_manualHardwareKeyRefresh = manualTrigger;
|
||||
|
||||
// Add a delay, if this is an automatic trigger, to allow the USB device to settle as
|
||||
// the device may not report a valid serial number immediately after plugging in
|
||||
int delay = manualTrigger ? 0 : 500;
|
||||
QTimer::singleShot(delay, this, [] { YubiKey::instance()->findValidKeysAsync(); });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue