2 * Copyright (C) 2013, 2015 Canonical, Ltd.
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.
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.
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/>.
17#include "AccountsService.h"
21AccountsService::AccountsService(QObject* parent)
23 m_enableFingerprintIdentification(false),
24 m_enableLauncherWhileLocked(true),
25 m_enableIndicatorsWhileLocked(true),
26 m_backgroundFile(qmlDirectory() + "/graphics/phone_background.jpg"),
27 m_statsWelcomeScreen(true),
30 m_demoEdgesCompleted(),
36QString AccountsService::user() const
41void AccountsService::setUser(const QString &user)
45 Q_EMIT passwordDisplayHintChanged();
48bool AccountsService::demoEdges() const
53void AccountsService::setDemoEdges(bool demoEdges)
55 m_demoEdges = demoEdges;
56 Q_EMIT demoEdgesChanged();
59QStringList AccountsService::demoEdgesCompleted() const
61 return m_demoEdgesCompleted;
64void AccountsService::markDemoEdgeCompleted(const QString &edge)
66 if (!m_demoEdgesCompleted.contains(edge)) {
67 m_demoEdgesCompleted << edge;
68 Q_EMIT demoEdgesCompletedChanged();
72void AccountsService::setDemoEdgesCompleted(const QStringList &demoEdgesCompleted)
74 m_demoEdgesCompleted = demoEdgesCompleted;
75 Q_EMIT demoEdgesCompletedChanged();
78bool AccountsService::enableFingerprintIdentification() const
80 return m_enableFingerprintIdentification;
83void AccountsService::setEnableFingerprintIdentification(bool enableFingerprintIdentification)
85 m_enableFingerprintIdentification = enableFingerprintIdentification;
86 Q_EMIT enableFingerprintIdentificationChanged();
89bool AccountsService::enableLauncherWhileLocked() const
91 return m_enableLauncherWhileLocked;
94void AccountsService::setEnableLauncherWhileLocked(bool enableLauncherWhileLocked)
96 m_enableLauncherWhileLocked = enableLauncherWhileLocked;
97 Q_EMIT enableLauncherWhileLockedChanged();
100bool AccountsService::enableIndicatorsWhileLocked() const
102 return m_enableIndicatorsWhileLocked;
105void AccountsService::setEnableIndicatorsWhileLocked(bool enableIndicatorsWhileLocked)
107 m_enableIndicatorsWhileLocked = enableIndicatorsWhileLocked;
108 Q_EMIT enableIndicatorsWhileLockedChanged();
111QString AccountsService::backgroundFile() const
113 return m_backgroundFile;
116void AccountsService::setBackgroundFile(const QString &backgroundFile)
118 m_backgroundFile = backgroundFile;
119 backgroundFileChanged();
122bool AccountsService::statsWelcomeScreen() const
124 return m_statsWelcomeScreen;
127void AccountsService::setStatsWelcomeScreen(bool statsWelcomeScreen)
129 m_statsWelcomeScreen = statsWelcomeScreen;
130 statsWelcomeScreenChanged();
133AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() const
135 if (m_user == "has-pin")
136 return PasswordDisplayHint::Numeric;
138 return PasswordDisplayHint::Keyboard;
141uint AccountsService::failedLogins() const
143 return m_failedLogins;
146void AccountsService::setFailedLogins(uint failedLogins)
148 m_failedLogins = failedLogins;
149 failedLoginsChanged();
152bool AccountsService::hereEnabled() const
154 return m_hereEnabled;
157void AccountsService::setHereEnabled(bool enabled)
159 m_hereEnabled = enabled;
160 hereEnabledChanged();
163QString AccountsService::hereLicensePath() const
165 return m_hereLicensePath;
168void AccountsService::setHereLicensePath(const QString &path)
170 // Path should always be valid (this code is all synchronous)
172 m_hereLicensePath = QString::null;
173 } else if (path.isNull()) { // because qml collapses null and empty
174 m_hereLicensePath = "";
176 m_hereLicensePath = path;
178 hereLicensePathChanged();
181bool AccountsService::hereLicensePathValid() const
183 return !m_hereLicensePath.isNull();
186QString AccountsService::realName() const
191void AccountsService::setRealName(const QString &realName)
193 m_realName = realName;
194 Q_EMIT realNameChanged();
197QString AccountsService::email() const
202void AccountsService::setEmail(const QString &email)
205 Q_EMIT emailChanged();
208QStringList AccountsService::keymaps() const
210 if (!m_kbdMap.isEmpty()) {
214 return {QStringLiteral("us")};
217void AccountsService::setKeymaps(const QStringList &keymaps)
219 if (keymaps != m_kbdMap) {
221 Q_EMIT keymapsChanged();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list