summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-07 06:17:51 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-07 06:17:51 (GMT)
commita98cd49e617d7959176127b5119b6b792368f876 (patch)
treea31f1f96da9db55e9e396ee4571731a73f281681
parentaa3e0280f9a6ed708415cd6e65d9c67b86b8b959 (diff)
Get plugin info
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/genericplugins/genericpluginmanager.cpp22
-rw-r--r--src/genericplugins/genericpluginmanager.h14
3 files changed, 37 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ac5a06..bf0dfba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
include(ECMInstallIcons)
-set(PIM_VERSION "5.3.41")
+set(PIM_VERSION "5.3.42")
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 0f7d302..fb0d298 100644
--- a/src/genericplugins/genericpluginmanager.cpp
+++ b/src/genericplugins/genericpluginmanager.cpp
@@ -91,6 +91,10 @@ public:
QString serviceTypeName;
QString pluginName;
QVector<GenericPluginInfo> mPluginList;
+
+ QVector<GenericPluginManager::GenericPluginData> pluginsDataList() const;
+private:
+ QVector<GenericPluginManager::GenericPluginData> mPluginDataList;
GenericPluginManager *q;
};
@@ -107,6 +111,7 @@ bool GenericPluginManagerPrivate::initializePlugins()
return md.serviceTypes().contains(s_serviceTypeName);
});
+
KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("pimpluginsrc"));
QStringList enabledPlugins;
QStringList disabledPlugins;
@@ -123,6 +128,13 @@ bool GenericPluginManagerPrivate::initializePlugins()
while (i.hasPrevious()) {
GenericPluginInfo info;
info.metaData = i.previous();
+
+ GenericPluginManager::GenericPluginData pluginData;
+ pluginData.mDescription = info.metaData.description();
+ pluginData.mName = info.metaData.name();
+ pluginData.mEnableByDefault = info.metaData.isEnabledByDefault();
+ mPluginDataList.append(pluginData);
+
const bool pluginEnabledByUser = enabledPlugins.contains(info.metaData.name());
const bool pluginDisabledByUser = disabledPlugins.contains(info.metaData.name());
if ((info.metaData.isEnabledByDefault() && !pluginDisabledByUser)
@@ -147,6 +159,11 @@ bool GenericPluginManagerPrivate::initializePlugins()
return true;
}
+QVector<GenericPluginManager::GenericPluginData> GenericPluginManagerPrivate::pluginsDataList() const
+{
+ return mPluginDataList;
+}
+
QVector<GenericPlugin *> GenericPluginManagerPrivate::pluginsList() const
{
QVector<PimCommon::GenericPlugin *> lst;
@@ -214,3 +231,8 @@ QVector<GenericPlugin *> GenericPluginManager::pluginsList() const
return d->pluginsList();
}
+QVector<GenericPluginManager::GenericPluginData> GenericPluginManager::pluginsDataList() const
+{
+ return d->pluginsDataList();
+}
+
diff --git a/src/genericplugins/genericpluginmanager.h b/src/genericplugins/genericpluginmanager.h
index e0aa8df..f37d856 100644
--- a/src/genericplugins/genericpluginmanager.h
+++ b/src/genericplugins/genericpluginmanager.h
@@ -30,6 +30,19 @@ class PIMCOMMON_EXPORT GenericPluginManager : public QObject
{
Q_OBJECT
public:
+ class GenericPluginData
+ {
+ public:
+ GenericPluginData()
+ : mEnableByDefault(false)
+ {
+
+ }
+ QString mDescription;
+ QString mName;
+ bool mEnableByDefault;
+ };
+
explicit GenericPluginManager(QObject *parent = Q_NULLPTR);
~GenericPluginManager();
@@ -44,6 +57,7 @@ public:
static GenericPluginManager *self();
QVector<PimCommon::GenericPlugin *> pluginsList() const;
+ QVector<PimCommon::GenericPluginManager::GenericPluginData> pluginsDataList() const;
private:
GenericPluginManagerPrivate *const d;
};