]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - liblightdm-qt/QLightDM/greeter.h
Support hide-users hint
[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 "layout.h"
22
23 class GreeterPrivate;
24
25 namespace QLightDM
26 {
27   class Q_DECL_EXPORT Greeter : public QObject
28   {
29     Q_OBJECT
30     public:
31         explicit Greeter(QObject* parent=0);
32         virtual ~Greeter();
33
34         Q_PROPERTY(bool canSuspend READ canSuspend);
35         Q_PROPERTY(bool canHibernate READ canHibernate);
36         Q_PROPERTY(bool canShutdown READ canShutdown);
37         Q_PROPERTY(bool canRestart READ canRestart);
38
39         Q_PROPERTY(QString hostname READ hostname CONSTANT);
40
41         /** The hostname of the machine */
42         QString hostname() const;
43
44         QString timedLoginUser() const;
45         int timedLoginDelay() const;
46
47         QList<QLightDM::Language> languages() const;
48         QString defaultLanguage() const;
49
50         //QList<LdmLayout> layouts() const;
51         QString layout() const;
52
53         QString getHint(QString name) const;
54         QString defaultSessionHint() const;
55         bool hideUsersHint() const;
56         bool hasGuestAccountHint() const;
57         QString selectUserHint() const;
58         bool selectGuestHint() const;
59         QString autologinUserHint() const;
60         bool autologinGuestHint() const;
61         int autologinTimeoutHint() const;
62
63         bool inAuthentication() const;
64         bool isAuthenticated() const;
65         QString authenticationUser() const;
66
67         bool canSuspend() const;
68         bool canHibernate() const;
69         bool canShutdown() const;
70         bool canRestart() const;
71
72     public slots:
73         void suspend();
74         void hibernate();
75         void shutdown();
76         void restart();
77
78         void connectToServer();
79         void login(const QString &username);
80         void loginAsGuest();
81         void respond(const QString &response);
82         void cancelAuthentication();
83         void startSession(const QString &session=QString());
84
85     signals:
86         void connected();
87         void showPrompt(QString prompt);
88         void showMessage(QString message);
89         void showError(QString message);
90         void authenticationComplete(bool isAuthenticated);
91         void sessionFailed();
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 // QLIGHDM_GREETER_H