Skip to content

Commit

Permalink
Add CTRL+Enter to apply password generator changes (#6414)
Browse files Browse the repository at this point in the history
* Fixes #6111
  • Loading branch information
xvallspl authored Apr 19, 2021
1 parent 7fe0e26 commit c0ae130
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/topics/PasswordGenerator.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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[]
7 changes: 7 additions & 0 deletions src/gui/PasswordGeneratorWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QDir>
#include <QKeyEvent>
#include <QLineEdit>
#include <QShortcut>
#include <QTimer>

#include "core/Config.h"
Expand All @@ -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)));
Expand Down
3 changes: 0 additions & 3 deletions src/gui/PasswordGeneratorWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,6 @@ QProgressBar::chunk {
<property name="text">
<string>Apply Password</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
<property name="default">
<bool>true</bool>
</property>
Expand Down

0 comments on commit c0ae130

Please sign in to comment.