Commit 95fe9127 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Simplify part loading code

We know which part we want so we can load it directly instead of going via findPlugins
parent 834854cd
...@@ -125,17 +125,7 @@ void MainWindow::dragMoveEvent(QDragMoveEvent * event) ...@@ -125,17 +125,7 @@ void MainWindow::dragMoveEvent(QDragMoveEvent * event)
bool MainWindow::loadPart() bool MainWindow::loadPart()
{ {
KPluginFactory *factory = nullptr; KPluginFactory *factory = KPluginLoader(QStringLiteral("kf5/parts/arkpart")).factory();
const auto plugins = KPluginLoader::findPlugins(QStringLiteral("kf5/parts"), [](const KPluginMetaData& metaData) {
return metaData.pluginId() == QLatin1String("arkpart") &&
metaData.serviceTypes().contains(QLatin1String("KParts/ReadOnlyPart")) &&
metaData.serviceTypes().contains(QLatin1String("Browser/View"));
});
if (!plugins.isEmpty()) {
factory = KPluginLoader(plugins.first().fileName()).factory();
}
m_part = factory ? static_cast<KParts::ReadWritePart*>(factory->create<KParts::ReadWritePart>(this)) : nullptr; m_part = factory ? static_cast<KParts::ReadWritePart*>(factory->create<KParts::ReadWritePart>(this)) : nullptr;
......
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