on c42e54e help sign in
110 lines 3.4 kB history raw
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 */
21#ifndef UNITY_MOCK_GREETER_H
22#define UNITY_MOCK_GREETER_H
24#include <QtCore/QObject>
25#include <QtCore/QVariant>
27/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28 * CHANGES MADE HERE MUST BE REFLECTED ON THE MOCK LIB
29 * COUNTERPART IN tests/mocks/Lightdm/liblightdm
30 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
32namespace QLightDM
34 class GreeterPrivate;
36class Q_DECL_EXPORT Greeter : public QObject
38 Q_OBJECT
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)
46 Q_PROPERTY(QString hostname READ hostname CONSTANT)
47 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
48 Q_PROPERTY(bool locked READ lockHint CONSTANT)
50 Q_ENUMS(PromptType MessageType)
52public:
53 enum PromptType {
54 PromptTypeQuestion,
55 PromptTypeSecret
56 };
58 enum MessageType {
59 MessageTypeInfo,
60 MessageTypeError
61 };
63 explicit Greeter(QObject* parent=0);
64 virtual ~Greeter();
66 QString getHint(const QString &name) const;
67 QString defaultSessionHint() const;
68 bool hideUsersHint() const;
69 bool showManualLoginHint() const;
70 bool showRemoteLoginHint() const;
71 bool lockHint () const;
72 bool hasGuestAccountHint() const;
73 QString selectUserHint() const;
74 bool selectGuestHint() const;
75 QString autologinUserHint() const;
76 bool autologinGuestHint() const;
77 int autologinTimeoutHint() const;
79 bool inAuthentication() const;
80 bool isAuthenticated() const;
81 QString authenticationUser() const;
82 QString hostname() const;
84public Q_SLOTS:
85 bool connectSync();
86 void authenticate(const QString &username=QString());
87 void authenticateAsGuest();
88 void authenticateAutologin();
89 void authenticateRemote(const QString &session=QString(), const QString &username=QString());
90 void respond(const QString &response);
91 void cancelAuthentication();
92 void setLanguage (const QString &language);
93 bool startSessionSync(const QString &session=QString());
95Q_SIGNALS:
96 void showMessage(QString text, QLightDM::Greeter::MessageType type);
97 void showPrompt(QString text, QLightDM::Greeter::PromptType type);
98 void authenticationComplete();
99 void autologinTimerExpired();
101protected:
102 void sendAuthenticationComplete();
104private:
105 GreeterPrivate *d_ptr;
106 Q_DECLARE_PRIVATE(Greeter)
107};
110#endif // UNITY_MOCK_GREETER_H