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
86QString Greeter::selectUser() const
89 return d->m_greeter->selectUserHint();
92void Greeter::authenticate(const QString &username)
95 d->wasPrompted = false;
97 d->promptless = false;
98 Q_EMIT promptlessChanged();
101 d->m_greeter->authenticate(username);
102 Q_EMIT isAuthenticatedChanged();
103 Q_EMIT authenticationUserChanged(username);
106void Greeter::respond(const QString &response)
109 d->m_greeter->respond(response);
112bool Greeter::startSessionSync(const QString &session)
115 return d->m_greeter->startSessionSync(session);
118void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
121 d->wasPrompted = true;
123 bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
125 // Strip prompt of any colons at the end
126 QString trimmedText = text.trimmed();
127 if (trimmedText.endsWith(':') || trimmedText.endsWith(QStringLiteral(":"))) {
131 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
134void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
136 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
139void Greeter::authenticationCompleteFilter()
142 if (!d->wasPrompted) {
143 d->promptless = true;
144 Q_EMIT promptlessChanged();
147 Q_EMIT isAuthenticatedChanged();
148 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