@@ -20,7 +20,9 @@
21GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
21GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
23−GSettingsControllerQml::GSettingsControllerQml() {
23+GSettingsControllerQml::GSettingsControllerQml()
24+ : m_usageMode("Staged")
26GSettingsControllerQml::~GSettingsControllerQml() {
28GSettingsControllerQml::~GSettingsControllerQml() {
@@ -34,17 +36,29 @@ GSettingsControllerQml* GSettingsControllerQml::instance() {
34 return s_controllerInstance;
36 return s_controllerInstance;
39+QString GSettingsControllerQml::pictureUri() const
37−void GSettingsControllerQml::registerSettingsObject(GSettingsQml *obj) {
44+void GSettingsControllerQml::setPictureUri(const QString &str)
38− m_registeredGSettings.append(obj);
45+{
46+ if (str != m_pictureUri) {
48+ Q_EMIT pictureUriChanged(m_pictureUri);
41−void GSettingsControllerQml::unRegisterSettingsObject(GSettingsQml *obj) {
52+QString GSettingsControllerQml::usageMode() const
42− m_registeredGSettings.removeOne(obj);
53+{
45−void GSettingsControllerQml::setPictureUri(const QString &str) {
57+void GSettingsControllerQml::setUsageMode(const QString &usageMode)
46− Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
58+{
47− obj->setPictureUri(str);
59+ if (usageMode != m_usageMode) {
60+ m_usageMode = usageMode;
61+ Q_EMIT usageModeChanged(m_usageMode);
@@ -56,7 +70,7 @@ QByteArray GSettingsSchemaQml::id() const {
58void GSettingsSchemaQml::setId(const QByteArray &id) {
72void GSettingsSchemaQml::setId(const QByteArray &id) {
59− if (m_id.isEmpty()) {
73+ if (!m_id.isEmpty()) {
60 qWarning("GSettings.schema.id may only be set on construction");
74 qWarning("GSettings.schema.id may only be set on construction");
@@ -69,7 +83,7 @@ QByteArray GSettingsSchemaQml::path() const {
71void GSettingsSchemaQml::setPath(const QByteArray &path) {
85void GSettingsSchemaQml::setPath(const QByteArray &path) {
72− if (m_path.isEmpty()) {
86+ if (!m_path.isEmpty()) {
73 qWarning("GSettings.schema.path may only be set on construction");
87 qWarning("GSettings.schema.path may only be set on construction");
@@ -77,26 +91,48 @@ void GSettingsSchemaQml::setPath(const QByteArray &path) {
77 m_path = path;
91 m_path = path;
80−GSettingsQml::GSettingsQml(QObject *parent): QObject(parent) {
94+GSettingsQml::GSettingsQml(QObject *parent)
81 m_schema = new GSettingsSchemaQml(this);
97 m_schema = new GSettingsSchemaQml(this);
82− GSettingsControllerQml::instance()->registerSettingsObject(this);
98+ connect(GSettingsControllerQml::instance(), SIGNAL(pictureUriChanged(const QString &)),
83−}
99+ this, SIGNAL(pictureUriChanged(const QString &)));
85−GSettingsQml::~GSettingsQml() {
86− GSettingsControllerQml::instance()->unRegisterSettingsObject(this);
100+ connect(GSettingsControllerQml::instance(), SIGNAL(usageModeChanged(const QString &)),
101+ this, SIGNAL(usageModeChanged(const QString &)));
89GSettingsSchemaQml * GSettingsQml::schema() const {
104GSettingsSchemaQml * GSettingsQml::schema() const {
90 return m_schema;
105 return m_schema;
93−QString GSettingsQml::pictureUri() const {
108+QString GSettingsQml::pictureUri() const
110+ if (m_schema->id() == "org.gnome.desktop.background") {
111+ return GSettingsControllerQml::instance()->pictureUri();
94− return m_pictureUri;
113+ return "";
97−void GSettingsQml::setPictureUri(const QString &str) {
117+void GSettingsQml::setPictureUri(const QString &str)
98− if (str != m_pictureUri) {
118+{
99− m_pictureUri = str;
119+ if (m_schema->id() == "org.gnome.desktop.background") {
100− Q_EMIT pictureUriChanged(m_pictureUri);
120+ GSettingsControllerQml::instance()->setPictureUri(str);
124+QString GSettingsQml::usageMode() const
126+ if (m_schema->id() == "com.canonical.Unity8") {
127+ return GSettingsControllerQml::instance()->usageMode();
133+void GSettingsQml::setUsageMode(const QString &usageMode)
135+ if (m_schema->id() == "com.canonical.Unity8") {
136+ GSettingsControllerQml::instance()->setUsageMode(usageMode);