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 <QCoreApplication>
21#include <QLightDM/Greeter>
28 explicit GreeterPrivate(Greeter *parent);
30 QLightDM::Greeter *m_greeter;
35 Greeter * const q_ptr;
38 Q_DECLARE_PUBLIC(Greeter)
42GreeterPrivate::GreeterPrivate(Greeter* parent)
43 : 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 // Listen for "state resets"
64 connect(QCoreApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)),
65 this, SLOT(handleAppStateChange(Qt::ApplicationState)));
67 d->m_greeter->connectSync();
70void Greeter::handleAppStateChange(Qt::ApplicationState state)
72 qDebug() << "MIKE state change " << state;
75bool Greeter::isAuthenticated() const
78 return d->m_greeter->isAuthenticated();
81QString Greeter::authenticationUser() const
84 return d->m_greeter->authenticationUser();
87bool Greeter::promptless() const
93void Greeter::authenticate(const QString &username)
96 d->wasPrompted = false;
98 d->promptless = false;
99 Q_EMIT promptlessChanged();
102 d->m_greeter->authenticate(username);
103 Q_EMIT authenticationUserChanged(username);
106void Greeter::respond(const QString &response)
109 d->m_greeter->respond(response);
112bool Greeter::startSessionSync(const QString &session)
115 return d->m_greeter->startSessionSync(session);
118void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type)
121 d->wasPrompted = true;
123 // Strip prompt of any colons at the end
124 QString trimmedText = text.trimmed();
125 if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
129 Q_EMIT showPrompt(trimmedText, type == QLightDM::Greeter::PromptTypeSecret);
132void Greeter::showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type)
134 Q_EMIT showMessage(text, type == QLightDM::Greeter::MessageTypeError);
137void Greeter::authenticationCompleteFilter()
140 if (!d->wasPrompted) {
141 d->promptless = true;
142 Q_EMIT promptlessChanged();
145 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