Commit 4b8d6c72 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement plugins. Allow to load plugins

parent e1c90f65
......@@ -32,7 +32,8 @@
#include <QFile>
AbstractImporter::AbstractImporter(ImportWizard *parent)
: mImportWizard(parent)
: QObject(),
mImportWizard(parent)
{
}
......
......@@ -35,8 +35,9 @@ class MailFilter;
class FilterImporterExporter;
}
class AbstractImporter
class AbstractImporter : public QObject
{
Q_OBJECT
public:
enum TypeSupportedOption {
None = 0,
......
......@@ -20,9 +20,11 @@
#include "importmailpluginmanager.h"
#include "importwizard_debug.h"
#include "abstractimporter.h"
#include <QVector>
#include <KPluginMetaData>
#include <KPluginLoader>
#include <KPluginFactory>
Q_GLOBAL_STATIC(ImportMailPluginManager, s_instance)
......@@ -96,18 +98,15 @@ bool ImportMailPluginManager::initializePluginList()
void ImportMailPluginManager::loadPlugin(ImportMailPluginManagerInfo *item)
{
KPluginLoader pluginLoader(item->metaDataFileName);
#if 0
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<PluginEditorCheckBeforeSend>(q, QVariantList() << item->metaDataFileNameBaseName);
item->plugin = pluginLoader.factory()->create<AbstractImporter>(this, QVariantList() << item->metaDataFileNameBaseName);
mPluginDataList.append(item->pluginData);
}
#endif
}
#if 0
QVector<PluginEditorCheckBeforeSend *> ImportMailPluginManager::pluginsList() const
QVector<AbstractImporter *> ImportMailPluginManager::pluginsList() const
{
QVector<PluginEditorCheckBeforeSend *> lst;
QVector<AbstractImporter *> lst;
QVector<ImportMailPluginManagerInfo>::ConstIterator end(mPluginList.constEnd());
for (QVector<ImportMailPluginManagerInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
if ((*it).plugin) {
......@@ -117,9 +116,6 @@ QVector<PluginEditorCheckBeforeSend *> ImportMailPluginManager::pluginsList() co
return lst;
}
#endif
PluginUtilData ImportMailPluginManager::createPluginMetaData(const KPluginMetaData &metaData)
{
PluginUtilData pluginData;
......
......@@ -21,6 +21,7 @@
#include <QObject>
#include <KPluginMetaData>
class AbstractImporter;
class PluginUtilData
{
......@@ -39,16 +40,14 @@ class ImportMailPluginManagerInfo
{
public:
ImportMailPluginManagerInfo()
//: plugin(nullptr)
: plugin(nullptr)
{
}
QString metaDataFileNameBaseName;
QString metaDataFileName;
PluginUtilData pluginData;
#if 0
PluginEditorCheckBeforeSend *plugin;
#endif
AbstractImporter *plugin;
};
......@@ -61,10 +60,14 @@ public:
static ImportMailPluginManager *self();
bool initializePluginList();
QVector<AbstractImporter *> pluginsList() const;
private:
void loadPlugin(ImportMailPluginManagerInfo *item);
PluginUtilData createPluginMetaData(const KPluginMetaData &metaData);
QVector<ImportMailPluginManagerInfo> mPluginList;
QVector<PluginUtilData> mPluginDataList;
};
#endif // IMPORTMAILPLUGINMANAGER_H
Markdown is supported
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