add a method to perform the autotype sequence showing graphical dialogs
Dialogs are show when the syntax of the autotype statement is wrong or contains long delays or statements which are repeated very often
This commit is contained in:
@@ -252,7 +252,8 @@ void AutoType::performAutoTypeFromGlobal(Entry* entry, const QString& sequence)
|
||||
m_plugin->raiseWindow(m_windowFromGlobal);
|
||||
|
||||
m_inAutoType = false;
|
||||
performAutoType(entry, nullptr, sequence, m_windowFromGlobal);
|
||||
|
||||
performAutoTypeWithSyntaxCheckingDialog(entry, nullptr, sequence, m_windowFromGlobal);
|
||||
}
|
||||
|
||||
void AutoType::resetInAutoType()
|
||||
@@ -714,3 +715,38 @@ bool AutoType::checkHighRepetition(const QString &string)
|
||||
highRepetition.setPatternSyntax(QRegExp::RegExp);
|
||||
return highRepetition.exactMatch(string);
|
||||
}
|
||||
|
||||
void
|
||||
AutoType::performAutoTypeWithSyntaxCheckingDialog(const Entry *entry,
|
||||
QWidget *hideWindow,
|
||||
const QString &customSequence,
|
||||
WId window)
|
||||
{
|
||||
if (!AutoType::checkSyntax(entry->effectiveAutoTypeSequence())) {
|
||||
QMessageBox messageBox;
|
||||
messageBox.critical(0, "AutoType", tr("The Syntax of your AutoType statement is incorrect!"));
|
||||
return;
|
||||
}
|
||||
else if (AutoType::checkHighDelay(entry->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(entry->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;
|
||||
}
|
||||
}
|
||||
performAutoType(entry, hideWindow, customSequence, window);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user