Lomiri
Loading...
Searching...
No Matches
Greeter.cpp
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 */
18
19
20/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21 * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
22 * COUNTERPART IN tests/mocks/Lightdm/liblightdm
23 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
24
25
26#include "Greeter.h"
27#include "GreeterPrivate.h"
28#include <QtCore/QCoreApplication>
29#include <QTimer>
30
31namespace QLightDM
32{
33
34Greeter::Greeter(QObject *parent)
35 : QObject(parent),
36 d_ptr(new GreeterPrivate(this))
37{
38}
39
40Greeter::~Greeter()
41{
42}
43
44QString Greeter::authenticationUser() const
45{
46 Q_D(const Greeter);
47 return d->authenticationUser;
48}
49
50bool Greeter::hasGuestAccountHint() const
51{
52 return false;
53}
54
55QString Greeter::getHint(const QString &name) const
56{
57 Q_UNUSED(name)
58 return QLatin1String("");
59}
60
61QString Greeter::defaultSessionHint() const
62{
63 return QStringLiteral("lomiri");
64}
65
66bool Greeter::hideUsersHint() const
67{
68 return false;
69}
70
71bool Greeter::showManualLoginHint() const
72{
73 return false;
74}
75
76bool Greeter::showRemoteLoginHint() const
77{
78 return false;
79}
80
81QString Greeter::selectUserHint() const
82{
83 return QLatin1String("");
84}
85
86bool Greeter::selectGuestHint() const
87{
88 return false;
89}
90
91QString Greeter::autologinUserHint() const
92{
93 return QLatin1String("");
94}
95
96bool Greeter::autologinGuestHint() const
97{
98 return false;
99}
100
101int Greeter::autologinTimeoutHint() const
102{
103 return 0;
104}
105
106bool Greeter::inAuthentication() const
107{
108 return false;
109}
110
111QString Greeter::hostname() const
112{
113 return QStringLiteral("hostname1");
114}
115
116bool Greeter::isAuthenticated() const
117{
118 Q_D(const Greeter);
119 return d->authenticated;
120}
121
122bool Greeter::connectSync()
123{
124 return true;
125}
126
127void Greeter::authenticate(const QString &username)
128{
129 Q_D(Greeter);
130
131 d->authenticated = false;
132 d->authenticationUser = username;
133 d->handleAuthenticate();
134}
135
136void Greeter::authenticateAsGuest()
137{}
138
139void Greeter::authenticateAutologin()
140{}
141
142void Greeter::authenticateRemote(const QString &session, const QString &username)
143{
144 Q_UNUSED(session)
145 Q_UNUSED(username)
146}
147
148void Greeter::cancelAuthentication()
149{
150 Q_D(Greeter);
151 d->cancelAuthentication();
152}
153
154void Greeter::setLanguage (const QString &language)
155{
156 Q_UNUSED(language)
157}
158
159bool Greeter::startSessionSync(const QString &session)
160{
161 Q_UNUSED(session)
162 return true;
163}
164
165void Greeter::respond(const QString &response)
166{
167 Q_D(Greeter);
168
169 d->handleRespond(response);
170}
171
172void Greeter::sendAuthenticationComplete()
173{
174 if (qEnvironmentVariableIsEmpty("LOMIRI_TESTING")) {
175 // simulate PAM's delay
176 QTimer::singleShot(1000, this, &Greeter::authenticationComplete);
177 } else {
178 Q_EMIT authenticationComplete();
179 }
180}
181
182}