2 * Copyright (C) 2013, 2015 Canonical, Ltd.
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.
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.
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/>.
19#include "GreeterPrivate.h"
22GreeterPrivate::GreeterPrivate(Greeter* parent)
23 : m_greeter(new QLightDM::Greeter(parent)),
31Greeter::Greeter(QObject* parent)
33 d_ptr(new GreeterPrivate(this))
37 connect(d->m_greeter, &QLightDM::Greeter::showMessage,
38 this, &Greeter::showMessageFilter);
39 connect(d->m_greeter, &QLightDM::Greeter::showPrompt,
40 this, &Greeter::showPromptFilter);
41 connect(d->m_greeter, &QLightDM::Greeter::authenticationComplete,
42 this, &Greeter::authenticationCompleteFilter);
44 d->m_greeter->connectSync();
47bool Greeter::isActive() const
53void Greeter::setIsActive(bool active)
56 if (d->m_active != active) {
58 Q_EMIT isActiveChanged();
62bool Greeter::isAuthenticated() const
65 return d->m_greeter->isAuthenticated();
68QString Greeter::authenticationUser() const
71 return d->m_greeter->authenticationUser();
74QString Greeter::defaultSessionHint() const
77 return d->m_greeter->defaultSessionHint();
80bool Greeter::promptless() const
86void Greeter::authenticate(const QString &username)
89 d->wasPrompted = false;
91 d->promptless = false;
92 Q_EMIT promptlessChanged();
95 d->m_greeter->authenticate(username);
96 Q_EMIT isAuthenticatedChanged();
97 Q_EMIT authenticationUserChanged(username);
100void Greeter::respond(const QString &response)
103 d->m_greeter->respond(response);
106bool Greeter::startSessionSync(const QString &session)
109 return d->m_greeter->startSessionSync(session);
112void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
115 d->wasPrompted = true;
117 bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
119 // Strip prompt of any colons at the end
120 QString trimmedText = text.trimmed();
121 if (trimmedText.endsWith(':') || trimmedText.endsWith(QStringLiteral(":"))) {
125 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
128void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
130 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
133void Greeter::authenticationCompleteFilter()
136 if (!d->wasPrompted) {
137 d->promptless = true;
138 Q_EMIT promptlessChanged();
141 Q_EMIT isAuthenticatedChanged();
142 Q_EMIT authenticationComplete();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list