on 3406a65 help sign in
unity8/plugins/AccountsService/AccountsService.h
138 lines 4.8 kB history raw
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors: Michael Terry <michael.terry@canonical.com>
17 */
19#ifndef UNITY_ACCOUNTSSERVICE_H
20#define UNITY_ACCOUNTSSERVICE_H
22#include <QObject>
23#include <QString>
25class AccountsServiceDBusAdaptor;
26class QDBusInterface;
28class AccountsService: public QObject
30 Q_OBJECT
31 Q_ENUMS(PasswordDisplayHint)
32 Q_PROPERTY (QString user
33 READ user
34 WRITE setUser
35 NOTIFY userChanged)
36 Q_PROPERTY (bool demoEdges
37 READ demoEdges
38 WRITE setDemoEdges
39 NOTIFY demoEdgesChanged)
40 Q_PROPERTY (bool enableLauncherWhileLocked
41 READ enableLauncherWhileLocked
42 NOTIFY enableLauncherWhileLockedChanged)
43 Q_PROPERTY (bool enableIndicatorsWhileLocked
44 READ enableIndicatorsWhileLocked
45 NOTIFY enableIndicatorsWhileLockedChanged)
46 Q_PROPERTY (QString backgroundFile
47 READ backgroundFile
48 NOTIFY backgroundFileChanged)
49 Q_PROPERTY (bool statsWelcomeScreen
50 READ statsWelcomeScreen
51 NOTIFY statsWelcomeScreenChanged)
52 Q_PROPERTY (PasswordDisplayHint passwordDisplayHint
53 READ passwordDisplayHint
54 NOTIFY passwordDisplayHintChanged)
55 Q_PROPERTY (uint failedLogins
56 READ failedLogins
57 WRITE setFailedLogins
58 NOTIFY failedLoginsChanged)
59 Q_PROPERTY(bool hereEnabled
60 READ hereEnabled
61 WRITE setHereEnabled
62 NOTIFY hereEnabledChanged)
63 Q_PROPERTY(QString hereLicensePath
64 READ hereLicensePath
65 NOTIFY hereLicensePathChanged)
66 Q_PROPERTY(bool hereLicensePathValid // qml sees a null string as "", so we use proxy setting for that
67 READ hereLicensePathValid
68 NOTIFY hereLicensePathChanged)
70public:
71 enum PasswordDisplayHint {
72 Keyboard,
73 Numeric,
74 };
76 explicit AccountsService(QObject *parent = 0, const QString & user = QString());
77 ~AccountsService() = default;
79 QString user() const;
80 void setUser(const QString &user);
81 bool demoEdges() const;
82 void setDemoEdges(bool demoEdges);
83 bool enableLauncherWhileLocked() const;
84 bool enableIndicatorsWhileLocked() const;
85 QString backgroundFile() const;
86 bool statsWelcomeScreen() const;
87 PasswordDisplayHint passwordDisplayHint() const;
88 uint failedLogins() const;
89 void setFailedLogins(uint failedLogins);
90 bool hereEnabled() const;
91 void setHereEnabled(bool enabled);
92 QString hereLicensePath() const;
93 bool hereLicensePathValid() const;
95Q_SIGNALS:
96 void userChanged();
97 void demoEdgesChanged();
98 void enableLauncherWhileLockedChanged();
99 void enableIndicatorsWhileLockedChanged();
100 void backgroundFileChanged();
101 void statsWelcomeScreenChanged();
102 void passwordDisplayHintChanged();
103 void failedLoginsChanged();
104 void hereEnabledChanged();
105 void hereLicensePathChanged();
107private Q_SLOTS:
108 void onPropertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
109 void onMaybeChanged(const QString &user);
111private:
112 void updateDemoEdges(bool async = true);
113 void updateEnableLauncherWhileLocked(bool async = true);
114 void updateEnableIndicatorsWhileLocked(bool async = true);
115 void updateBackgroundFile(bool async = true);
116 void updateMouseCursorSpeed();
117 void updateTouchpadCursorSpeed();
118 void updateStatsWelcomeScreen(bool async = true);
119 void updatePasswordDisplayHint(bool async = true);
120 void updateFailedLogins(bool async = true);
121 void updateHereEnabled(bool async = true);
122 void updateHereLicensePath(bool async = true);
124 AccountsServiceDBusAdaptor *m_service;
125 QDBusInterface *m_unityInput;
126 QString m_user;
127 bool m_demoEdges;
128 bool m_enableLauncherWhileLocked;
129 bool m_enableIndicatorsWhileLocked;
130 QString m_backgroundFile;
131 bool m_statsWelcomeScreen;
132 PasswordDisplayHint m_passwordDisplayHint;
133 uint m_failedLogins;
134 bool m_hereEnabled;
135 QString m_hereLicensePath;
136};
138#endif