always use local settings
This commit is contained in:
parent
943d19a439
commit
50ed661214
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "plugins/snorebackend.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QApplication>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue