@@ -17,6 +17,7 @@
1717#include "fake_gsettings.h"
1818
1919#include <QList>
20+#include <QDebug>
2021
2122GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
2223
@@ -42,12 +43,42 @@ void GSettingsControllerQml::unRegisterSettingsObject(GSettingsQml *obj) {
4243 m_registeredGSettings.removeOne(obj);
4344}
4445
45−void GSettingsControllerQml::setPictureUri(const QString &str) {
46− Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
47− obj->setPictureUri(str);
46+void GSettingsControllerQml::setPictureUri(const QByteArray &schemaId, const QString &str)
47+{
48+ if (m_pictureUri[schemaId] != str) {
49+ m_pictureUri[schemaId] = str;
50+
51+ Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
52+ if (obj->schema()->id() == schemaId) {
53+ Q_EMIT obj->pictureUriChanged(str);
54+ }
55+ }
4856 }
4957}
5058
59+QString GSettingsControllerQml::pictureUri(const QByteArray &schemaId) const
60+{
61+ return m_pictureUri.value(schemaId, "");
62+}
63+
64+void GSettingsControllerQml::setUsageMode(const QByteArray &schemaId, const QString &str)
65+{
66+ if (m_usageMode[schemaId] != str) {
67+ m_usageMode[schemaId] = str;
68+
69+ Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
70+ if (obj->schema()->id() == schemaId) {
71+ Q_EMIT obj->usageModeChanged(str);
72+ }
73+ }
74+ }
75+}
76+
77+QString GSettingsControllerQml::usageMode(const QByteArray &schemaId) const
78+{
79+ return m_usageMode.value(schemaId, "phone");
80+}
81+
5182GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
5283}
5384
@@ -56,12 +87,13 @@ QByteArray GSettingsSchemaQml::id() const {
5687}
5788
5889void GSettingsSchemaQml::setId(const QByteArray &id) {
59− if (m_id.isEmpty()) {
90+ if (!m_id.isEmpty()) {
6091 qWarning("GSettings.schema.id may only be set on construction");
6192 return;
6293 }
6394
6495 m_id = id;
96+ Q_EMIT idChanged(id);
6597}
6698
6799QByteArray GSettingsSchemaQml::path() const {
@@ -69,7 +101,7 @@ QByteArray GSettingsSchemaQml::path() const {
69101}
70102
71103void GSettingsSchemaQml::setPath(const QByteArray &path) {
72− if (m_path.isEmpty()) {
104+ if (!m_path.isEmpty()) {
73105 qWarning("GSettings.schema.path may only be set on construction");
74106 return;
75107 }
@@ -90,13 +122,20 @@ GSettingsSchemaQml * GSettingsQml::schema() const {
90122 return m_schema;
91123}
92124
125+void GSettingsQml::setPictureUri(const QString &str) {
126+ GSettingsControllerQml::instance()->setPictureUri(m_schema->id(), str);
127+}
128+
93129QString GSettingsQml::pictureUri() const {
94− return m_pictureUri;
130+ return GSettingsControllerQml::instance()->pictureUri(m_schema->id());
95131}
96132
97−void GSettingsQml::setPictureUri(const QString &str) {
98− if (str != m_pictureUri) {
99− m_pictureUri = str;
100− Q_EMIT pictureUriChanged(m_pictureUri);
101− }
133+void GSettingsQml::setUsageMode(const QString &str) {
134+ GSettingsControllerQml::instance()->setUsageMode(m_schema->id(), str);
102135}
136+
137+QString GSettingsQml::usageMode() const {
138+ return GSettingsControllerQml::instance()->usageMode(m_schema->id());
139+
140+}
141+