on 436b607 help sign in
199 lines 3.4 kB history raw
1/*
2 * Copyright (C) 2014 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 */
17#include "Greeter.h"
18#include "GreeterPrivate.h"
19#include <QtCore/QCoreApplication>
20#include <QTimer>
22namespace QLightDM
25Greeter::Greeter(QObject *parent)
26 : QObject(parent),
27 d_ptr(new GreeterPrivate(this))
31Greeter::~Greeter()
35QString Greeter::authenticationUser() const
37 Q_D(const Greeter);
38 return d->authenticationUser;
41bool Greeter::hasGuestAccountHint() const
43 return true;
46QString Greeter::getHint(const QString &name) const
48 Q_UNUSED(name)
49 return "";
52QString Greeter::defaultSessionHint() const
54 return "ubuntu";
57bool Greeter::hideUsersHint() const
59 return false;
62bool Greeter::showManualLoginHint() const
64 return true;
67bool Greeter::showRemoteLoginHint() const
69 return true;
72bool Greeter::lockHint () const
74 return false;
77QString Greeter::selectUserHint() const
79 return "";
82bool Greeter::selectGuestHint() const
84 return false;
87QString Greeter::autologinUserHint() const
89 return "";
92bool Greeter::autologinGuestHint() const
94 return false;
97int Greeter::autologinTimeoutHint() const
99 return 0;
102bool Greeter::inAuthentication() const
104 return false;
107QString Greeter::hostname() const
109 return "hostname1";
112bool Greeter::isAuthenticated() const
114 Q_D(const Greeter);
115 return d->authenticated;
118bool Greeter::connectSync()
120 return true;
123void Greeter::authenticate(const QString &username)
125 Q_D(Greeter);
127 d->authenticated = false;
128 d->authenticationUser = username;
129 d->twoFactorDone = false;
130 QTimer::singleShot(0, this, SLOT(delayedAuthentication()));
133void Greeter::delayedAuthentication()
135 Q_D(Greeter);
136 d->handleAuthenticate();
139void Greeter::authenticateAsGuest()
140{}
142void Greeter::authenticateAutologin()
143{}
145void Greeter::authenticateRemote(const QString &session, const QString &username)
147 Q_UNUSED(session)
148 Q_UNUSED(username)
151void Greeter::cancelAuthentication()
152{}
154void Greeter::setLanguage (const QString &language)
156 Q_UNUSED(language)
159bool Greeter::startSessionSync(const QString &session)
161 Q_UNUSED(session)
162 return true;
165void Greeter::respond(const QString &response)
167 Q_D(Greeter);
169 d->handleRespond(response);
172void Greeter::sendAuthenticationComplete()
174 if (qgetenv("UNITY_TESTING").isEmpty()) {
175 // simulate PAM's delay
176 QTimer::singleShot(1000, this, SIGNAL(authenticationComplete()));
177 } else {
178 Q_EMIT authenticationComplete();
179 }
182QString Greeter::mockMode() const
184 Q_D(const Greeter);
185 return d->mockMode;
189void Greeter::setMockMode(QString mockMode)
191 Q_D(Greeter);
193 if (d->mockMode != mockMode) {
194 d->mockMode = mockMode;
195 Q_EMIT mockModeChanged(mockMode);
196 }