keepassxc

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

18
#include "AutoTypeTest.h"
19

20
bool AutoTypePlatformTest::isAvailable()
21
{
22
    return true;
23
}
24

25
QString AutoTypePlatformTest::keyToString(Qt::Key key)
26
{
27
    return QString("[Key0x%1]").arg(key, 0, 16);
28
}
29

30
QStringList AutoTypePlatformTest::windowTitles()
31
{
32
    return {};
33
}
34

35
WId AutoTypePlatformTest::activeWindow()
36
{
37
    return 0;
38
}
39

40
QString AutoTypePlatformTest::activeWindowTitle()
41
{
42
    return m_activeWindowTitle;
43
}
44

45
AutoTypeExecutor* AutoTypePlatformTest::createExecutor()
46
{
47
    return new AutoTypeExecutorTest(this);
48
}
49

50
void AutoTypePlatformTest::setActiveWindowTitle(const QString& title)
51
{
52
    m_activeWindowTitle = title;
53
}
54

55
QString AutoTypePlatformTest::actionChars()
56
{
57
    return m_actionChars;
58
}
59

60
int AutoTypePlatformTest::actionCount()
61
{
62
    return m_actionCount;
63
}
64

65
void AutoTypePlatformTest::clearActions()
66
{
67
    m_actionChars.clear();
68
    m_actionCount = 0;
69
}
70

71
void AutoTypePlatformTest::addAction(const AutoTypeKey* action)
72
{
73
    ++m_actionCount;
74
    if (action->key != Qt::Key_unknown) {
75
        m_actionChars += keyToString(action->key);
76
    } else {
77
        m_actionChars += action->character;
78
    }
79
}
80

81
bool AutoTypePlatformTest::raiseWindow(WId window)
82
{
83
    Q_UNUSED(window);
84

85
    return false;
86
}
87

88
#if defined(Q_OS_MACOS)
89
bool AutoTypePlatformTest::hideOwnWindow()
90
{
91
    return false;
92
}
93

94
bool AutoTypePlatformTest::raiseOwnWindow()
95
{
96
    return false;
97
}
98
#endif
99

100
AutoTypeExecutorTest::AutoTypeExecutorTest(AutoTypePlatformTest* platform)
101
    : m_platform(platform)
102
{
103
}
104

105
AutoTypeAction::Result AutoTypeExecutorTest::execBegin(const AutoTypeBegin* action)
106
{
107
    Q_UNUSED(action);
108
    return AutoTypeAction::Result::Ok();
109
}
110

111
AutoTypeAction::Result AutoTypeExecutorTest::execType(const AutoTypeKey* action)
112
{
113
    m_platform->addAction(action);
114
    return AutoTypeAction::Result::Ok();
115
}
116

117
AutoTypeAction::Result AutoTypeExecutorTest::execClearField(const AutoTypeClearField* action)
118
{
119
    Q_UNUSED(action);
120
    return AutoTypeAction::Result::Ok();
121
}
122

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

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

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

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