diff options
Diffstat (limited to 'src/autotype/AutoType.h')
-rw-r--r-- | src/autotype/AutoType.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/autotype/AutoType.h b/src/autotype/AutoType.h index 6f4a815f8..98a7bd7fa 100644 --- a/src/autotype/AutoType.h +++ b/src/autotype/AutoType.h @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2012 Felix Geyer <debfx@fobos.de> * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org> * @@ -22,6 +22,9 @@ #include <QObject> #include <QStringList> #include <QWidget> +#include <QMutex> + +#include "core/AutoTypeMatch.h" class AutoTypeAction; class AutoTypeExecutor; @@ -36,13 +39,19 @@ class AutoType : public QObject public: QStringList windowTitles(); - void performAutoType(const Entry* entry, QWidget* hideWindow = nullptr, - const QString& customSequence = QString(), WId window = 0); bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); void unregisterGlobalShortcut(); int callEventFilter(void* event); + static bool checkSyntax(const QString& string); + static bool checkHighRepetition(const QString& string); + static bool checkSlowKeypress(const QString& string); + static bool checkHighDelay(const QString& string); + static bool verifyAutoTypeSyntax(const QString& sequence); + void performAutoType(const Entry* entry, + QWidget* hideWindow = nullptr); - inline bool isAvailable() { + inline bool isAvailable() + { return m_plugin; } @@ -51,12 +60,15 @@ public: public slots: void performGlobalAutoType(const QList<Database*>& dbList); + void raiseWindow(); signals: void globalShortcutTriggered(); + void autotypePerformed(); + void autotypeRejected(); private slots: - void performAutoTypeFromGlobal(Entry* entry, const QString& sequence); + void performAutoTypeFromGlobal(AutoTypeMatch match); void resetInAutoType(); void unloadPlugin(); @@ -64,14 +76,18 @@ private: explicit AutoType(QObject* parent = nullptr, bool test = false); ~AutoType(); void loadPlugin(const QString& pluginPath); + void executeAutoTypeActions(const Entry* entry, + QWidget* hideWindow = nullptr, + const QString& customSequence = QString(), + WId window = 0); bool parseActions(const QString& sequence, const Entry* entry, QList<AutoTypeAction*>& actions); QList<AutoTypeAction*> createActionFromTemplate(const QString& tmpl, const Entry* entry); - QString autoTypeSequence(const Entry* entry, const QString& windowTitle = QString()); + QList<QString> autoTypeSequences(const Entry* entry, const QString& windowTitle = QString()); bool windowMatchesTitle(const QString& windowTitle, const QString& resolvedTitle); bool windowMatchesUrl(const QString& windowTitle, const QString& resolvedUrl); bool windowMatches(const QString& windowTitle, const QString& windowPattern); - bool m_inAutoType; + QMutex m_inAutoType; int m_autoTypeDelay; Qt::Key m_currentGlobalKey; Qt::KeyboardModifiers m_currentGlobalModifiers; @@ -84,7 +100,8 @@ private: Q_DISABLE_COPY(AutoType) }; -inline AutoType* autoType() { +inline AutoType* autoType() +{ return AutoType::instance(); } |