on 16fa310 help sign in
unity8/tests/mocks/AccountsService/AccountsService.h
171 lines 6.5 kB history raw
1/*
2 * Copyright (C) 2013, 2015 Canonical, Ltd.
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; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef UNITY_MOCK_ACCOUNTSSERVICE_H
18#define UNITY_MOCK_ACCOUNTSSERVICE_H
20#include <QObject>
21#include <QString>
22#include <QStringList>
23#include <QVariant>
25class MockUsersModel;
27class AccountsService: public QObject
29 Q_OBJECT
30 Q_ENUMS(PasswordDisplayHint)
31 Q_PROPERTY (QString user
32 READ user
33 WRITE setUser
34 NOTIFY userChanged)
35 Q_PROPERTY (bool demoEdges
36 READ demoEdges
37 WRITE setDemoEdges
38 NOTIFY demoEdgesChanged)
39 Q_PROPERTY (QStringList demoEdgesCompleted
40 READ demoEdgesCompleted
41 WRITE setDemoEdgesCompleted // only available in mock
42 NOTIFY demoEdgesCompletedChanged)
43 Q_PROPERTY (bool enableFingerprintIdentification
44 READ enableFingerprintIdentification
45 WRITE setEnableFingerprintIdentification // only available in mock
46 NOTIFY enableFingerprintIdentificationChanged)
47 Q_PROPERTY (bool enableLauncherWhileLocked
48 READ enableLauncherWhileLocked
49 WRITE setEnableLauncherWhileLocked // only available in mock
50 NOTIFY enableLauncherWhileLockedChanged)
51 Q_PROPERTY (bool enableIndicatorsWhileLocked
52 READ enableIndicatorsWhileLocked
53 WRITE setEnableIndicatorsWhileLocked // only available in mock
54 NOTIFY enableIndicatorsWhileLockedChanged)
55 Q_PROPERTY (QString backgroundFile
56 READ backgroundFile
57 WRITE setBackgroundFile // only available in mock
58 NOTIFY backgroundFileChanged)
59 Q_PROPERTY (bool statsWelcomeScreen
60 READ statsWelcomeScreen
61 WRITE setStatsWelcomeScreen // only available in mock
62 NOTIFY statsWelcomeScreenChanged)
63 Q_PROPERTY (PasswordDisplayHint passwordDisplayHint
64 READ passwordDisplayHint
65 NOTIFY passwordDisplayHintChanged)
66 Q_PROPERTY (uint failedLogins
67 READ failedLogins
68 WRITE setFailedLogins
69 NOTIFY failedLoginsChanged)
70 Q_PROPERTY (uint failedFingerprintLogins
71 READ failedFingerprintLogins
72 WRITE setFailedFingerprintLogins
73 NOTIFY failedFingerprintLoginsChanged)
74 Q_PROPERTY(bool hereEnabled
75 READ hereEnabled
76 WRITE setHereEnabled
77 NOTIFY hereEnabledChanged)
78 Q_PROPERTY(QString hereLicensePath
79 READ hereLicensePath
80 WRITE setHereLicensePath // only available in mock
81 NOTIFY hereLicensePathChanged)
82 Q_PROPERTY(bool hereLicensePathValid // qml sees a null string as "", so we use proxy setting for that
83 READ hereLicensePathValid
84 NOTIFY hereLicensePathChanged)
85 Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged)
86 Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged)
87 Q_PROPERTY(QStringList keymaps
88 READ keymaps
89 WRITE setKeymaps
90 NOTIFY keymapsChanged)
92public:
93 enum PasswordDisplayHint {
94 Keyboard,
95 Numeric
96 };
98 explicit AccountsService(QObject *parent = 0);
100 QString user() const;
101 void setUser(const QString &user);
102 bool demoEdges() const;
103 void setDemoEdges(bool demoEdges);
104 QStringList demoEdgesCompleted() const;
105 void setDemoEdgesCompleted(const QStringList &demoEdges);
106 Q_INVOKABLE void markDemoEdgeCompleted(const QString &edge);
107 bool enableFingerprintIdentification() const;
108 void setEnableFingerprintIdentification(bool enableFingerprintIdentification);
109 bool enableLauncherWhileLocked() const;
110 void setEnableLauncherWhileLocked(bool enableLauncherWhileLocked);
111 bool enableIndicatorsWhileLocked() const;
112 void setEnableIndicatorsWhileLocked(bool enableIndicatorsWhileLocked);
113 QString backgroundFile() const;
114 void setBackgroundFile(const QString &backgroundFile);
115 bool statsWelcomeScreen() const;
116 void setStatsWelcomeScreen(bool statsWelcomeScreen);
117 PasswordDisplayHint passwordDisplayHint() const;
118 uint failedLogins() const;
119 void setFailedLogins(uint failedLogins);
120 uint failedFingerprintLogins() const;
121 void setFailedFingerprintLogins(uint failedFingerprintLogins);
122 bool hereEnabled() const;
123 void setHereEnabled(bool enabled);
124 QString hereLicensePath() const;
125 void setHereLicensePath(const QString &path);
126 bool hereLicensePathValid() const;
127 QString realName() const;
128 void setRealName(const QString &realName);
129 QString email() const;
130 void setEmail(const QString &email);
131 QStringList keymaps() const;
132 void setKeymaps(const QStringList &keymaps);
134Q_SIGNALS:
135 void userChanged();
136 void demoEdgesChanged();
137 void demoEdgesCompletedChanged();
138 void enableFingerprintIdentificationChanged();
139 void enableLauncherWhileLockedChanged();
140 void enableIndicatorsWhileLockedChanged();
141 void backgroundFileChanged();
142 void statsWelcomeScreenChanged();
143 void passwordDisplayHintChanged();
144 void failedLoginsChanged();
145 void failedFingerprintLoginsChanged();
146 void hereEnabledChanged();
147 void hereLicensePathChanged();
148 void realNameChanged();
149 void emailChanged();
150 void keymapsChanged();
152private:
153 bool m_enableFingerprintIdentification;
154 bool m_enableLauncherWhileLocked;
155 bool m_enableIndicatorsWhileLocked;
156 QString m_backgroundFile;
157 QString m_user;
158 bool m_statsWelcomeScreen;
159 uint m_failedLogins;
160 uint m_failedFingerprintLogins;
161 bool m_demoEdges;
162 QStringList m_demoEdgesCompleted;
163 bool m_hereEnabled;
164 QString m_hereLicensePath;
165 QString m_realName;
166 QStringList m_kbdMap;
167 QString m_email;
168 MockUsersModel *m_usersModel;
169};
171#endif