From 50ed661214145d462ce4565d9def740175bc540f Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Sun, 1 Mar 2015 16:53:04 +0100 Subject: [PATCH] always use local settings --- src/core/snore.cpp | 13 +++---------- src/core/snore.h | 7 ------- src/core/snore_p.h | 7 +++---- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/core/snore.cpp b/src/core/snore.cpp index 04269d6..e95ef3f 100644 --- a/src/core/snore.cpp +++ b/src/core/snore.cpp @@ -200,7 +200,7 @@ QVariant SnoreCore::value(const QString &key, SettingsType type) const QString nk = d->versionizeKey(key); if(type == LOCAL_SETTING) { - nk = d->specificKey(key); + nk = d->normalizeKey(key); } return d->m_settings->value(nk); @@ -212,7 +212,7 @@ void SnoreCore::setValue(const QString &key, const QVariant &value, SettingsType QString nk = d->versionizeKey(key); if(type == LOCAL_SETTING) { - nk = d->specificKey(key); + nk = d->normalizeKey(key); } d->m_settings->setValue(nk,value); } @@ -224,16 +224,9 @@ void SnoreCore::setDefaultValue(const QString &key, const QVariant &value, Setti QString nk = d->versionizeKey(key); if(type == LOCAL_SETTING) { - nk = d->specificKey(key); + nk = d->normalizeKey(key); } if (!d->m_settings->contains(nk)) { d->m_settings->setValue(nk, value); } } - -void SnoreCore::setSettingsPrefix(const QString &prefix) -{ - Q_D(SnoreCore); - d->m_hints.setValue("app_specific_settings",prefix); -} - diff --git a/src/core/snore.h b/src/core/snore.h index 99957b0..c3eaa10 100644 --- a/src/core/snore.h +++ b/src/core/snore.h @@ -156,13 +156,6 @@ public: void setDefaultValue(const QString &key, const QVariant &value, SettingsType type = GLOBAL_SETTING); - /** - * Some settings can be uniqe to your application. - * @param appName the name of your application. - */ - void setSettingsPrefix(const QString &appName); - - signals: /** * This signal is emitted when an action on the Notification was performed. diff --git a/src/core/snore_p.h b/src/core/snore_p.h index de27138..c6fa3b5 100644 --- a/src/core/snore_p.h +++ b/src/core/snore_p.h @@ -24,6 +24,7 @@ #include "plugins/snorebackend.h" #include +#include #include namespace Snore @@ -76,8 +77,8 @@ public: return QString("%1/%2").arg(key, versionSchema()); } - QString specificKey(const QString &key) const{ - return versionizeKey(QString("AppSpecificSettings/%1/%2").arg(m_hints.value("app_specific_settings","SnoreNotify").toString(),key)); + QString normalizeKey(const QString &key) const{ + return versionizeKey(QString("LocalSettings/%1.%2/%3").arg(qApp->organizationName(), qApp->applicationName(), key)); } @@ -104,8 +105,6 @@ private: Application m_defaultApp; QSettings *m_settings; - - Hint m_hints; }; }