Commit 815bd616 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Reduce duplicate code

parent 87af9485
......@@ -21,7 +21,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
include(ECMInstallIcons)
set(PIM_VERSION "5.3.49")
set(PIM_VERSION "5.3.50")
set(PIMCOMMON_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
......
......@@ -133,11 +133,7 @@ bool GenericPluginManagerPrivate::initializePlugins()
GenericPluginInfo info;
info.metaData = i.previous();
PluginUtilData pluginData;
pluginData.mDescription = info.metaData.description();
pluginData.mName = info.metaData.name();
pluginData.mIdentifier = info.metaData.pluginId();
pluginData.mEnableByDefault = info.metaData.isEnabledByDefault();
const PimCommon::PluginUtilData pluginData = PimCommon::PluginUtil::createPluginMetaData(info.metaData);
mPluginDataList.append(pluginData);
const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, pluginData.mEnableByDefault, pluginData.mIdentifier);
......
......@@ -61,3 +61,13 @@ void PimCommon::PluginUtil::savePluginSettings(const QString &groupName, const Q
grp.writeEntry(QStringLiteral("%1Enabled").arg(prefixSettingKey), enabledPluginsList);
grp.writeEntry(QStringLiteral("%1Disabled").arg(prefixSettingKey), disabledPluginsList);
}
PimCommon::PluginUtilData PimCommon::PluginUtil::createPluginMetaData(const KPluginMetaData &metaData)
{
PluginUtilData pluginData;
pluginData.mDescription = metaData.description();
pluginData.mName = metaData.name();
pluginData.mIdentifier = metaData.pluginId();
pluginData.mEnableByDefault = metaData.isEnabledByDefault();
return pluginData;
}
......@@ -23,6 +23,7 @@
#include <QString>
#include <QStringList>
#include <QPair>
#include <kpluginmetadata.h>
namespace PimCommon
{
......@@ -46,6 +47,8 @@ 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);
PIMCOMMON_EXPORT void savePluginSettings(const QString &groupName, const QString &prefixSettingKey, const QStringList &enabledPluginsList, const QStringList &disabledPluginsList);
PIMCOMMON_EXPORT PimCommon::PluginUtilData createPluginMetaData(const KPluginMetaData &metaData);
}
}
......
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