]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - liblightdm-qt/QLightDM/greeter.h
36d53de40dc951396c4850e4543a1759cd73fe55
[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 login(const QString &username);
59         void loginAsGuest();
60         void provideSecret(const QString &secret);
61         void cancelAuthentication();
62         void startSession(const QString &session, const QString &language);
63         void startSessionWithDefaults();
64
65         bool canSuspend() const;
66         bool canHibernate() const;
67         bool canShutdown() const;
68         bool canRestart() const;
69
70     public slots:
71         void suspend();
72         void hibernate();
73         void shutdown();
74         void restart();
75       
76     signals:
77         void connected();
78         void showPrompt(QString prompt);
79         void showMessage(QString message);
80         void showError(QString message);
81         void authenticationComplete(bool isAuthenticated);
82         void timedLogin(QString username);
83         void quit();
84     
85     private slots:  
86         void onRead(int fd);
87
88     private:
89         GreeterPrivate *d;
90         void writeInt(int value);
91         void writeString(QString value);
92         void writeHeader(int id, int length);
93         void flush();
94         int getPacketLength();
95         int readInt(int *offset);
96         QString readString(int *offset);
97     };
98
99 };//end namespace
100
101 #endif // LDMGREETER_H