2 * Copyright (C) 2013 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/>.
16 * Author: Michael Terry <michael.terry@canonical.com>
20#include "GreeterPrivate.h"
24GreeterPrivate::GreeterPrivate(Greeter* parent)
25 : m_greeter(new QLightDM::Greeter(parent)),
33Greeter::Greeter(QObject* parent)
35 d_ptr(new GreeterPrivate(this))
39 connect(d->m_greeter, &QLightDM::Greeter::showMessage,
40 this, &Greeter::showMessageFilter);
41 connect(d->m_greeter, &QLightDM::Greeter::showPrompt,
42 this, &Greeter::showPromptFilter);
43 connect(d->m_greeter, &QLightDM::Greeter::authenticationComplete,
44 this, &Greeter::authenticationCompleteFilter);
46 d->m_greeter->connectSync();
49bool Greeter::isActive() const
55void Greeter::setIsActive(bool active)
58 if (d->m_active != active) {
60 Q_EMIT isActiveChanged();
64bool Greeter::isAuthenticated() const
67 return d->m_greeter->isAuthenticated();
70QString Greeter::authenticationUser() const
73 return d->m_greeter->authenticationUser();
76bool Greeter::promptless() const
82void Greeter::authenticate(const QString &username)
85 d->wasPrompted = false;
87 d->promptless = false;
88 Q_EMIT promptlessChanged();
91 d->m_greeter->authenticate(username);
92 Q_EMIT isAuthenticatedChanged();
93 Q_EMIT authenticationUserChanged(username);
96void Greeter::respond(const QString &response)
99 d->m_greeter->respond(response);
102bool Greeter::startSessionSync(const QString &session)
105 return d->m_greeter->startSessionSync(session);
108void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
111 d->wasPrompted = true;
113 bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
115 // Strip prompt of any colons at the end
116 QString trimmedText = text.trimmed();
117 if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
121 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
124void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
126 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
129void Greeter::authenticationCompleteFilter()
132 if (!d->wasPrompted) {
133 d->promptless = true;
134 Q_EMIT promptlessChanged();
137 Q_EMIT isAuthenticatedChanged();
138 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