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>
21#include <QLightDM/Greeter>
26 explicit GreeterPrivate(Greeter *parent);
28 QLightDM::Greeter *m_greeter;
34 Greeter * const q_ptr;
37 Q_DECLARE_PUBLIC(Greeter)
41GreeterPrivate::GreeterPrivate(Greeter* parent)
42 : m_greeter(new QLightDM::Greeter(parent)),
50Greeter::Greeter(QObject* parent)
52 d_ptr(new GreeterPrivate(this))
56 connect(d->m_greeter, SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)),
57 this, SLOT(showMessageFilter(QString, QLightDM::Greeter::MessageType)));
58 connect(d->m_greeter, SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType)),
59 this, SLOT(showPromptFilter(QString, QLightDM::Greeter::PromptType)));
60 connect(d->m_greeter, SIGNAL(authenticationComplete()),
61 this, SLOT(authenticationCompleteFilter()));
63 d->m_greeter->connectSync();
66bool Greeter::isActive() const
72void Greeter::setIsActive(bool active)
75 if (d->m_active != active) {
77 Q_EMIT isActiveChanged();
81bool Greeter::isAuthenticated() const
84 return d->m_greeter->isAuthenticated();
87QString Greeter::authenticationUser() const
90 return d->m_greeter->authenticationUser();
93bool Greeter::promptless() const
99void Greeter::authenticate(const QString &username)
102 d->wasPrompted = false;
104 d->promptless = false;
105 Q_EMIT promptlessChanged();
108 d->m_greeter->authenticate(username);
109 Q_EMIT isAuthenticatedChanged();
110 Q_EMIT authenticationUserChanged(username);
113void Greeter::respond(const QString &response)
116 d->m_greeter->respond(response);
119bool Greeter::startSessionSync(const QString &session)
122 return d->m_greeter->startSessionSync(session);
125void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
128 d->wasPrompted = true;
130 bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
132 // Strip prompt of any colons at the end
133 QString trimmedText = text.trimmed();
134 if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
138 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
141void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
143 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
146void Greeter::authenticationCompleteFilter()
149 if (!d->wasPrompted) {
150 d->promptless = true;
151 Q_EMIT promptlessChanged();
154 Q_EMIT isAuthenticatedChanged();
155 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