Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-Type: Support multiple Xkb layouts #6247

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ AutoType::parseSequence(const QString& entrySequence, const Entry* entry, QStrin
const int maxRepetition = 100;

QList<QSharedPointer<AutoTypeAction>> actions;
actions << QSharedPointer<AutoTypeBegin>::create();
actions << QSharedPointer<AutoTypeDelay>::create(qMax(0, config()->get(Config::AutoTypeDelay).toInt()), true);

// Replace escaped braces with a template for easier regex
Expand Down
5 changes: 5 additions & 0 deletions src/autotype/AutoTypeAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ void AutoTypeClearField::exec(AutoTypeExecutor* executor) const
{
executor->execClearField(this);
}

void AutoTypeBegin::exec(AutoTypeExecutor* executor) const
{
executor->execBegin(this);
}
7 changes: 7 additions & 0 deletions src/autotype/AutoTypeAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ class KEEPASSXC_EXPORT AutoTypeClearField : public AutoTypeAction
void exec(AutoTypeExecutor* executor) const override;
};

class KEEPASSXC_EXPORT AutoTypeBegin : public AutoTypeAction
{
public:
void exec(AutoTypeExecutor* executor) const override;
};

class KEEPASSXC_EXPORT AutoTypeExecutor
{
public:
virtual ~AutoTypeExecutor() = default;
virtual void execBegin(const AutoTypeBegin* action) = 0;
virtual void execType(const AutoTypeKey* action) = 0;
virtual void execClearField(const AutoTypeClearField* action) = 0;

Expand Down
5 changes: 5 additions & 0 deletions src/autotype/mac/AutoTypeMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ AutoTypeExecutorMac::AutoTypeExecutorMac(AutoTypePlatformMac* platform)
{
}

void AutoTypeExecutorMac::execBegin(const AutoTypeBegin* action)
{
Q_UNUSED(action);
}

void AutoTypeExecutorMac::execType(const AutoTypeKey* action)
{
if (action->modifiers & Qt::ShiftModifier) {
Expand Down
1 change: 1 addition & 0 deletions src/autotype/mac/AutoTypeMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class AutoTypeExecutorMac : public AutoTypeExecutor
public:
explicit AutoTypeExecutorMac(AutoTypePlatformMac* platform);

void execBegin(const AutoTypeBegin* action) override;
void execType(const AutoTypeKey* action) override;
void execClearField(const AutoTypeClearField* action) override;

Expand Down
5 changes: 5 additions & 0 deletions src/autotype/test/AutoTypeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ AutoTypeExecutorTest::AutoTypeExecutorTest(AutoTypePlatformTest* platform)
{
}

void AutoTypeExecutorTest::execBegin(const AutoTypeBegin* action)
{
Q_UNUSED(action);
}

void AutoTypeExecutorTest::execType(const AutoTypeKey* action)
{
m_platform->addAction(action);
Expand Down
1 change: 1 addition & 0 deletions src/autotype/test/AutoTypeTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class AutoTypeExecutorTest : public AutoTypeExecutor
public:
explicit AutoTypeExecutorTest(AutoTypePlatformTest* platform);

void execBegin(const AutoTypeBegin* action) override;
void execType(const AutoTypeKey* action) override;
void execClearField(const AutoTypeClearField* action) override;

Expand Down
5 changes: 5 additions & 0 deletions src/autotype/windows/AutoTypeWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ AutoTypeExecutorWin::AutoTypeExecutorWin(AutoTypePlatformWin* platform)
{
}

void AutoTypeExecutorWin::execBegin(const AutoTypeBegin* action)
{
Q_UNUSED(action);
}

void AutoTypeExecutorWin::execType(const AutoTypeKey* action)
{
if (action->modifiers & Qt::ShiftModifier) {
Expand Down
1 change: 1 addition & 0 deletions src/autotype/windows/AutoTypeWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AutoTypeExecutorWin : public AutoTypeExecutor
public:
explicit AutoTypeExecutorWin(AutoTypePlatformWin* platform);

void execBegin(const AutoTypeBegin* action) override;
void execType(const AutoTypeKey* action) override;
void execClearField(const AutoTypeClearField* action) override;

Expand Down
Loading