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