summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-08 11:28:26 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-08 11:28:26 (GMT)
commit397575e916112bc512cd0c8fb0391fe98eddf926 (patch)
treee7f3adda404660123b06689b92f0282ef6f27ebe
parent5c39a26fb0449d243d9707682b9778321ab91ec0 (diff)
Por to new api
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/genericplugins/genericpluginmanager.cpp46
-rw-r--r--src/genericplugins/genericpluginmanager.h7
3 files changed, 36 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7583c10..16b8c34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
include(ECMInstallIcons)
-set(PIM_VERSION "5.3.45")
+set(PIM_VERSION "5.3.46")
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 2a7f929..bb561ee 100644
--- a/src/genericplugins/genericpluginmanager.cpp
+++ b/src/genericplugins/genericpluginmanager.cpp
@@ -93,12 +93,25 @@ public:
QString pluginName;
QVector<GenericPluginInfo> mPluginList;
- QVector<GenericPluginManager::GenericPluginData> pluginsDataList() const;
+ QVector<PluginUtilData> pluginsDataList() const;
+ QString configGroupName() const;
+ QString configPrefixSettingKey() const;
private:
- QVector<GenericPluginManager::GenericPluginData> mPluginDataList;
+ QVector<PluginUtilData> mPluginDataList;
GenericPluginManager *q;
};
+QString GenericPluginManagerPrivate::configGroupName() const
+{
+ return QStringLiteral("GenericPlugin").arg(pluginName);
+}
+
+QString GenericPluginManagerPrivate::configPrefixSettingKey() const
+{
+ return QStringLiteral("%1Plugin").arg(pluginName);
+}
+
+
bool GenericPluginManagerPrivate::initializePlugins()
{
if (serviceTypeName.isEmpty() || pluginName.isEmpty()) {
@@ -112,17 +125,7 @@ bool GenericPluginManagerPrivate::initializePlugins()
return md.serviceTypes().contains(s_serviceTypeName);
});
-
- KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("pimpluginsrc"));
- QStringList enabledPlugins;
- QStringList disabledPlugins;
- const QString groupPluginName = QStringLiteral("GenericPlugin%1").arg(pluginName);
- if (config->hasGroup(groupPluginName)) {
- KConfigGroup grp = config->group(groupPluginName);
- enabledPlugins = grp.readEntry(QStringLiteral("PluginsEnabled"), QStringList());
- disabledPlugins = grp.readEntry(QStringLiteral("PluginsDisabled"), QStringList());
- }
-
+ const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
QSet<QString> unique;
@@ -130,14 +133,14 @@ bool GenericPluginManagerPrivate::initializePlugins()
GenericPluginInfo info;
info.metaData = i.previous();
- GenericPluginManager::GenericPluginData pluginData;
+ PluginUtilData pluginData;
pluginData.mDescription = info.metaData.description();
pluginData.mName = info.metaData.name();
pluginData.mIdentifier = info.metaData.pluginId();
pluginData.mEnableByDefault = info.metaData.isEnabledByDefault();
mPluginDataList.append(pluginData);
- const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(enabledPlugins, disabledPlugins, pluginData.mEnableByDefault, pluginData.mIdentifier);
+ const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, pluginData.mEnableByDefault, pluginData.mIdentifier);
if (isPluginActivated) {
if (pluginVersion() == info.metaData.version()) {
// only load plugins once, even if found multiple times!
@@ -159,7 +162,7 @@ bool GenericPluginManagerPrivate::initializePlugins()
return true;
}
-QVector<GenericPluginManager::GenericPluginData> GenericPluginManagerPrivate::pluginsDataList() const
+QVector<PluginUtilData> GenericPluginManagerPrivate::pluginsDataList() const
{
return mPluginDataList;
}
@@ -231,8 +234,17 @@ QVector<GenericPlugin *> GenericPluginManager::pluginsList() const
return d->pluginsList();
}
-QVector<GenericPluginManager::GenericPluginData> GenericPluginManager::pluginsDataList() const
+QVector<PluginUtilData> GenericPluginManager::pluginsDataList() const
{
return d->pluginsDataList();
}
+QString GenericPluginManager::configGroupName() const
+{
+ return d->configGroupName();
+}
+
+QString GenericPluginManager::configPrefixSettingKey() const
+{
+ return d->configPrefixSettingKey();
+}
diff --git a/src/genericplugins/genericpluginmanager.h b/src/genericplugins/genericpluginmanager.h
index f85d1cf..46bff63 100644
--- a/src/genericplugins/genericpluginmanager.h
+++ b/src/genericplugins/genericpluginmanager.h
@@ -21,6 +21,7 @@
#include <QObject>
#include <QVector>
#include "pimcommon_export.h"
+#include "pluginutil.h"
namespace PimCommon
{
@@ -58,7 +59,11 @@ public:
static GenericPluginManager *self();
QVector<PimCommon::GenericPlugin *> pluginsList() const;
- QVector<PimCommon::GenericPluginManager::GenericPluginData> pluginsDataList() const;
+ QVector<PimCommon::PluginUtilData> pluginsDataList() const;
+
+ QString configGroupName() const;
+ QString configPrefixSettingKey() const;
+
private:
GenericPluginManagerPrivate *const d;
};