mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 22:17:39 +03:00
Add keypress handler to the password generator widget so that esc quits
in standalone mode.
This commit is contained in:
parent
5584481bef
commit
8f48ede957
2 changed files with 18 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <QLineEdit>
|
||||
#include <QDir>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/PasswordGenerator.h"
|
||||
|
@ -149,6 +150,20 @@ void PasswordGeneratorWidget::setStandaloneMode(bool standalone)
|
|||
}
|
||||
}
|
||||
|
||||
void PasswordGeneratorWidget::keyPressEvent(QKeyEvent* e)
|
||||
{
|
||||
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
|
||||
if (e->key() == Qt::Key_Escape && m_standalone == true) {
|
||||
emit dialogTerminated();
|
||||
} else {
|
||||
e->ignore();
|
||||
}
|
||||
}
|
||||
else {
|
||||
e->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void PasswordGeneratorWidget::regeneratePassword()
|
||||
{
|
||||
if (m_ui->tabWidget->currentIndex() == Password) {
|
||||
|
|
|
@ -81,6 +81,9 @@ private:
|
|||
const QScopedPointer<PasswordGenerator> m_passwordGenerator;
|
||||
const QScopedPointer<PassphraseGenerator> m_dicewareGenerator;
|
||||
const QScopedPointer<Ui::PasswordGeneratorWidget> m_ui;
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* e) override;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_PASSWORDGENERATORWIDGET_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue