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"
23GreeterPrivate::GreeterPrivate(Greeter* parent)
24 : m_greeter(new QLightDM::Greeter(parent)),
32Greeter::Greeter(QObject* parent)
34 d_ptr(new GreeterPrivate(this))
38 connect(d->m_greeter, &QLightDM::Greeter::showMessage,
39 this, &Greeter::showMessageFilter);
40 connect(d->m_greeter, &QLightDM::Greeter::showPrompt,
41 this, &Greeter::showPromptFilter);
42 connect(d->m_greeter, &QLightDM::Greeter::authenticationComplete,
43 this, &Greeter::authenticationCompleteFilter);
45 d->m_greeter->connectSync();
48bool Greeter::isActive() const
54void Greeter::setIsActive(bool active)
57 if (d->m_active != active) {
59 Q_EMIT isActiveChanged();
63bool Greeter::isAuthenticated() const
66 return d->m_greeter->isAuthenticated();
69QString Greeter::authenticationUser() const
72 return d->m_greeter->authenticationUser();
75bool Greeter::promptless() const
81void Greeter::authenticate(const QString &username)
84 d->wasPrompted = false;
86 d->promptless = false;
87 Q_EMIT promptlessChanged();
90 d->m_greeter->authenticate(username);
91 Q_EMIT isAuthenticatedChanged();
92 Q_EMIT authenticationUserChanged(username);
95void Greeter::respond(const QString &response)
98 d->m_greeter->respond(response);
101bool Greeter::startSessionSync(const QString &session)
104 return d->m_greeter->startSessionSync(session);
107void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
110 d->wasPrompted = true;
112 bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
114 // Strip prompt of any colons at the end
115 QString trimmedText = text.trimmed();
116 if (trimmedText.endsWith(':') || trimmedText.endsWith(QStringLiteral(":"))) {
120 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
123void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
125 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
128void Greeter::authenticationCompleteFilter()
131 if (!d->wasPrompted) {
132 d->promptless = true;
133 Q_EMIT promptlessChanged();
136 Q_EMIT isAuthenticatedChanged();
137 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