Unity 8
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 UNITY_MOCK_GREETER_H
22 #define UNITY_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 
32 namespace QLightDM
33 {
34  class GreeterPrivate;
35 
36 class 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  Q_PROPERTY(bool locked READ lockHint CONSTANT)
49 
50  Q_PROPERTY(QString hostname READ hostname CONSTANT)
51 
52  Q_ENUMS(PromptType MessageType)
53 
54 public:
55  enum PromptType {
56  PromptTypeQuestion,
57  PromptTypeSecret
58  };
59 
60  enum MessageType {
61  MessageTypeInfo,
62  MessageTypeError
63  };
64 
65  explicit Greeter(QObject* parent=0);
66  virtual ~Greeter();
67 
68  QString getHint(const QString &name) const;
69  QString defaultSessionHint() const;
70  bool hideUsersHint() const;
71  bool showManualLoginHint() const;
72  bool showRemoteLoginHint() const;
73  bool lockHint () const;
74  bool hasGuestAccountHint() const;
75  QString selectUserHint() const;
76  bool selectGuestHint() const;
77  QString autologinUserHint() const;
78  bool autologinGuestHint() const;
79  int autologinTimeoutHint() const;
80 
81  bool inAuthentication() const;
82  bool isAuthenticated() const;
83  QString authenticationUser() const;
84  QString hostname() const;
85 
86 public Q_SLOTS:
87  bool connectSync();
88  void authenticate(const QString &username=QString());
89  void authenticateAsGuest();
90  void authenticateAutologin();
91  void authenticateRemote(const QString &session=QString(), const QString &username=QString());
92  void respond(const QString &response);
93  void cancelAuthentication();
94  void setLanguage (const QString &language);
95  bool startSessionSync(const QString &session=QString());
96 
97 Q_SIGNALS:
98  void showMessage(QString text, QLightDM::Greeter::MessageType type);
99  void showPrompt(QString text, QLightDM::Greeter::PromptType type);
100  void authenticationComplete();
101  void autologinTimerExpired();
102 
103 protected:
104  void sendAuthenticationComplete();
105 
106 private:
107  GreeterPrivate *d_ptr;
108  Q_DECLARE_PRIVATE(Greeter)
109 };
110 }
111 
112 #endif // UNITY_MOCK_GREETER_H