mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04: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
@ -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…
Reference in New Issue
Block a user