]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - liblightdm-qt/QLightDM/greeter.h
First pass at reset support
[sojka/lightdm.git] / liblightdm-qt / QLightDM / greeter.h
1 /*
2  * Copyright (C) 2010-2011 David Edmundson.
3  * Copyright (C) 2010-2011 Robert Ancell
4  * Author: David Edmundson <kde@davidedmundson.co.uk>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the Free
8  * Software Foundation; either version 2 or version 3 of the License.
9  * See http://www.gnu.org/copyleft/lgpl.html the full text of the license.
10  */
11
12 #ifndef QLIGHTDM_GREETER_H
13 #define QLIGHTDM_GREETER_H
14
15 #include <QtCore/QObject>
16 #include <QtCore/QVariant>
17
18
19 namespace QLightDM
20 {
21     class GreeterPrivate;
22
23 class Q_DECL_EXPORT Greeter : public QObject
24 {
25     Q_OBJECT
26     
27     Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete
28     Q_PROPERTY(QString authenticationUser READ authenticationUser )
29     Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
30     Q_PROPERTY(QString selectUser READ selectUserHint CONSTANT)
31     Q_PROPERTY(bool selectGuest READ selectGuestHint CONSTANT)
32
33     Q_PROPERTY(QString hostname READ hostname CONSTANT)
34     Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
35     Q_PROPERTY(bool locked READ lockHint CONSTANT)
36     
37     Q_PROPERTY(QString hostname READ hostname CONSTANT)
38
39     Q_ENUMS(PromptType MessageType)
40
41 public:
42     enum PromptType {
43         PromptTypeQuestion,
44         PromptTypeSecret
45     };
46
47     enum MessageType {
48         MessageTypeInfo,
49         MessageTypeError
50     };
51
52     explicit Greeter(QObject* parent=0);
53     virtual ~Greeter();
54
55     QString getHint(const QString &name) const;   
56     QString defaultSessionHint() const;
57     bool hideUsersHint() const;
58     bool showManualLoginHint() const;
59     bool showRemoteLoginHint() const;
60     bool lockHint () const;
61     bool hasGuestAccountHint() const;
62     QString selectUserHint() const;
63     bool selectGuestHint() const;
64     QString autologinUserHint() const;
65     bool autologinGuestHint() const;
66     int autologinTimeoutHint() const;
67
68     bool inAuthentication() const;
69     bool isAuthenticated() const;
70     QString authenticationUser() const;
71     QString hostname() const;
72
73 public Q_SLOTS:
74     bool connectSync();
75     void authenticate(const QString &username=QString());
76     void authenticateAsGuest();
77     void authenticateAutologin();
78     void authenticateRemote(const QString &session=QString(), const QString &username=QString());
79     void respond(const QString &response);
80     void cancelAuthentication();
81     void setLanguage (const QString &language);
82     void setResettable (bool resettable);
83     bool startSessionSync(const QString &session=QString());
84     QString ensureSharedDataDirSync(const QString &username);
85
86 Q_SIGNALS:
87     void showMessage(QString text, QLightDM::Greeter::MessageType type);
88     void showPrompt(QString text, QLightDM::Greeter::PromptType type);
89     void authenticationComplete();
90     void autologinTimerExpired();
91     void idle();
92     void reset();
93
94 private:
95     GreeterPrivate *d_ptr;
96     Q_DECLARE_PRIVATE(Greeter)
97
98 };
99 }
100
101 #endif // QLIGHTDM_GREETER_H