Lomiri
Loading...
Searching...
No Matches
Greeter.h
1/*
2 * Copyright (C) 2013 Canonical Ltd.
3 * Copyright (C) 2010-2011 David Edmundson.
4 * Copyright (C) 2010-2011 Robert Ancell
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: David Edmundson <kde@davidedmundson.co.uk>
19 */
20
21#ifndef LOMIRI_MOCK_GREETER_H
22#define LOMIRI_MOCK_GREETER_H
23
24#include <QtCore/QObject>
25#include <QtCore/QVariant>
26
27/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28 * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
29 * COUNTERPART IN tests/mocks/Lightdm/liblightdm
30 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
31
32namespace QLightDM
33{
34 class GreeterPrivate;
35
36class Q_DECL_EXPORT Greeter : public QObject
37{
38 Q_OBJECT
39
40 Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete
41 Q_PROPERTY(QString authenticationUser READ authenticationUser )
42 Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
43 Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT)
44 Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT)
45
46 Q_PROPERTY(QString hostname READ hostname CONSTANT)
47 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
48
49public:
50 enum PromptType {
51 PromptTypeQuestion,
52 PromptTypeSecret
53 };
54 Q_ENUM(PromptType)
55
56 enum MessageType {
57 MessageTypeInfo,
58 MessageTypeError
59 };
60 Q_ENUM(MessageType)
61
62 explicit Greeter(QObject* parent=0);
63 virtual ~Greeter();
64
65 QString getHint(const QString &name) const;
66 QString defaultSessionHint() const;
67 bool hideUsersHint() const;
68 bool showManualLoginHint() const;
69 bool showRemoteLoginHint() const;
70 bool hasGuestAccountHint() const;
71 QString selectUserHint() const;
72 bool selectGuestHint() const;
73 QString autologinUserHint() const;
74 bool autologinGuestHint() const;
75 int autologinTimeoutHint() const;
76
77 bool inAuthentication() const;
78 bool isAuthenticated() const;
79 QString authenticationUser() const;
80 QString hostname() const;
81
82public Q_SLOTS:
83 bool connectSync();
84 void authenticate(const QString &username=QString());
85 void authenticateAsGuest();
86 void authenticateAutologin();
87 void authenticateRemote(const QString &session=QString(), const QString &username=QString());
88 void respond(const QString &response);
89 void cancelAuthentication();
90 void setLanguage (const QString &language);
91 bool startSessionSync(const QString &session=QString());
92
93Q_SIGNALS:
94 void showMessage(QString text, QLightDM::Greeter::MessageType type);
95 void showPrompt(QString text, QLightDM::Greeter::PromptType type);
96 void authenticationComplete();
97 void autologinTimerExpired();
98
99protected:
100 void sendAuthenticationComplete();
101
102private:
103 GreeterPrivate *d_ptr;
104 Q_DECLARE_PRIVATE(Greeter)
105};
106}
107
108#endif // LOMIRI_MOCK_GREETER_H