Open Bug 1713541 Opened 4 years ago Updated 3 years ago

[KDE/Flatpak] Firefox doesn't open downloaded files in Qt applications

Categories

(Core :: Widget: Gtk, defect)

Firefox 88
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mi2rivtj, Unassigned, NeedInfo)

References

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

Steps to reproduce:

Download a JPG image or a PDF file and open it.

Actual results:

Firefox will open in the wrong application. If the user installed a GTK app like Chromium or GIMP, Firefox will open images in Chromium and PDFs in GIMP instead of opening in Gwenview and Okular respectively.

Expected results:

Firefox should detect Qt applications when opening downloaded files.

PDF file opening in GIMP (GTK) instead of Okular (the default Qt app in KDE for opening PDFs).

Summary: [KDE] Firefox doesn't open files in Qt applications → [KDE] Firefox doesn't open downloaded files in Qt applications

The Bugbug bot thinks this bug should belong to the 'Firefox::File Handling' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → File Handling

Hi,
I cannot reproduce this issue on Fx 89.0 using Ubuntu 20.
Can you please check on Firefox > Hamburger menu> Settings > General > Applications > if "PDF" and "WebP Image" have the option "Open in Firefox". Maybe this issue occurs on your machine because the Chromium and GIMP apps are set as default on your system.

Flags: needinfo?(mi2rivtj)

You need to use Kubuntu (KDE).

Flags: needinfo?(mi2rivtj)

Karl, do you know if this is expected on KDE since we usually rely on gtk libraries?

Flags: needinfo?(karlt)
Attached image PDF download selector (deleted) —

The reported behavior is not expected because GTK and KDE use a similar freedesktop convention for MIME type to application mappings.

On my KDE system, Firefox respects the KDE "File Associations" settings unless I have a preferred application set in Firefox or there is a ~/.mailcap file.

mailcap files are an older mechanism. I suspect we would surprise fewer users if we used mailcap only when the freedesktop/GTK mechanism failed to find an app.

mi2rivtj, if you load https://iv.iiarjournals.org/content/invivo/35/3/1313.full.pdf and click on the "Download" icon beside the "Print" icon in the PDF viewer, then what do you see beside "Open with"? Letter case is relevant here and I'd like to know whether you see "(default)".
Also, do you have an application/pdf line in ~/.mailcap?

Flags: needinfo?(karlt) → needinfo?(mi2rivtj)
Attached video firefoxbug.mp4 (deleted) —

@Karl Tomlinson (:karlt) Just did this. It opens in calligra (an ebook reader) despite Okular being installed.

I'm using Kubuntu 21.04 but the same problem happens in KDE Neon.

Flags: needinfo?(mi2rivtj)

Pictures here are opening in ImageMagick instead in Gwenview.

Summary: [KDE] Firefox doesn't open downloaded files in Qt applications → [KDE/Flatpak] Firefox doesn't open downloaded files in Qt applications

Comment on attachment 9227448 [details]
firefoxbug.mp4

Ah, thanks. "System Handler" indicates that gtk_show_uri() is being used. Presumably that uses a Flatpak API, and so I don't know how this could be resolved in Firefox.

(In reply to mi2rivtj from comment #7)

It opens in calligra (an ebook reader) despite Okular being installed.

Have you checked in the "File Associations" settings that Okular is preferred?

Flags: needinfo?(mi2rivtj)
Attached image Screenshot_20210618_154144.png (deleted) —

Yes, Okular is the preferred app.

Flags: needinfo?(mi2rivtj)
Attached image Screenshot_20210618_154334.png (deleted) —

Gwenview is also the preferred app to open JPG files. JPG images open in ImageMagick here.

Jan, any ideas why Flatpak would not be using the user's preferred application for the MIME type?

Flags: needinfo?(jhorak)

This doesn't happen in Fedora 34 KDE.

(In reply to Karl Tomlinson (:karlt) from comment #9)

Comment on attachment 9227448 [details]
firefoxbug.mp4

Ah, thanks. "System Handler" indicates that gtk_show_uri() is being used. Presumably that uses a Flatpak API, and so I don't know how this could be resolved in Firefox.

It appears that no bugzilla component is associated with this file, but I suspect all the people who know about it are probably working in the GTK integration component, so tentatively moving it there instead of file handling - the frontend team doesn't have the expertise to figure out what is happening here.

Component: File Handling → Widget: Gtk
Product: Firefox → Core

But why this bug doesn't happen in the Fedora?

A solution has been found!

I'm going to quote this commentmade in Reddit:

The root of the problem is: KDE does not initialize the XDG file associations file ~/.config/mimeapps.list with its defaults. Instead KDE relies on its own launch executable. Since Thunderbird / GTK apps parse that file to get defaults it shows a random app that supports opening PDF files.
A quick workaround to solve this is forcing KDE to generate the entry for PDF files. You can do that by changing file association order to something different than the default applying it and then turning the ordering back to Okular-first in System Settings -> File Associations.
It is an oddity left from KDE4 days. It allows people to try out KDE without ruining GTK based desktop file associations but causes problems like this when GTK apps are used under KDE desktop.

It's not a problem with Firefox, but with KDE itself, which might explain why in Fedora this issue doesn't happen.

I did this workaround and files are opening in the right application now!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: