Bug 479683 - Okular does not start due to missing okularpart
Summary: Okular does not start due to missing okularpart
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 24.01.90
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-12 07:19 UTC by madcatx
Modified: 2024-01-12 09:30 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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