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;
32 Greeter * const q_ptr;
35 Q_DECLARE_PUBLIC(Greeter)
39GreeterPrivate::GreeterPrivate(Greeter* parent)
40 : m_greeter(new QLightDM::Greeter(parent)),
47Greeter::Greeter(QObject* parent)
49 d_ptr(new GreeterPrivate(this))
53 connect(d->m_greeter, SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)),
54 this, SLOT(showMessageFilter(QString, QLightDM::Greeter::MessageType)));
55 connect(d->m_greeter, SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType)),
56 this, SLOT(showPromptFilter(QString, QLightDM::Greeter::PromptType)));
57 connect(d->m_greeter, SIGNAL(authenticationComplete()),
58 this, SLOT(authenticationCompleteFilter()));
59 connect(d->m_greeter, SIGNAL(idle()), this, SIGNAL(idle()));
60 connect(d->m_greeter, SIGNAL(reset()), this, SIGNAL(reset()));
62 d->m_greeter->setResettable(true);
63 d->m_greeter->connectSync();
66bool Greeter::isAuthenticated() const
69 return d->m_greeter->isAuthenticated();
72QString Greeter::authenticationUser() const
75 return d->m_greeter->authenticationUser();
78bool Greeter::promptless() const
84void Greeter::authenticate(const QString &username)
87 d->wasPrompted = false;
89 d->promptless = false;
90 Q_EMIT promptlessChanged();
93 d->m_greeter->authenticate(username);
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 // Strip prompt of any colons at the end
115 QString trimmedText = text.trimmed();
116 if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
120 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret);
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 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