on c3f33dd help sign in
unity8/tests/mocks/AccountsService/AccountsService.cpp
92 lines 2.2 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_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
26 m_statsWelcomeScreen(true),
27 m_failedLogins(0)
31QString AccountsService::user() const
33 return m_user;
36void AccountsService::setUser(const QString &user)
38 m_user = user;
39 Q_EMIT userChanged();
40 Q_EMIT passwordDisplayHintChanged();
43bool AccountsService::demoEdges() const
45 return false;
48void AccountsService::setDemoEdges(bool demoEdges)
50 Q_UNUSED(demoEdges)
53QString AccountsService::backgroundFile() const
55 return m_backgroundFile;
58void AccountsService::setBackgroundFile(const QString &backgroundFile)
60 m_backgroundFile = backgroundFile;
61 backgroundFileChanged();
64bool AccountsService::statsWelcomeScreen() const
66 return m_statsWelcomeScreen;
69void AccountsService::setStatsWelcomeScreen(bool statsWelcomeScreen)
71 m_statsWelcomeScreen = statsWelcomeScreen;
72 statsWelcomeScreenChanged();
75AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() const
77 if (m_user == "has-pin")
78 return PasswordDisplayHint::Numeric;
79 else
80 return PasswordDisplayHint::Keyboard;
83uint AccountsService::failedLogins() const
85 return m_failedLogins;
88void AccountsService::setFailedLogins(uint failedLogins)
90 m_failedLogins = failedLogins;
91 failedLoginsChanged();