Commit e567b79d authored by Laurent Montel's avatar Laurent Montel 😁

Continue to implement it

parent 2e8e78b2
......@@ -74,15 +74,77 @@ public:
TransportPluginManagerPrivate(TransportPluginManager *qq)
: q(qq)
{
initializePlugins();
}
void loadPlugin(MailTransportPluginInfo *item);
QVector<MailTransport::TransportAbstractPlugin *> pluginsList() const;
QVector<MailTransportPluginInfo> mPluginList;
bool initializePlugins();
private:
TransportPluginManager *q;
};
bool TransportPluginManagerPrivate::initializePlugins()
{
if (!mPluginList.isEmpty()) {
return true;
}
/*
static const QString s_serviceTypeName = serviceTypeName;
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(pluginName, [](const KPluginMetaData & md) {
return md.serviceTypes().contains(s_serviceTypeName);
});
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
QSet<QString> unique;
while (i.hasPrevious()) {
GenericPluginInfo info;
const KPluginMetaData data = i.previous();
//1) get plugin data => name/description etc.
info.pluginData = PimCommon::PluginUtil::createPluginMetaData(data);
//2) look at if plugin is activated
const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, info.pluginData.mEnableByDefault, info.pluginData.mIdentifier);
info.isEnabled = isPluginActivated;
info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
info.metaDataFileName = data.fileName();
if (pluginVersion() == data.version()) {
// only load plugins once, even if found multiple times!
if (unique.contains(info.metaDataFileNameBaseName)) {
continue;
}
info.plugin = nullptr;
mPluginList.push_back(info);
unique.insert(info.metaDataFileNameBaseName);
} else {
qCWarning(PIMCOMMON_LOG) << "Plugin " << data.name() << " doesn't have correction plugin version. It will not be loaded.";
}
}
QVector<GenericPluginInfo>::iterator end(mPluginList.end());
for (QVector<GenericPluginInfo>::iterator it = mPluginList.begin(); it != end; ++it) {
loadPlugin(&(*it));
}
*/
return true;
}
void TransportPluginManagerPrivate::loadPlugin(MailTransportPluginInfo *item)
{
/*
KPluginLoader pluginLoader(item->metaDataFileName);
if (pluginLoader.factory()) {
item->plugin = pluginLoader.factory()->create<PluginEditorInit>(q, QVariantList() << item->metaDataFileNameBaseName);
item->plugin->setIsEnabled(item->isEnabled);
item->pluginData.mHasConfigureDialog = item->plugin->hasConfigureDialog();
mPluginDataList.append(item->pluginData);
}
*/
}
QVector<MailTransport::TransportAbstractPlugin *> TransportPluginManagerPrivate::pluginsList() const
{
QVector<MailTransport::TransportAbstractPlugin *> lst;
......
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