mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-09-20 04:44:43 -04:00
Move initial auto-type timeout to plugins.
This commit is contained in:
parent
9144765d56
commit
bd90ba9326
8 changed files with 18 additions and 6 deletions
|
@ -34,7 +34,6 @@ AutoType* AutoType::m_instance = Q_NULLPTR;
|
||||||
|
|
||||||
AutoType::AutoType(QObject* parent, bool test)
|
AutoType::AutoType(QObject* parent, bool test)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_test(test)
|
|
||||||
, m_inAutoType(false)
|
, m_inAutoType(false)
|
||||||
, m_pluginLoader(new QPluginLoader(this))
|
, m_pluginLoader(new QPluginLoader(this))
|
||||||
, m_plugin(Q_NULLPTR)
|
, m_plugin(Q_NULLPTR)
|
||||||
|
@ -133,9 +132,7 @@ void AutoType::performAutoType(const Entry* entry, QWidget* hideWindow, const QS
|
||||||
hideWindow->showMinimized();
|
hideWindow->showMinimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_test) {
|
Tools::wait(m_plugin->initialTimeout());
|
||||||
Tools::wait(500);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
window = m_plugin->activeWindow();
|
window = m_plugin->activeWindow();
|
||||||
|
|
|
@ -69,7 +69,6 @@ private:
|
||||||
QString autoTypeSequence(const Entry* entry, const QString& windowTitle = QString());
|
QString autoTypeSequence(const Entry* entry, const QString& windowTitle = QString());
|
||||||
bool windowMatches(const QString& windowTitle, const QString& windowPattern);
|
bool windowMatches(const QString& windowTitle, const QString& windowPattern);
|
||||||
|
|
||||||
bool m_test;
|
|
||||||
bool m_inAutoType;
|
bool m_inAutoType;
|
||||||
Qt::Key m_currentGlobalKey;
|
Qt::Key m_currentGlobalKey;
|
||||||
Qt::KeyboardModifiers m_currentGlobalModifiers;
|
Qt::KeyboardModifiers m_currentGlobalModifiers;
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
virtual bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0;
|
virtual bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0;
|
||||||
virtual void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0;
|
virtual void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0;
|
||||||
virtual int platformEventFilter(void* event) = 0;
|
virtual int platformEventFilter(void* event) = 0;
|
||||||
|
virtual int initialTimeout() = 0;
|
||||||
|
|
||||||
virtual AutoTypeExecutor* createExecutor() = 0;
|
virtual AutoTypeExecutor* createExecutor() = 0;
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,10 @@ void AutoTypePlatformTest::addActionKey(AutoTypeKey* action)
|
||||||
m_actionChars.append(keyToString(action->key));
|
m_actionChars.append(keyToString(action->key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AutoTypePlatformTest::initialTimeout()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
AutoTypeExecturorTest::AutoTypeExecturorTest(AutoTypePlatformTest* platform)
|
AutoTypeExecturorTest::AutoTypeExecturorTest(AutoTypePlatformTest* platform)
|
||||||
: m_platform(platform)
|
: m_platform(platform)
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
int platformEventFilter(void* event);
|
int platformEventFilter(void* event);
|
||||||
|
int initialTimeout();
|
||||||
AutoTypeExecutor* createExecutor();
|
AutoTypeExecutor* createExecutor();
|
||||||
|
|
||||||
void setActiveWindowTitle(const QString& title);
|
void setActiveWindowTitle(const QString& title);
|
||||||
|
|
|
@ -798,4 +798,9 @@ void AutoTypeExecturorX11::execKey(AutoTypeKey* action)
|
||||||
m_platform->SendKeyPressedEvent(m_platform->keyToKeySym(action->key));
|
m_platform->SendKeyPressedEvent(m_platform->keyToKeySym(action->key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AutoTypePlatformX11::initialTimeout()
|
||||||
|
{
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2(keepassx-autotype-x11, AutoTypePlatformX11)
|
Q_EXPORT_PLUGIN2(keepassx-autotype-x11, AutoTypePlatformX11)
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
int platformEventFilter(void* event);
|
int platformEventFilter(void* event);
|
||||||
|
int initialTimeout();
|
||||||
AutoTypeExecutor* createExecutor();
|
AutoTypeExecutor* createExecutor();
|
||||||
|
|
||||||
KeySym charToKeySym(const QChar& ch);
|
KeySym charToKeySym(const QChar& ch);
|
||||||
|
|
|
@ -178,7 +178,11 @@ void sleep(int ms)
|
||||||
|
|
||||||
void wait(int ms)
|
void wait(int ms)
|
||||||
{
|
{
|
||||||
Q_ASSERT(ms > 0);
|
Q_ASSERT(ms >= 0);
|
||||||
|
|
||||||
|
if (ms == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
|
||||||
QElapsedTimer timer;
|
QElapsedTimer timer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue