keepassxc

Форк
0
/
AutoTypeAction.cpp 
78 строк · 2.1 Кб
1
/*
2
 *  Copyright (C) 2021 Team KeePassXC <team@keepassxc.org>
3
 *  Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation, either version 2 or (at your option)
8
 *  version 3 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

19
#include "AutoTypeAction.h"
20

21
#include "core/Tools.h"
22

23
AutoTypeKey::AutoTypeKey(Qt::Key key, Qt::KeyboardModifiers modifiers)
24
    : key(key)
25
    , modifiers(modifiers)
26
{
27
}
28

29
AutoTypeKey::AutoTypeKey(const QChar& character, Qt::KeyboardModifiers modifiers)
30
    : character(character)
31
    , modifiers(modifiers)
32
{
33
}
34

35
AutoTypeAction::Result AutoTypeKey::exec(AutoTypeExecutor* executor) const
36
{
37
    return executor->execType(this);
38
}
39

40
AutoTypeDelay::AutoTypeDelay(int delayMs, bool setExecDelay)
41
    : delayMs(delayMs)
42
    , setExecDelay(setExecDelay)
43
{
44
}
45

46
AutoTypeAction::Result AutoTypeDelay::exec(AutoTypeExecutor* executor) const
47
{
48
    if (setExecDelay) {
49
        // Change the delay between actions
50
        executor->execDelayMs = delayMs;
51
    } else {
52
        // Pause execution
53
        Tools::wait(delayMs);
54
    }
55

56
    return AutoTypeAction::Result::Ok();
57
}
58

59
AutoTypeAction::Result AutoTypeClearField::exec(AutoTypeExecutor* executor) const
60
{
61
    return executor->execClearField(this);
62
}
63

64
AutoTypeAction::Result AutoTypeBegin::exec(AutoTypeExecutor* executor) const
65
{
66
    return executor->execBegin(this);
67
}
68

69
AutoTypeMode::AutoTypeMode(AutoTypeExecutor::Mode mode)
70
    : mode(mode)
71
{
72
}
73

74
AutoTypeAction::Result AutoTypeMode::exec(AutoTypeExecutor* executor) const
75
{
76
    executor->mode = mode;
77
    return AutoTypeAction::Result::Ok();
78
}
79

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.