~gerboland/unity/8-refactor-wm-and-test

« back to all changes in this revision

Viewing changes to plugins/LightDM/Greeter.h

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
18
 
 
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. */
 
24
 
 
25
#ifndef UNITY_GREETER_H
 
26
#define UNITY_GREETER_H
 
27
 
 
28
#include <QLightDM/Greeter>
 
29
#include <QtCore/QObject>
 
30
 
 
31
class GreeterPrivate;
 
32
 
 
33
class Greeter : public QObject
 
34
{
 
35
    Q_OBJECT
 
36
 
 
37
    Q_PROPERTY(bool authenticated READ isAuthenticated)
 
38
    Q_PROPERTY(QString authenticationUser READ authenticationUser)
 
39
    Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
 
40
 
 
41
public:
 
42
    explicit Greeter(QObject* parent=0);
 
43
 
 
44
    bool isAuthenticated() const;
 
45
    QString authenticationUser() const;
 
46
    bool promptless() const;
 
47
 
 
48
public Q_SLOTS:
 
49
    void authenticate(const QString &username=QString());
 
50
    void respond(const QString &response);
 
51
    bool startSessionSync(const QString &session=QString());
 
52
 
 
53
Q_SIGNALS:
 
54
    void showMessage(QString text, bool isError);
 
55
    void showPrompt(QString text, bool isSecret);
 
56
    void authenticationComplete();
 
57
    void promptlessChanged();
 
58
 
 
59
private:
 
60
    GreeterPrivate * const d_ptr;
 
61
 
 
62
    Q_DECLARE_PRIVATE(Greeter)
 
63
 
 
64
private Q_SLOTS:
 
65
    void showMessageFilter(QString text, QLightDM::Greeter::MessageType type);
 
66
    void showPromptFilter(QString text, QLightDM::Greeter::PromptType type);
 
67
    void authenticationCompleteFilter();
 
68
};
 
69
 
 
70
#endif