diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 1cadc5e2..b15db7b9 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -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")); -} \ No newline at end of file + QDesktopServices::openUrl(QUrl("https://keepassxc.org/docs#faq-cat-yubikey")); +} + +void DatabaseOpenWidget::openKeyFileHelp() +{ + QDesktopServices::openUrl(QUrl("https://keepassxc.org/docs#faq-cat-keyfile")); +} diff --git a/src/gui/DatabaseOpenWidget.h b/src/gui/DatabaseOpenWidget.h index 1ea05ca9..aa0a4315 100644 --- a/src/gui/DatabaseOpenWidget.h +++ b/src/gui/DatabaseOpenWidget.h @@ -68,6 +68,7 @@ private slots: void yubikeyDetectComplete(); void noYubikeyFound(); void openHardwareKeyHelp(); + void openKeyFileHelp(); protected: const QScopedPointer m_ui; diff --git a/src/gui/DatabaseOpenWidget.ui b/src/gui/DatabaseOpenWidget.ui index ac60413b..14a1337c 100644 --- a/src/gui/DatabaseOpenWidget.ui +++ b/src/gui/DatabaseOpenWidget.ui @@ -2,14 +2,6 @@ DatabaseOpenWidget - - - 0 - 0 - 592 - 462 - - Unlock KeePassXC Database @@ -210,7 +202,7 @@ - Enter Additional Credentials: + Enter Additional Credentials (if any): @@ -243,32 +235,6 @@ 3 - - - - 0 - - - - - true - - - - 0 - 0 - - - - Key file selection - - - true - - - - - @@ -330,26 +296,36 @@ - - - - true + + + + 0 - - Refresh hardware tokens - - - Refresh hardware tokens - - - Refresh - - + + + + true + + + + 0 + 0 + + + + Key file selection + + + true + + + + - 0 + 5 @@ -368,16 +344,16 @@ <p>You can use a hardware security key such as a <strong>YubiKey</strong> or <strong>OnlyKey</strong> with slots configured for HMAC-SHA1.</p> - <p>Click for more information...</p> +<p>Click for more information...</p> Hardware key help QToolButton { - border: none; - background: none; - } + border: none; + background: none; +} ? @@ -396,12 +372,66 @@ - - - Key File: + + + 5 - - comboKeyFile + + + + Key File: + + + comboKeyFile + + + + + + + PointingHandCursor + + + <p>In addition to your master password, you can use a secret file to enhance the security of your database. Such a file can be generated in your database's security settings.</p><p>This is <strong>not</strong> your *.kdbx database file!<br>If you do not have a key file, leave the field empty.</p><p>Click for more information...</p> + + + Key file help + + + QToolButton { + border: none; + background: none; +} + + + ? + + + + 12 + 12 + + + + QToolButton::InstantPopup + + + + + + + + + true + + + Refresh hardware tokens + + + Refresh hardware tokens + + + Refresh