on 8efbd79 help sign in
unity8/tests/mocks/AccountsService/AccountsService.cpp
116 lines 2.9 kB history raw
1/*
2 * Copyright (C) 2013 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 *
16 * Author: Michael Terry <michael.terry@canonical.com>
17 */
19#include "AccountsService.h"
21#include <paths.h>
23AccountsService::AccountsService(QObject* parent)
24 : QObject(parent),
25 m_enableLauncherWhileLocked(true),
26 m_enableIndicatorsWhileLocked(true),
27 m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
28 m_statsWelcomeScreen(true),
29 m_failedLogins(0)
33QString AccountsService::user() const
35 return m_user;
38void AccountsService::setUser(const QString &user)
40 m_user = user;
41 Q_EMIT userChanged();
42 Q_EMIT passwordDisplayHintChanged();
45bool AccountsService::demoEdges() const
47 return false;
50void AccountsService::setDemoEdges(bool demoEdges)
52 Q_UNUSED(demoEdges)
55bool AccountsService::enableLauncherWhileLocked() const
57 return m_enableLauncherWhileLocked;
60void AccountsService::setEnableLauncherWhileLocked(bool enableLauncherWhileLocked)
62 m_enableLauncherWhileLocked = enableLauncherWhileLocked;
63 Q_EMIT enableLauncherWhileLockedChanged();
66bool AccountsService::enableIndicatorsWhileLocked() const
68 return m_enableIndicatorsWhileLocked;
71void AccountsService::setEnableIndicatorsWhileLocked(bool enableIndicatorsWhileLocked)
73 m_enableIndicatorsWhileLocked = enableIndicatorsWhileLocked;
74 Q_EMIT enableIndicatorsWhileLockedChanged();
77QString AccountsService::backgroundFile() const
79 return m_backgroundFile;
82void AccountsService::setBackgroundFile(const QString &backgroundFile)
84 m_backgroundFile = backgroundFile;
85 backgroundFileChanged();
88bool AccountsService::statsWelcomeScreen() const
90 return m_statsWelcomeScreen;
93void AccountsService::setStatsWelcomeScreen(bool statsWelcomeScreen)
95 m_statsWelcomeScreen = statsWelcomeScreen;
96 statsWelcomeScreenChanged();
99AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() const
101 if (m_user == "has-pin")
102 return PasswordDisplayHint::Numeric;
103 else
104 return PasswordDisplayHint::Keyboard;
107uint AccountsService::failedLogins() const
109 return m_failedLogins;
112void AccountsService::setFailedLogins(uint failedLogins)
114 m_failedLogins = failedLogins;
115 failedLoginsChanged();