Unity 8
 All Classes Functions
AccountsService.h
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  */
18 
19 #ifndef UNITY_ACCOUNTSSERVICE_H
20 #define UNITY_ACCOUNTSSERVICE_H
21 
22 #include <QObject>
23 #include <QString>
24 
25 class AccountsServiceDBusAdaptor;
26 
27 class AccountsService: public QObject
28 {
29  Q_OBJECT
30  Q_ENUMS(PasswordDisplayHint)
31  Q_PROPERTY (QString user
32  READ user
33  WRITE setUser
34  NOTIFY userChanged)
35  Q_PROPERTY (bool demoEdges
36  READ demoEdges
37  WRITE setDemoEdges
38  NOTIFY demoEdgesChanged)
39  Q_PROPERTY (bool enableLauncherWhileLocked
40  READ enableLauncherWhileLocked
41  NOTIFY enableLauncherWhileLockedChanged)
42  Q_PROPERTY (bool enableIndicatorsWhileLocked
43  READ enableIndicatorsWhileLocked
44  NOTIFY enableIndicatorsWhileLockedChanged)
45  Q_PROPERTY (QString backgroundFile
46  READ backgroundFile
47  NOTIFY backgroundFileChanged)
48  Q_PROPERTY (bool statsWelcomeScreen
49  READ statsWelcomeScreen
50  NOTIFY statsWelcomeScreenChanged)
51  Q_PROPERTY (PasswordDisplayHint passwordDisplayHint
52  READ passwordDisplayHint
53  NOTIFY passwordDisplayHintChanged)
54  Q_PROPERTY (uint failedLogins
55  READ failedLogins
56  WRITE setFailedLogins
57  NOTIFY failedLoginsChanged)
58 
59 public:
60  enum PasswordDisplayHint {
61  Keyboard,
62  Numeric,
63  };
64 
65  explicit AccountsService(QObject *parent = 0);
66 
67  QString user() const;
68  void setUser(const QString &user);
69  bool demoEdges() const;
70  void setDemoEdges(bool demoEdges);
71  bool enableLauncherWhileLocked() const;
72  bool enableIndicatorsWhileLocked() const;
73  QString backgroundFile() const;
74  bool statsWelcomeScreen() const;
75  PasswordDisplayHint passwordDisplayHint() const;
76  uint failedLogins() const;
77  void setFailedLogins(uint failedLogins);
78 
79 Q_SIGNALS:
80  void userChanged();
81  void demoEdgesChanged();
82  void enableLauncherWhileLockedChanged();
83  void enableIndicatorsWhileLockedChanged();
84  void backgroundFileChanged();
85  void statsWelcomeScreenChanged();
86  void passwordDisplayHintChanged();
87  void failedLoginsChanged();
88 
89 private Q_SLOTS:
90  void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
91  void maybeChanged(const QString &user);
92 
93 private:
94  void updateDemoEdges();
95  void updateEnableLauncherWhileLocked();
96  void updateEnableIndicatorsWhileLocked();
97  void updateBackgroundFile();
98  void updateStatsWelcomeScreen();
99  void updatePasswordDisplayHint();
100  void updateFailedLogins();
101 
102  AccountsServiceDBusAdaptor *m_service;
103  QString m_user;
104  bool m_demoEdges;
105  bool m_enableLauncherWhileLocked;
106  bool m_enableIndicatorsWhileLocked;
107  QString m_backgroundFile;
108  bool m_statsWelcomeScreen;
109  PasswordDisplayHint m_passwordDisplayHint;
110  uint m_failedLogins;
111 };
112 
113 #endif