mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-10-10 20:48:27 -04:00
relock database after successful autotype
This commit is contained in:
parent
4206fd94e3
commit
b33259b1f2
8 changed files with 63 additions and 2 deletions
|
@ -143,6 +143,8 @@ QStringList AutoType::windowTitles()
|
|||
void AutoType::resetInAutoType()
|
||||
{
|
||||
m_inAutoType.unlock();
|
||||
|
||||
emit autotypeRejected();
|
||||
}
|
||||
|
||||
void AutoType::raiseWindow()
|
||||
|
@ -199,6 +201,7 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c
|
|||
{
|
||||
// no edit to the sequence beyond this point
|
||||
if (!verifyAutoTypeSyntax(sequence)) {
|
||||
emit autotypeRejected();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -206,6 +209,7 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c
|
|||
ListDeleter<AutoTypeAction*> actionsDeleter(&actions);
|
||||
|
||||
if (!parseActions(sequence, entry, actions)) {
|
||||
emit autotypeRejected();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -228,12 +232,16 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c
|
|||
for (AutoTypeAction* action : asConst(actions)) {
|
||||
if (m_plugin->activeWindow() != window) {
|
||||
qWarning("Active window changed, interrupting auto-type.");
|
||||
break;
|
||||
emit autotypeRejected();
|
||||
return;
|
||||
}
|
||||
|
||||
action->accept(m_executor);
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 10);
|
||||
}
|
||||
|
||||
// emit signal only if autotype performed correctly
|
||||
emit autotypePerformed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,6 +308,8 @@ void AutoType::performGlobalAutoType(const QList<Database*>& dbList)
|
|||
message.append("\n\n");
|
||||
message.append(windowTitle);
|
||||
MessageBox::information(nullptr, tr("Auto-Type - KeePassXC"), message);
|
||||
|
||||
emit autotypeRejected();
|
||||
} else if ((matchList.size() == 1) && !config()->get("security/autotypeask").toBool()) {
|
||||
executeAutoTypeActions(matchList.first().entry, nullptr, matchList.first().sequence);
|
||||
m_inAutoType.unlock();
|
||||
|
|
|
@ -64,6 +64,8 @@ public slots:
|
|||
|
||||
signals:
|
||||
void globalShortcutTriggered();
|
||||
void autotypePerformed();
|
||||
void autotypeRejected();
|
||||
|
||||
private slots:
|
||||
void performAutoTypeFromGlobal(AutoTypeMatch match);
|
||||
|
|
|
@ -35,6 +35,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
|
|||
: QDialog(parent)
|
||||
, m_view(new AutoTypeSelectView(this))
|
||||
, m_matchActivatedEmitted(false)
|
||||
, m_rejected(false)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
// Places the window on the active (virtual) desktop instead of where the main window is.
|
||||
|
@ -83,6 +84,13 @@ void AutoTypeSelectDialog::done(int r)
|
|||
QDialog::done(r);
|
||||
}
|
||||
|
||||
void AutoTypeSelectDialog::reject()
|
||||
{
|
||||
m_rejected = true;
|
||||
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void AutoTypeSelectDialog::emitMatchActivated(const QModelIndex& index)
|
||||
{
|
||||
// make sure we don't emit the signal twice when both activated() and clicked() are triggered
|
||||
|
@ -98,6 +106,10 @@ void AutoTypeSelectDialog::emitMatchActivated(const QModelIndex& index)
|
|||
|
||||
void AutoTypeSelectDialog::matchRemoved()
|
||||
{
|
||||
if (m_rejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_view->model()->rowCount() == 0) {
|
||||
reject();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ signals:
|
|||
|
||||
public slots:
|
||||
void done(int r) override;
|
||||
void reject() override;
|
||||
|
||||
private slots:
|
||||
void emitMatchActivated(const QModelIndex& index);
|
||||
|
@ -47,6 +48,7 @@ private slots:
|
|||
private:
|
||||
AutoTypeSelectView* const m_view;
|
||||
bool m_matchActivatedEmitted;
|
||||
bool m_rejected;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_AUTOTYPESELECTDIALOG_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue