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