Bug 479122 - Konqueror on KF6 can't display PDFs using Okular part
Summary: Konqueror on KF6 can't display PDFs using Okular part
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 24.01.85
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-28 13:34 UTC by Stefano Crocco
Modified: 2024-01-09 18:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefano Crocco 2023-12-28 13:34:13 UTC
I setup Konqueror so that it embeds PDF files using Okular part instead of opening them in the Okular application. However, with the KF6 versions of both Konqueror and Okular, this doesn't work: clicking on a PDF file results in Okular being launched. This happens because Konqueror uses KParts::PartLoader::partsForMimeType("application/pdf") and (at least on my system) the returned list doesn't contain "okularpart", despite Okular being installed and okularpart.so existing in the system.

I think this is caused by two factors:
- okularpart.so (at least on my system) is installed in /usr/lib64/qt6/plugins, while other parts (dolphinpart.so, arkpart.so and katepart.so) are installed in /usr/lib64/qt6/plugins/kf6/parts
- okular_part.json only lists application/vnd.kde.okular-archive as mimetype

After adding "application/pdf" to the list of mimetypes in okular_part.json, recompiling Okular and moving (actually, linking) okularpart.so to /usr/lib64/qt6/plugins/kf6/parts made KParts::PartLoader::partsForMimeType find okularpart correctly.

I think that this problem doesn't only happen for PDFs but also for the other mimetypes supported by okularpart but not explicitly listed in okular_part.json.

Note: in the bug report, I chose "Gentoo Packages" as platform: however, since the official Gentoo repository doesn't currently have packages for the KF6 versions of Okular and Konqueror, I installed them from the Gentoo KDE overlay (https://github.com/gentoo-mirror/kde.git).
Comment 1 Bug Janitor Service 2024-01-05 14:19:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/900
Comment 2 Bug Janitor Service 2024-01-08 10:32:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kparts/-/merge_requests/82
Comment 3 Bug Janitor Service 2024-01-08 10:36:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/902
Comment 4 Sune Vuorela 2024-01-09 10:17:53 UTC
Git commit 55901afcc3a0d42dbec216ec43426dd6c8e3a2fd by Sune Vuorela.
Committed on 09/01/2024 at 11:10.
Pushed by sune into branch 'master'.

Install parts into the right folder

M  +1    -2    CMakeLists.txt

https://invent.kde.org/graphics/okular/-/commit/55901afcc3a0d42dbec216ec43426dd6c8e3a2fd
Comment 5 Sune Vuorela 2024-01-09 18:19:56 UTC
Git commit dbb8ba635e48650b2ed8c84168c79e53e619ea0f by Sune Vuorela.
Committed on 09/01/2024 at 19:19.
Pushed by sune into branch 'master'.

Communicate our plugin namespace to consumers

This enables others to query our supported mimetypes and thus figure out
what mimetypes they can open with the okular part

It is needed for kpart loading to know which features we can actually do

M  +3    -0    okular_part.json

https://invent.kde.org/graphics/okular/-/commit/dbb8ba635e48650b2ed8c84168c79e53e619ea0f
Comment 6 Sune Vuorela 2024-01-09 18:20:05 UTC
Git commit 671107c0e53daf80065708daab7505d8f1a36371 by Sune Vuorela.
Committed on 09/01/2024 at 19:17.
Pushed by sune into branch 'master'.

KParts can extend their mimetypes with plugins

Certain KParts can extend their mimetypes with plugins

This feature was kind of lost in the KF6 porting that dropped the
desktop files.

Look for a key in the json file to see what plugins to look for for
extra mimetypes.

M  +13   -3    src/partloader.cpp

https://invent.kde.org/frameworks/kparts/-/commit/671107c0e53daf80065708daab7505d8f1a36371