Commit 6210783b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add common code for load settings

parent 2a1649f0
......@@ -17,6 +17,8 @@
#include "pluginutil.h"
#include <KConfigGroup>
#include <KSharedConfig>
bool PimCommon::PluginUtil::isPluginActivated(const QStringList &enabledPluginsList, const QStringList &disabledPluginsList, bool isEnabledByDefault, const QString &pluginId)
{
......@@ -31,3 +33,20 @@ bool PimCommon::PluginUtil::isPluginActivated(const QStringList &enabledPluginsL
}
return false;
}
QPair<QStringList, QStringList> PimCommon::PluginUtil::loadPluginSetting(const QString &groupName, const QString &prefixSettingKey)
{
QPair<QStringList, QStringList> pair;
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("pimpluginsrc"));
QStringList enabledPlugins;
QStringList disabledPlugins;
if (config->hasGroup(groupName)) {
KConfigGroup grp = config->group(groupName);
enabledPlugins = grp.readEntry(QStringLiteral("%1Enabled").arg(prefixSettingKey), QStringList());
disabledPlugins = grp.readEntry(QStringLiteral("%1Disabled").arg(prefixSettingKey), QStringList());
}
pair.first = enabledPlugins;
pair.second = disabledPlugins;
return pair;
}
......@@ -23,12 +23,14 @@
#include <QString>
#include <QStringList>
#include <QPair>
namespace PimCommon
{
namespace PluginUtil
{
PIMCOMMON_EXPORT bool isPluginActivated(const QStringList &enabledPluginsList, const QStringList &disabledPluginsList, bool isEnabledByDefault, const QString &pluginId);
PIMCOMMON_EXPORT QPair<QStringList, QStringList> loadPluginSetting(const QString &groupName, const QString &prefixSettingKey);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment