diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 0d76e3de9..fbe64b456 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -145,6 +145,10 @@ void AutoType::performAutoType(const Entry* entry, QWidget* hideWindow, const QS sequence = customSequence; } + if (!checkSyntax(sequence)) { + return; + } + sequence.replace("{{}", "{LEFTBRACE}"); sequence.replace("{}}", "{RIGHTBRACE}"); @@ -328,33 +332,6 @@ bool AutoType::parseActions(const QString& sequence, const Entry* entry, QListget("AutoTypeDelay").toInt(); - - if (!AutoType::checkSyntax(sequence)) { - QMessageBox messageBox; - messageBox.critical(0, "AutoType", tr("The Syntax of your AutoType statement is incorrect!")); - return false; - } - else if (AutoType::checkHighDelay(sequence)) { - QMessageBox::StandardButton reply; - reply = QMessageBox::question(0, - "AutoType", - tr("This AutoType command contains a very long delay. Do you really want to execute it?")); - - if (reply == QMessageBox::No) { - return false; - } - } - else if (AutoType::checkHighRepetition(sequence)) { - QMessageBox::StandardButton reply; - reply = QMessageBox::question(0, - "AutoType", - tr("This AutoType command contains arguments which are repeated very often. Do you really want to execute it?")); - - if (reply == QMessageBox::No) { - return false; - } - } - for (const QChar &ch : sequence) { if (inTmpl) { if (ch == '{') { diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 1ef91a4fc..3fe403fc7 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -584,6 +584,31 @@ void DatabaseWidget::performAutoType() return; } + if (!AutoType::checkSyntax(currentEntry->effectiveAutoTypeSequence())) { + QMessageBox messageBox; + messageBox.critical(0, "AutoType", tr("The Syntax of your AutoType statement is incorrect!")); + return; + } + else if (AutoType::checkHighDelay(currentEntry->effectiveAutoTypeSequence())) { + QMessageBox::StandardButton reply; + reply = QMessageBox::question(0, + "AutoType", + tr("This AutoType command contains a very long delay. Do you really want to execute it?")); + + if (reply == QMessageBox::No) { + return; + } + } + else if (AutoType::checkHighRepetition(currentEntry->effectiveAutoTypeSequence())) { + QMessageBox::StandardButton reply; + reply = QMessageBox::question(0, + "AutoType", + tr("This AutoType command contains arguments which are repeated very often. Do you really want to execute it?")); + + if (reply == QMessageBox::No) { + return; + } + } autoType()->performAutoType(currentEntry, window()); }