Skip to content

Commit

Permalink
change inAutotype logic, preventing multiple autotype call
Browse files Browse the repository at this point in the history
  • Loading branch information
TheZ3ro committed Jan 24, 2018
1 parent 683d119 commit 354727c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,20 @@ int AutoType::callEventFilter(void* event)
*/
void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, const QString& sequence, WId window)
{
Q_ASSERT(m_inAutoType);
if (!m_inAutoType) {
return;
}

// no edit to the sequence beyond this point
if (!verifyAutoTypeSyntax(sequence)) {
m_inAutoType = false; // TODO: make this automatic
return;
}

QList<AutoTypeAction*> actions;
ListDeleter<AutoTypeAction*> actionsDeleter(&actions);

if (!parseActions(sequence, entry, actions)) {
m_inAutoType = false; // TODO: make this automatic
return;
}

Expand Down Expand Up @@ -241,8 +244,6 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c
action->accept(m_executor);
QCoreApplication::processEvents(QEventLoop::AllEvents, 10);
}

m_inAutoType = false;
}

/**
Expand All @@ -263,6 +264,8 @@ void AutoType::performAutoType(const Entry* entry, QWidget* hideWindow)
m_inAutoType = true;

executeAutoTypeActions(entry, hideWindow, sequences.first());

m_inAutoType = false;
}

/**
Expand Down Expand Up @@ -304,8 +307,8 @@ void AutoType::performGlobalAutoType(const QList<Database*>& dbList)
message.append(windowTitle);
MessageBox::information(nullptr, tr("Auto-Type - KeePassXC"), message);
} else if ((matchList.size() == 1) && !config()->get("security/autotypeask").toBool()) {
m_inAutoType = false;
executeAutoTypeActions(matchList.first().entry, nullptr, matchList.first().sequence);
m_inAutoType = false;
} else {
m_windowFromGlobal = m_plugin->activeWindow();
AutoTypeSelectDialog* selectDialog = new AutoTypeSelectDialog();
Expand All @@ -329,9 +332,9 @@ void AutoType::performAutoTypeFromGlobal(AutoTypeMatch match)

m_plugin->raiseWindow(m_windowFromGlobal);

m_inAutoType = false;

executeAutoTypeActions(match.entry, nullptr, match.sequence, m_windowFromGlobal);

m_inAutoType = false;
}

/**
Expand Down

0 comments on commit 354727c

Please sign in to comment.