Bug 477615

Summary: Okular and Gwenview Flatpaks can't find remote files when double clicked in Dolphin
Product: [Frameworks and Libraries] flatpak-platform-plugin Reporter: cberlinger <cberlinger>
Component: generalAssignee: Jan Grulich <jgrulich>
Status: REPORTED ---    
Severity: normal CC: glizda, hey, joao.sa, johnmaverick74, justin, kfm-devel, lehoangphuongbg, nate, skx.kde, tag
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description cberlinger 2023-11-27 14:29:17 UTC
SUMMARY
Dolphin is possibly not passing file URLs to the flatpaks of Okular and Gwenview. Opening PDF or image remote files via dolphin fails with error.

STEPS TO REPRODUCE
1. Install Okular/Gwenview from Flathub or Fedora Flatpaks
2. Open Dolphin, connect to SMB or Webdav share
3. Double Click on a remote PDF or image 
4. Get error box.

OBSERVED RESULT
Gwenview and Okular are unable to open the specified file associations when they are on a remote server provided by Dolphin. Timothée Ravier over on Fedora Discussion speculated that file URLs were not passed by Dolphin. https://discussion.fedoraproject.org/t/can-no-longer-open-files-with-okular-or-gwenview-on-a-dolphin-remote-share-smb-webdav-f39-kinoite/96788 

Konsole output for SMB Connection.
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, “urls”)
QString::arg: 2 argument(s) missing in org.kde.okular
kf.kio.widgets: Failed to check which JobView API is supported “org.freedesktop.DBus.Error.ServiceUnknown”
kf.kio.core: couldn’t create worker: “Unknown protocol ‘smb’.”
kf.kio.workers.file: readData() returned -1

Konsole output for WEBDAV Connection.
QString::arg: 2 argument(s) missing in org.kde.okular
kf.kio.widgets: Failed to check which JobView API is supported “org.freedesktop.DBus.Error.ServiceUnknown”
kf.kio.workers.http: Can’t communicate with kded_kcookiejar!
kf.kio.core: Can’t communicate with kiod_kpasswdserver (for checkAuthInfo)!
kf.kio.core: Can’t communicate with kiod_kpasswdserver (for queryAuthInfo)!
kf.kio.workers.file: readData() returned -1

EXPECTED RESULT
File should open normally regardless of location.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 39
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Kernel Version: 6.5.12-300.fc39.x86_64 (64-bit)
Graphics Platform: Wayland
Graphics Processor: AMD Radeon RX 480 Graphics
Dolphin Version: 23.08.3

ADDITIONAL INFORMATION
Comment 1 tag 2024-02-20 21:40:16 UTC
I was getting access denied when opening files in Okular from Dolphin. I solved it by giving Okular permission to talk on DBus session bus org.kde.kcookiejar5
Comment 2 cberlinger 2024-02-21 14:28:56 UTC
(In reply to tag from comment #1)
> I was getting access denied when opening files in Okular from Dolphin. I
> solved it by giving Okular permission to talk on DBus session bus
> org.kde.kcookiejar5

Okay I just tested adding DBus session access to "org.kde.kcookiejar5" via Flatseal. It still fails to open the remote SMB or WEBDAVS test files. The only thing that changed was that the line "kf.kio.workers.http: Can’t communicate with kded_kcookiejar!" disappeared for me.
Comment 3 cberlinger 2024-02-21 14:45:41 UTC
Following the lead provided by tag@jthoward.dev, I tested adding a few more Session Bus entry's the Okular flatpak. By adding "org.kde.kcookiejar5", "org.kde.kwalletd5", "org.kde.kpasswdserver" via Flatseal, I am now able to open a PDF with Okular over a WEBDAV connection. The only error still showing up in konsole is:
>>kf.kio.widgets: Failed to check which JobView API is supported "org.freedesktop.DBus.Error.ServiceUnknown"

These changes do not work for opening the same PDF over an SMB connection. Same errors show up as in my original bug ticket. Sidenote, adding these entries to the Gwenview flatpak do not help with either the WEBDAV or SMB connections.
Comment 4 tag 2024-02-21 14:52:43 UTC
Hmmmm, could be different issues then. The way i figured out what was wrong was by granting Okular permission for the whole session bus and then running dbus-monitor to see what it was talking on and granting it access one by one until I could open files.
Comment 5 tag 2024-02-21 14:55:31 UTC
Worth noting I am also running F39 Kinoite (Universal Blue Nvidia specifically) but in an X11 session, haven't really made any significant customizations though
Comment 6 cberlinger 2024-02-21 15:46:04 UTC
(In reply to tag from comment #5)
> Worth noting I am also running F39 Kinoite (Universal Blue Nvidia
> specifically) but in an X11 session, haven't really made any significant
> customizations though

I forgot to add that bug ticket as well. I am running Fedora Kinoite as well. I had Okular and Gwenview in the base image of Fedora Kinoite 38 and everything worked fine. But in Fedora 39, the Fedora KDE SIG removed the applications from the base image because of the their availability via flatpak. Unfortunately, these issues weren't discovered/reported prior to the changes approval.
Comment 7 Nate Graham 2024-04-13 13:59:54 UTC
Feels like a Flatpak packaging issue. In addition to those missing DBus permissions, it feels like maybe the KDE runtime is missing kio-extras or something. Justin, would you be able to take a look?
Comment 8 cberlinger 2024-08-05 21:08:18 UTC
Out of curiosity, can a flatpak override be used to block the flatpak's internal url interpretation; thereby, forcing the system to accept whatever KIO is offering? Just asking as a temp solution until the flatpak is changed.
Comment 9 Piotr Gliźniewicz 2024-09-20 10:01:08 UTC
I'm also experiencing similar problems with Flatpak packaged KDE Gear apps. KWrite fails for example with “Unable to create KIO worker. Unknown protocol ‘smb’.". I've tried it on Fedora 40, it works with apps installed from RPMs, but not for the Flatpak packaged ones.