~lightdm-team/lightdm/1.4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef QLIGTHDM_GREETER_H
#define QLIGTHDM_GREETER_H

#include <QObject>
class GreeterPrivate;

#include "user.h"
#include "language.h"
//#include "ldmlayout.h"

class GreeterPrivate;

namespace QLightDM
{
  class Config;
  
  class Q_DECL_EXPORT Greeter : public QObject
  {
    Q_OBJECT
    public:
        explicit Greeter(QObject* parent=0);
        virtual ~Greeter();

    Q_PROPERTY(bool canSuspend READ canSuspend);
    Q_PROPERTY(bool canHibernate READ canHibernate);
	Q_PROPERTY(bool canShutdown READ canShutdown);
	Q_PROPERTY(bool canRestart READ canRestart);

	Q_PROPERTY(QString hostname READ hostname);

	/** The hostname of the machine */
	QString hostname() const;
	QString theme() const;

	QVariant getProperty(const QString &name) const;

	QString timedLoginUser() const;
	int timedLoginDelay() const;

	QList<QLightDM::Language> languages() const;
	QString defaultLanguage() const;

	//QList<LdmLayout> layouts() const;
	QString layout() const;

    QLightDM::Config *config() const;

	QString defaultSession() const;
    bool guestAccountSupported() const;

	bool inAuthentication() const;
	bool isAuthenticated() const;
	QString authenticationUser() const;

	void connectToServer();
	void cancelTimedLogin();  
	void login(const QString &username);
	void loginAsGuest();
	void provideSecret(const QString &secret);
	void cancelAuthentication();
	void startSession(const QString &session=QString(), const QString &language=QString());

	bool canSuspend() const;
	bool canHibernate() const;
	bool canShutdown() const;
	bool canRestart() const;

    public slots:
	void suspend();
	void hibernate();
	void shutdown();
	void restart();
      
    signals:
	void connected();
	void showPrompt(QString prompt);
	void showMessage(QString message);
	void showError(QString message);
	void authenticationComplete(bool isAuthenticated);
	void timedLogin(QString username);
	void quit();
    
    private slots:  
	void onRead(int fd);

    private:
	GreeterPrivate *d;
	void writeInt(int value);
	void writeString(QString value);
	void writeHeader(int id, int length);
	void flush();
	int getPacketLength();
	int readInt(int *offset);
	QString readString(int *offset);
    };

};//end namespace

#endif // LDMGREETER_H