mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-25 15:55:38 -04:00
Make the purpose of the key file field clearer.
The new unlock dialogue seems to confuse users as to what the purpose of the key file is. This patch changes the generic "Select file..." affordance to the more explicit "Select key file..." and adds a help button to the label just like the one we already have for the hardware key. Furthermore, it prevents the user from using the KDBX file as its own key file (since that would never work anyway). The change breaks existing translations on purpose (instead of simply adjusting the en_US locale) in order to force translators to update this string for their languages. Resolves #3678
This commit is contained in:
parent
1722397040
commit
5d2766e016
3 changed files with 107 additions and 62 deletions
|
@ -65,6 +65,8 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
|
|||
|
||||
m_ui->hardwareKeyLabelHelp->setIcon(filePath()->icon("actions", "system-help").pixmap(QSize(12, 12)));
|
||||
connect(m_ui->hardwareKeyLabelHelp, SIGNAL(clicked(bool)), SLOT(openHardwareKeyHelp()));
|
||||
m_ui->keyFileLabelHelp->setIcon(filePath()->icon("actions", "system-help").pixmap(QSize(12, 12)));
|
||||
connect(m_ui->keyFileLabelHelp, SIGNAL(clicked(bool)), SLOT(openKeyFileHelp()));
|
||||
|
||||
connect(m_ui->comboKeyFile->lineEdit(), SIGNAL(textChanged(QString)), SLOT(handleKeyFileComboEdited()));
|
||||
connect(m_ui->comboKeyFile, SIGNAL(currentIndexChanged(int)), SLOT(handleKeyFileComboChanged()));
|
||||
|
@ -148,7 +150,7 @@ void DatabaseOpenWidget::load(const QString& filename)
|
|||
m_filename = filename;
|
||||
m_ui->fileNameLabel->setRawText(m_filename);
|
||||
|
||||
m_ui->comboKeyFile->addItem(tr("Select file..."), -1);
|
||||
m_ui->comboKeyFile->addItem(tr("Select key file..."), -1);
|
||||
m_ui->comboKeyFile->setCurrentIndex(0);
|
||||
m_ui->keyFileClearIcon->setVisible(false);
|
||||
m_keyFileComboEdited = false;
|
||||
|
@ -365,6 +367,13 @@ void DatabaseOpenWidget::browseKeyFile()
|
|||
}
|
||||
QString filename = fileDialog()->getOpenFileName(this, tr("Select key file"), QString(), filters);
|
||||
|
||||
if (QFileInfo(filename).canonicalFilePath() == QFileInfo(m_filename).canonicalFilePath()) {
|
||||
MessageBox::warning(this, tr("Cannot use database file as key file"),
|
||||
tr("You cannot use your database file as a key file.\nIf you do not have a key file, please leave the field empty."),
|
||||
MessageBox::Button::Ok);
|
||||
filename = "";
|
||||
}
|
||||
|
||||
if (!filename.isEmpty()) {
|
||||
m_ui->comboKeyFile->setCurrentIndex(-1);
|
||||
m_ui->comboKeyFile->setEditText(filename);
|
||||
|
@ -433,5 +442,10 @@ void DatabaseOpenWidget::noYubikeyFound()
|
|||
|
||||
void DatabaseOpenWidget::openHardwareKeyHelp()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://keepassxc.org/docs#hwtoken"));
|
||||
}
|
||||
QDesktopServices::openUrl(QUrl("https://keepassxc.org/docs#faq-cat-yubikey"));
|
||||
}
|
||||
|
||||
void DatabaseOpenWidget::openKeyFileHelp()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://keepassxc.org/docs#faq-cat-keyfile"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue