From c0ae130656518c4fb8561452cad6efebfc9b9af4 Mon Sep 17 00:00:00 2001 From: Xavier Valls Date: Mon, 19 Apr 2021 04:37:12 +0200 Subject: [PATCH] Add CTRL+Enter to apply password generator changes (#6414) * Fixes #6111 --- docs/topics/PasswordGenerator.adoc | 4 +++- src/gui/PasswordGeneratorWidget.cpp | 7 +++++++ src/gui/PasswordGeneratorWidget.ui | 3 --- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/topics/PasswordGenerator.adoc b/docs/topics/PasswordGenerator.adoc index ea05000e..57cad1fe 100644 --- a/docs/topics/PasswordGenerator.adoc +++ b/docs/topics/PasswordGenerator.adoc @@ -22,10 +22,11 @@ image::password_generator.png[] 5. Use the regenerate button (Ctrl + R) to make a new password using the chosen options. 6. Use the clipboard button (Ctrl + C) to copy the generated password to the clipboard. // tag::advanced[] -7. Click the Advanced button to specify additional conditions for your desired password. +7. Click the Advanced button to specify additional conditions for your desired password. + .Advanced Password Generator Options image::password_generator_advanced.png[] +8. When generating a password for an entry, click the Apply Password button (Ctrl + S or Ctrl + Enter) to close the window and apply your changes. === Generating Passphrases A passphrase is a sequence of words or other text used to control access to your applications and data. A passphrase is similar to a password in usage, but is generally longer for added security. To generate the random passphrase using Password Generator, perform the following steps: @@ -40,5 +41,6 @@ Word Count slider. 3. In the Word Separator field, enter a character, word, number, or space that you want to use a separator between the words in your passphrase. 4. Click the Regenerate button (Ctrl + R) to generate a new random passphrase. 5. Click the Clipboard button (Ctrl + C) to copy the passphrase to the clipboard. +6. When generating a password for an entry, click the Apply Password button (Ctrl + S or Ctrl + Enter) to close the window and apply your changes. // end::advanced[] // end::content[] diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp index 801da861..fd8c7a45 100644 --- a/src/gui/PasswordGeneratorWidget.cpp +++ b/src/gui/PasswordGeneratorWidget.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "core/Config.h" @@ -46,6 +47,12 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent) m_ui->buttonCopy->setIcon(icons()->icon("clipboard-text")); m_ui->buttonClose->setShortcut(Qt::Key_Escape); + // Add two shortcuts to save the form CTRL+Enter and CTRL+S + auto shortcut = new QShortcut(Qt::CTRL + Qt::Key_Return, this); + connect(shortcut, &QShortcut::activated, this, [this] { applyPassword(); }); + shortcut = new QShortcut(Qt::CTRL + Qt::Key_S, this); + connect(shortcut, &QShortcut::activated, this, [this] { applyPassword(); }); + connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updateButtonsEnabled(QString))); connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updatePasswordStrength(QString))); connect(m_ui->buttonAdvancedMode, SIGNAL(toggled(bool)), SLOT(setAdvancedMode(bool))); diff --git a/src/gui/PasswordGeneratorWidget.ui b/src/gui/PasswordGeneratorWidget.ui index 7cc562bc..01ccedc0 100644 --- a/src/gui/PasswordGeneratorWidget.ui +++ b/src/gui/PasswordGeneratorWidget.ui @@ -933,9 +933,6 @@ QProgressBar::chunk { Apply Password - - Ctrl+S - true