move autotype syntax warning and error dialogs from AutoType to DatabaseWidget in the gui folder and replaced it with a checkSyntax call.

this fixes part of why autotype test fails
This commit is contained in:
Marco 2017-05-31 21:23:33 +02:00 committed by thez3ro
parent 393017cf3b
commit 4893d99774
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
2 changed files with 29 additions and 27 deletions

View File

@ -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, QList<A
bool inTmpl = false;
m_autoTypeDelay = config()->get("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 == '{') {

View File

@ -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());
}