summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 07:01:55 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 07:01:55 (GMT)
commite5473d835ed0c5a7f9e2563accde07eb43e573d2 (patch)
treececf4fd3dbee9677224979dbcb46bae3f28aef75
parent4f5a51ef027e4c8e0ec4561a2a62a5a3c3f091ba (diff)
Return plugin from identifier
-rw-r--r--src/genericplugins/genericpluginmanager.cpp18
-rw-r--r--src/genericplugins/genericpluginmanager.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/src/genericplugins/genericpluginmanager.cpp b/src/genericplugins/genericpluginmanager.cpp
index 47c5409..bd89cb5 100644
--- a/src/genericplugins/genericpluginmanager.cpp
+++ b/src/genericplugins/genericpluginmanager.cpp
@@ -93,6 +93,7 @@ public:
QVector<PluginUtilData> pluginsDataList() const;
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ GenericPlugin *pluginFromIdentifier(const QString &id);
private:
QVector<PluginUtilData> mPluginDataList;
GenericPluginManager *q;
@@ -185,6 +186,18 @@ void GenericPluginManagerPrivate::loadPlugin(GenericPluginInfo *item)
}
}
+GenericPlugin *GenericPluginManagerPrivate::pluginFromIdentifier(const QString &id)
+{
+ QVector<PimCommon::GenericPlugin *> lst;
+ QVector<GenericPluginInfo>::ConstIterator end(mPluginList.constEnd());
+ for (QVector<GenericPluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ if ((*it).pluginData.mIdentifier == id) {
+ return (*it).plugin;
+ }
+ }
+ return {};
+}
+
GenericPluginManager::GenericPluginManager(QObject *parent)
: QObject(parent),
d(new GenericPluginManagerPrivate(this))
@@ -246,3 +259,8 @@ QString GenericPluginManager::configPrefixSettingKey() const
{
return d->configPrefixSettingKey();
}
+
+GenericPlugin *GenericPluginManager::pluginFromIdentifier(const QString &id)
+{
+ return d->pluginFromIdentifier(id);
+}
diff --git a/src/genericplugins/genericpluginmanager.h b/src/genericplugins/genericpluginmanager.h
index 46bff63..e3763d4 100644
--- a/src/genericplugins/genericpluginmanager.h
+++ b/src/genericplugins/genericpluginmanager.h
@@ -64,6 +64,8 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ GenericPlugin *pluginFromIdentifier(const QString &id);
+
private:
GenericPluginManagerPrivate *const d;
};