]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - liblightdm-qt/QLightDM/greeter.h
98ff2da13356382194f77d165d1a336ba268dc3b
[sojka/lightdm.git] / liblightdm-qt / QLightDM / greeter.h
1 #ifndef QLIGTHDM_GREETER_H
2 #define QLIGTHDM_GREETER_H
3
4 #include <QObject>
5 class GreeterPrivate;
6
7 #include "user.h"
8 #include "language.h"
9 //#include "ldmlayout.h"
10
11 class GreeterPrivate;
12
13 namespace QLightDM
14 {
15   class Config;
16   
17   class Q_DECL_EXPORT Greeter : public QObject
18   {
19     Q_OBJECT
20     public:
21         explicit Greeter(QObject* parent=0);
22         virtual ~Greeter();
23
24     Q_PROPERTY(bool canSuspend READ canSuspend);
25     Q_PROPERTY(bool canHibernate READ canHibernate);
26         Q_PROPERTY(bool canShutdown READ canShutdown);
27         Q_PROPERTY(bool canRestart READ canRestart);
28
29         Q_PROPERTY(QString hostname READ hostname);
30
31         /** The hostname of the machine */
32         QString hostname() const;
33         QString theme() const;
34
35         QVariant getProperty(const QString &name) const;
36
37         QString timedLoginUser() const;
38         int timedLoginDelay() const;
39
40         QList<QLightDM::Language> languages() const;
41         QString defaultLanguage() const;
42
43         //QList<LdmLayout> layouts() const;
44         QString defaultLayout() const;
45         QString layout() const;
46
47     QLightDM::Config *config() const;
48
49         QString defaultSession() const;
50     bool guestAccountSupported() const;
51
52         bool inAuthentication() const;
53         bool isAuthenticated() const;
54         QString authenticationUser() const;
55
56         void connectToServer();
57         void cancelTimedLogin();  
58         void startAuthentication(const QString &username);
59         void provideSecret(const QString &secret);
60         void cancelAuthentication();
61         void login(const QString &username, const QString &session, const QString &language);
62         void loginWithDefaults(const QString &username);
63         void loginAsGuest(const QString &session, const QString &language);
64         void loginAsGuestWithDefaults();
65
66         bool canSuspend() const;
67         bool canHibernate() const;
68         bool canShutdown() const;
69         bool canRestart() const;
70
71     public slots:
72         void suspend();
73         void hibernate();
74         void shutdown();
75         void restart();
76       
77     signals:
78         void connected();
79         void showPrompt(QString prompt);
80         void showMessage(QString message);
81         void showError(QString message);
82         void authenticationComplete(bool isAuthenticated);
83         void timedLogin(QString username);
84         void quit();
85     
86     private slots:  
87         void onRead(int fd);
88
89     private:
90         GreeterPrivate *d;
91         void writeInt(int value);
92         void writeString(QString value);
93         void writeHeader(int id, int length);
94         void flush();
95         int getPacketLength();
96         int readInt(int *offset);
97         QString readString(int *offset);
98     };
99
100 };//end namespace
101
102 #endif // LDMGREETER_H