summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-14 09:55:37 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-14 09:55:37 (GMT)
commit815bd616941bf077edd13a780e51f07c047e668d (patch)
tree45ec049ee5e0dee15c608c9793c962adba1b1d8a
parent87af94856adca9bca706f0376908104dae03af98 (diff)
Reduce duplicate code
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/genericplugins/genericpluginmanager.cpp6
-rw-r--r--src/genericplugins/pluginutil.cpp10
-rw-r--r--src/genericplugins/pluginutil.h3
4 files changed, 15 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1776205..b9cd795 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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")
diff --git a/src/genericplugins/genericpluginmanager.cpp b/src/genericplugins/genericpluginmanager.cpp
index 9add81f..2abf05d 100644
--- a/src/genericplugins/genericpluginmanager.cpp
+++ b/src/genericplugins/genericpluginmanager.cpp
@@ -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);
diff --git a/src/genericplugins/pluginutil.cpp b/src/genericplugins/pluginutil.cpp
index 0f92b31..4dc892f 100644
--- a/src/genericplugins/pluginutil.cpp
+++ b/src/genericplugins/pluginutil.cpp
@@ -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;
+}
diff --git a/src/genericplugins/pluginutil.h b/src/genericplugins/pluginutil.h
index 28f9ea6..b7e1719 100644
--- a/src/genericplugins/pluginutil.h
+++ b/src/genericplugins/pluginutil.h
@@ -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);
+
}
}