KRun: don't override user preferred app when opening local *.*html and co. files
ClosedPublic

Authored by ahmadsamir on Oct 21 2019, 11:50 AM.

Details

Summary

KRun unconditionally opened files with mimetype text/html (and co.) with
the browser application set in kdeglobals, BrowserApplication=, and if it's
not set, it fells back to mimeapps.list (x-scheme-handler/http*).

IMHO, there are two distinctive use cases here, opening http*:// links
with a web browser (which is what the user wants most of the time); and
opening local '.*html' files on the user's machine, usually with the
intention to edit them; the two cases can/should be mutually exclusive.

This gives the choice back to the user, as he can set his preferred app
to open local .html files, be it a web browser or a text editor.

This won't impact new user accounts because most browsers .desktop files
have Mimetype entries that cover most of the .html and co. types. So it'll
either be the default app already or the user can select his favourite browser
from the open-with list.

Thanks to broulik for pin-pointing the location in the code that caused
this behaviour first.

BUG: 399020
FIXED-IN: 5.65

Test Plan
  • Set some web browser as the default in the component chooser kcm
  • Open Dolphin and using any .html file set the default app to, say, kwrite
  • Try to open a local .html file, notice that it opens in the web browser you set
  • Apply the patch, then try again, it should be opened with kwrite

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.Oct 21 2019, 11:50 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 21 2019, 11:50 AM
ahmadsamir requested review of this revision.Oct 21 2019, 11:50 AM
dfaure accepted this revision.Dec 2 2019, 9:01 PM

This makes perfect sense to me, thanks for the detailed analysis and the fix.

Remember to update the version number in the FIXED-IN line (sorry for the delay in the review).

This revision is now accepted and ready to land.Dec 2 2019, 9:01 PM
ngraham edited the summary of this revision. (Show Details)Dec 2 2019, 9:21 PM
This revision was automatically updated to reflect the committed changes.

@ngraham: I do know how to land a diff :)