mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
parent
ac108cd708
commit
753d1d50d0
@ -37,6 +37,7 @@ AutoType* AutoType::m_instance = nullptr;
|
|||||||
AutoType::AutoType(QObject* parent, bool test)
|
AutoType::AutoType(QObject* parent, bool test)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_inAutoType(false)
|
, m_inAutoType(false)
|
||||||
|
, m_autoTypeDelay(0)
|
||||||
, m_currentGlobalKey(static_cast<Qt::Key>(0))
|
, m_currentGlobalKey(static_cast<Qt::Key>(0))
|
||||||
, m_currentGlobalModifiers(0)
|
, m_currentGlobalModifiers(0)
|
||||||
, m_pluginLoader(new QPluginLoader(this))
|
, m_pluginLoader(new QPluginLoader(this))
|
||||||
@ -303,6 +304,8 @@ bool AutoType::parseActions(const QString& sequence, const Entry* entry, QList<A
|
|||||||
{
|
{
|
||||||
QString tmpl;
|
QString tmpl;
|
||||||
bool inTmpl = false;
|
bool inTmpl = false;
|
||||||
|
m_autoTypeDelay = 0;
|
||||||
|
|
||||||
|
|
||||||
for (const QChar& ch : sequence) {
|
for (const QChar& ch : sequence) {
|
||||||
// TODO: implement support for {{}, {}} and {DELAY=X}
|
// TODO: implement support for {{}, {}} and {DELAY=X}
|
||||||
@ -332,7 +335,17 @@ bool AutoType::parseActions(const QString& sequence, const Entry* entry, QList<A
|
|||||||
actions.append(new AutoTypeChar(ch));
|
actions.append(new AutoTypeChar(ch));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m_autoTypeDelay > 0) {
|
||||||
|
QList<AutoTypeAction*>::iterator i;
|
||||||
|
i = actions.begin();
|
||||||
|
while (i != actions.end()) {
|
||||||
|
++i;
|
||||||
|
if (i != actions.end()) {
|
||||||
|
i = actions.insert(i, new AutoTypeDelay(m_autoTypeDelay));
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +355,13 @@ QList<AutoTypeAction*> AutoType::createActionFromTemplate(const QString& tmpl, c
|
|||||||
int num = -1;
|
int num = -1;
|
||||||
QList<AutoTypeAction*> list;
|
QList<AutoTypeAction*> list;
|
||||||
|
|
||||||
|
QRegExp delayRegEx("delay=(\\d+)", Qt::CaseSensitive, QRegExp::RegExp2);
|
||||||
|
if (delayRegEx.exactMatch(tmplName)) {
|
||||||
|
num = delayRegEx.cap(1).toInt();
|
||||||
|
m_autoTypeDelay = std::max(0, std::min(num, 10000));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
QRegExp repeatRegEx("(.+) (\\d+)", Qt::CaseSensitive, QRegExp::RegExp2);
|
QRegExp repeatRegEx("(.+) (\\d+)", Qt::CaseSensitive, QRegExp::RegExp2);
|
||||||
if (repeatRegEx.exactMatch(tmplName)) {
|
if (repeatRegEx.exactMatch(tmplName)) {
|
||||||
tmplName = repeatRegEx.cap(1);
|
tmplName = repeatRegEx.cap(1);
|
||||||
|
@ -69,6 +69,7 @@ private:
|
|||||||
bool windowMatches(const QString& windowTitle, const QString& windowPattern);
|
bool windowMatches(const QString& windowTitle, const QString& windowPattern);
|
||||||
|
|
||||||
bool m_inAutoType;
|
bool m_inAutoType;
|
||||||
|
int m_autoTypeDelay;
|
||||||
Qt::Key m_currentGlobalKey;
|
Qt::Key m_currentGlobalKey;
|
||||||
Qt::KeyboardModifiers m_currentGlobalModifiers;
|
Qt::KeyboardModifiers m_currentGlobalModifiers;
|
||||||
QPluginLoader* m_pluginLoader;
|
QPluginLoader* m_pluginLoader;
|
||||||
|
Loading…
Reference in New Issue
Block a user