Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CTRL+Enter to apply password generator changes #6414

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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