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"
25GreeterPrivate::GreeterPrivate(Greeter* parent)
26 : m_greeter(new QLightDM::Greeter(parent)),
34Greeter::Greeter(QObject* parent)
36 d_ptr(new GreeterPrivate(this))
40 connect(d->m_greeter, SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)),
41 this, SLOT(showMessageFilter(QString, QLightDM::Greeter::MessageType)));
42 connect(d->m_greeter, SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType)),
43 this, SLOT(showPromptFilter(QString, QLightDM::Greeter::PromptType)));
44 connect(d->m_greeter, SIGNAL(authenticationComplete()),
45 this, SLOT(authenticationCompleteFilter()));
47 d->m_greeter->connectSync();
50bool Greeter::isActive() const
56void Greeter::setIsActive(bool active)
59 if (d->m_active != active) {
61 Q_EMIT isActiveChanged();
65bool Greeter::isAuthenticated() const
68 return d->m_greeter->isAuthenticated();
71QString Greeter::authenticationUser() const
74 return d->m_greeter->authenticationUser();
77bool Greeter::promptless() const
83void Greeter::authenticate(const QString &username)
86 d->wasPrompted = false;
88 d->promptless = false;
89 Q_EMIT promptlessChanged();
92 d->m_greeter->authenticate(username);
93 Q_EMIT isAuthenticatedChanged();
94 Q_EMIT authenticationUserChanged(username);
97void Greeter::respond(const QString &response)
100 d->m_greeter->respond(response);
103bool Greeter::startSessionSync(const QString &session)
106 return d->m_greeter->startSessionSync(session);
109void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
112 d->wasPrompted = true;
114 bool isDefaultPrompt = (text == dgettext("Linux-PAM", "Password: "));
116 // Strip prompt of any colons at the end
117 QString trimmedText = text.trimmed();
118 if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
122 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret, isDefaultPrompt);
125void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
127 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
130void Greeter::authenticationCompleteFilter()
133 if (!d->wasPrompted) {
134 d->promptless = true;
135 Q_EMIT promptlessChanged();
138 Q_EMIT isAuthenticatedChanged();
139 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