2 * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
16 * Author: Michael Terry <michael.terry@canonical.com>
19#include "AccountsBindings.h"
20#include "AccountsService.h"
24AccountsBindings::AccountsBindings(QObject* parent)
26 m_service(new AccountsService(this)),
27 m_user(qgetenv("USER"))
29 connect(m_service, SIGNAL(propertiesChanged(const QString &, const QString &, const QStringList &)),
30 this, SLOT(propertiesChanged(const QString &, const QString &, const QStringList &)));
31 connect(m_service, SIGNAL(maybeChanged(const QString &)),
32 this, SLOT(maybeChanged(const QString &)));
35void AccountsBindings::setUser(const QString &user)
39 updateBackgroundFile();
40 updateStatsWelcomeScreen();
43bool AccountsBindings::getDemoEdges()
48void AccountsBindings::setDemoEdges(bool demoEdges)
50 m_demoEdges = demoEdges;
51 m_service->setUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges", demoEdges);
54QString AccountsBindings::getBackgroundFile()
56 return m_backgroundFile;
59bool AccountsBindings::getStatsWelcomeScreen()
61 return m_statsWelcomeScreen;
64void AccountsBindings::updateDemoEdges()
66 auto demoEdges = m_service->getUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges").toBool();
67 if (m_demoEdges != demoEdges) {
68 m_demoEdges = demoEdges;
69 Q_EMIT demoEdgesChanged();
73void AccountsBindings::updateBackgroundFile()
75 auto backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString();
76 if (m_backgroundFile != backgroundFile) {
77 m_backgroundFile = backgroundFile;
78 Q_EMIT backgroundFileChanged();
82void AccountsBindings::updateStatsWelcomeScreen()
84 auto statsWelcomeScreen = m_service->getUserProperty(m_user, "com.ubuntu.touch.AccountsService.SecurityPrivacy", "StatsWelcomeScreen").toBool();
85 if (m_statsWelcomeScreen != statsWelcomeScreen) {
86 m_statsWelcomeScreen = statsWelcomeScreen;
87 Q_EMIT statsWelcomeScreenChanged();
91void AccountsBindings::propertiesChanged(const QString &user, const QString &interface, const QStringList &changed)
97 if (interface == "com.canonical.unity.AccountsService") {
98 if (changed.contains("demo-edges")) {
101 } else if (interface == "com.ubuntu.touch.AccountsService.SecurityPrivacy") {
102 if (changed.contains("StatsWelcomeScreen")) {
103 updateStatsWelcomeScreen();
108void AccountsBindings::maybeChanged(const QString &user)
110 if (m_user != user) {
114 // Standard properties might have changed
115 updateBackgroundFile();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list