summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-14 07:37:18 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-14 07:37:18 (GMT)
commit87af94856adca9bca706f0376908104dae03af98 (patch)
tree2e0917f23d6a84e7979bef7e61b585d2d38dc4c9
parentbf5575ee902d4a07f2b8b4fb438ffd601ef291da (diff)
Add inline method for returning config file name
-rw-r--r--src/genericplugins/pluginutil.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/genericplugins/pluginutil.cpp b/src/genericplugins/pluginutil.cpp
index 7c796eb..0f92b31 100644
--- a/src/genericplugins/pluginutil.cpp
+++ b/src/genericplugins/pluginutil.cpp
@@ -19,6 +19,10 @@
#include <KConfigGroup>
#include <KSharedConfig>
+namespace {
+inline QString pluginConfigFile() { return QStringLiteral("pimpluginsrc"); }
+}
+
bool PimCommon::PluginUtil::isPluginActivated(const QStringList &enabledPluginsList, const QStringList &disabledPluginsList, bool isEnabledByDefault, const QString &pluginId)
{
if (pluginId.isEmpty()) {
@@ -36,7 +40,7 @@ bool PimCommon::PluginUtil::isPluginActivated(const QStringList &enabledPluginsL
QPair<QStringList, QStringList> PimCommon::PluginUtil::loadPluginSetting(const QString &groupName, const QString &prefixSettingKey)
{
QPair<QStringList, QStringList> pair;
- KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("pimpluginsrc"));
+ KSharedConfigPtr config = KSharedConfig::openConfig(pluginConfigFile());
QStringList enabledPlugins;
QStringList disabledPlugins;
if (config->hasGroup(groupName)) {
@@ -52,7 +56,7 @@ QPair<QStringList, QStringList> PimCommon::PluginUtil::loadPluginSetting(const Q
void PimCommon::PluginUtil::savePluginSettings(const QString &groupName, const QString &prefixSettingKey, const QStringList &enabledPluginsList, const QStringList &disabledPluginsList)
{
- KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("pimpluginsrc"));
+ KSharedConfigPtr config = KSharedConfig::openConfig(pluginConfigFile());
KConfigGroup grp = config->group(groupName);
grp.writeEntry(QStringLiteral("%1Enabled").arg(prefixSettingKey), enabledPluginsList);
grp.writeEntry(QStringLiteral("%1Disabled").arg(prefixSettingKey), disabledPluginsList);