Commit 5655f5c9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix instanciate plugin

parent 3dffc672
Pipeline #75624 passed with stage
in 7 minutes and 36 seconds
......@@ -22,6 +22,7 @@ class MailTransportPluginInfo
public:
QString metaDataFileNameBaseName;
QString metaDataFileName;
KPluginMetaData data;
MailTransport::TransportAbstractPlugin *plugin = nullptr;
};
......@@ -70,6 +71,7 @@ bool TransportPluginManagerPrivate::initializePlugins()
info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
info.metaDataFileName = data.fileName();
info.data = data;
if (pluginVersion() == data.version()) {
info.plugin = nullptr;
mPluginList.push_back(info);
......@@ -87,11 +89,10 @@ bool TransportPluginManagerPrivate::initializePlugins()
void TransportPluginManagerPrivate::loadPlugin(MailTransportPluginInfo *item)
{
#if KCOREADDONS_VERSION > QT_VERSION_CHECK(5, 85, 0)
const auto loadResult = KPluginFactory::instantiatePlugin<MailTransport::TransportAbstractPlugin>(KPluginMetaData(item->metaDataFileName), q);
if (loadResult) {
if (item->plugin) {
QObject::connect(item->plugin, &TransportAbstractPlugin::updatePluginList, q, &TransportPluginManager::updatePluginList);
}
if (auto plugin =
KPluginFactory::instantiatePlugin<MailTransport::TransportAbstractPlugin>(item->data, q, QVariantList() << item->metaDataFileNameBaseName).plugin) {
item->plugin = plugin;
QObject::connect(plugin, &TransportAbstractPlugin::updatePluginList, q, &TransportPluginManager::updatePluginList);
}
#else
KPluginLoader pluginLoader(item->metaDataFileName);
......
Supports Markdown
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