on 034dca7 help sign in
184 lines 3.4 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 */
20/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21 * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
22 * COUNTERPART IN tests/mocks/Lightdm/liblightdm
23 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
26#include "Greeter.h"
27#include "GreeterPrivate.h"
28#include <QtCore/QCoreApplication>
29#include <QTimer>
31namespace QLightDM
34Greeter::Greeter(QObject *parent)
35 : QObject(parent),
36 d_ptr(new GreeterPrivate(this))
40Greeter::~Greeter()
44QString Greeter::authenticationUser() const
46 Q_D(const Greeter);
47 return d->authenticationUser;
50bool Greeter::hasGuestAccountHint() const
52 return true;
55QString Greeter::getHint(const QString &name) const
57 Q_UNUSED(name)
58 return QLatin1String("");
61QString Greeter::defaultSessionHint() const
63 return QStringLiteral("ubuntu");
66bool Greeter::hideUsersHint() const
68 return false;
71bool Greeter::showManualLoginHint() const
73 return true;
76bool Greeter::showRemoteLoginHint() const
78 return true;
81bool Greeter::lockHint () const
83 return false;
86QString Greeter::selectUserHint() const
88 return QLatin1String("");
91bool Greeter::selectGuestHint() const
93 return false;
96QString Greeter::autologinUserHint() const
98 return QLatin1String("");
101bool Greeter::autologinGuestHint() const
103 return false;
106int Greeter::autologinTimeoutHint() const
108 return 0;
111bool Greeter::inAuthentication() const
113 return false;
116QString Greeter::hostname() const
118 return QStringLiteral("hostname1");
121bool Greeter::isAuthenticated() const
123 Q_D(const Greeter);
124 return d->authenticated;
127bool Greeter::connectSync()
129 return true;
132void Greeter::authenticate(const QString &username)
134 Q_D(Greeter);
136 d->authenticated = false;
137 d->authenticationUser = username;
138 d->handleAuthenticate();
141void Greeter::authenticateAsGuest()
142{}
144void Greeter::authenticateAutologin()
145{}
147void Greeter::authenticateRemote(const QString &session, const QString &username)
149 Q_UNUSED(session)
150 Q_UNUSED(username)
153void Greeter::cancelAuthentication()
154{}
156void Greeter::setLanguage (const QString &language)
158 Q_UNUSED(language)
161bool Greeter::startSessionSync(const QString &session)
163 Q_UNUSED(session)
164 return true;
167void Greeter::respond(const QString &response)
169 Q_D(Greeter);
171 d->handleRespond(response);
174void Greeter::sendAuthenticationComplete()
176 if (qgetenv("UNITY_TESTING").isEmpty()) {
177 // simulate PAM's delay
178 QTimer::singleShot(1000, this, &Greeter::authenticationComplete);
179 } else {
180 Q_EMIT authenticationComplete();
181 }