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 <QLightDM/Greeter>
25 explicit GreeterPrivate(Greeter *parent);
27 QLightDM::Greeter *m_greeter;
33 Greeter * const q_ptr;
36 Q_DECLARE_PUBLIC(Greeter)
40GreeterPrivate::GreeterPrivate(Greeter* parent)
41 : m_greeter(new QLightDM::Greeter(parent)),
49Greeter::Greeter(QObject* parent)
51 d_ptr(new GreeterPrivate(this))
55 connect(d->m_greeter, SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)),
56 this, SLOT(showMessageFilter(QString, QLightDM::Greeter::MessageType)));
57 connect(d->m_greeter, SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType)),
58 this, SLOT(showPromptFilter(QString, QLightDM::Greeter::PromptType)));
59 connect(d->m_greeter, SIGNAL(authenticationComplete()),
60 this, SLOT(authenticationCompleteFilter()));
62 d->m_greeter->connectSync();
65bool Greeter::isActive() const
71void Greeter::setIsActive(bool active)
74 if (d->m_active != active) {
76 Q_EMIT isActiveChanged();
80bool Greeter::isAuthenticated() const
83 return d->m_greeter->isAuthenticated();
86QString Greeter::authenticationUser() const
89 return d->m_greeter->authenticationUser();
92bool Greeter::promptless() const
98void Greeter::authenticate(const QString &username)
101 d->wasPrompted = false;
103 d->promptless = false;
104 Q_EMIT promptlessChanged();
107 d->m_greeter->authenticate(username);
108 Q_EMIT authenticationUserChanged(username);
111void Greeter::respond(const QString &response)
114 d->m_greeter->respond(response);
117bool Greeter::startSessionSync(const QString &session)
120 return d->m_greeter->startSessionSync(session);
123void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
126 d->wasPrompted = true;
128 // Strip prompt of any colons at the end
129 QString trimmedText = text.trimmed();
130 if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
134 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret);
137void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
139 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
142void Greeter::authenticationCompleteFilter()
145 if (!d->wasPrompted) {
146 d->promptless = true;
147 Q_EMIT promptlessChanged();
150 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