on 5b03213 help sign in
70 lines 2.2 kB history raw
1/*
2 * Copyright (C) 2012,2013 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 * Authors: Michael Terry <michael.terry@canonical.com>
17 */
19/* This class is a really tiny filter around QLightDM::Greeter. There are some
20 operations that we want to edit a bit for the benefit of Qml. Specifically,
21 we want to chop colons off of any password prompts. But there may be more
22 such edits in the future, and by inserting ourselves here, we have more
23 control. */
25#ifndef UNITY_GREETER_H
26#define UNITY_GREETER_H
28#include <QLightDM/Greeter>
29#include <QtCore/QObject>
31class GreeterPrivate;
33class Greeter : public QObject
35 Q_OBJECT
37 Q_PROPERTY(bool authenticated READ isAuthenticated)
38 Q_PROPERTY(QString authenticationUser READ authenticationUser)
39 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
41public:
42 explicit Greeter(QObject* parent=0);
44 bool isAuthenticated() const;
45 QString authenticationUser() const;
46 bool promptless() const;
48public Q_SLOTS:
49 void authenticate(const QString &username=QString());
50 void respond(const QString &response);
51 bool startSessionSync(const QString &session=QString());
53Q_SIGNALS:
54 void showMessage(const QString &text, bool isError);
55 void showPrompt(const QString &text, bool isSecret);
56 void authenticationComplete();
57 void promptlessChanged();
59private:
60 GreeterPrivate * const d_ptr;
62 Q_DECLARE_PRIVATE(Greeter)
64private Q_SLOTS:
65 void showMessageFilter(const QString &text, QLightDM::Greeter::MessageType type);
66 void showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type);
67 void authenticationCompleteFilter();
68};
70#endif