Bug 479683

Summary: Okular does not start due to missing okularpart
Product: [Applications] okular Reporter: madcatx
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: kde
Priority: NOR    
Version: 24.01.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description madcatx 2024-01-12 07:19:20 UTC
Since KDE 6 RC1 Okular does not start with "kf.coreaddons: "Could not find plugin okularpart" message in the console and the corresponding UI dialog. On Arch Linux, the "okularpart.so" is installed in "/usr/lib/qt6/plugins/kf6/parts" which is a path that Okular does not consider when it attempts to load the plugin. There are other plugins installed on the same path and applications that use them seem to work fine, which makes me think that this might not be just a packaging issue.

FWIW, I can get Okular to work by doing this:

diff --git a/shell/shell.cpp b/shell/shell.cpp
index 0a006d5ca..cf0d57177 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -183,6 +183,25 @@ private:
     QWidget *m_dumbTitleWidget = nullptr;
 };
 
+static KPluginFactory::Result<KPluginFactory> findOkularPart()
+{
+    auto result = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("okularpart")));
+    if (result) {
+        return result;
+    } else {
+        auto metadatas = KPluginMetaData::findPlugins(
+            QStringLiteral("kf6/parts"),
+            [](const auto &md) { return md.name() == QStringLiteral("Okular"); }
+        );
+
+        if (metadatas.isEmpty()) {
+            return result;
+        }
+
+        return KPluginFactory::loadFactory(metadatas.at(0));
+    }
+}
+
 Shell::Shell(const QString &serializedOptions)
     : KParts::MainWindow()
     , m_menuBarWasShown(true)
@@ -201,7 +220,7 @@ Shell::Shell(const QString &serializedOptions)
     // name which is a bad idea usually.. but it's alright in this
     // case since our Part is made for this Shell
 
-    const auto result = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("okularpart")));
+    const auto result = findOkularPart();
 
     if (!result) {
         // if we couldn't find our Part, we exit since the Shell by


Arch Linux
KF6 5.248.0
Plasma 5.92.0
Okular 24.01.90
Comment 1 Sune Vuorela 2024-01-12 09:30:48 UTC
https://invent.kde.org/graphics/okular/-/merge_requests/906

Sorry about that. 

Also, mail to Distributions list has been sent