https://bugs.kde.org/show_bug.cgi?id=479683

            Bug ID: 479683
           Summary: Okular does not start due to missing okularpart
    Classification: Applications
           Product: okular
           Version: 24.01.90
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: okular-de...@kde.org
          Reporter: madc...@atlas.cz
  Target Milestone: ---

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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to