Diffusion KIO 7bd7f38400b9

[KRun] when asked to open link in external browser, fall back to mimeapps.list…

Authored by ngraham on Dec 22 2018, 5:53 PM.

Description

[KRun] when asked to open link in external browser, fall back to mimeapps.list if nothing is set in kdeglobals

Summary:
Right now, when KRun is invoked to open an http or https link in a browser, it checks the BrowserApplication key in ~/.config/kdeglobals. If nothing is set there (which is the default), then it introspects the link and figures out for itself what app to open, which is slow and can cause problems with certain links (see CCBUGs below).

This patch improves the browser discovery logic by additionally looking for a default browser in ~/.config/mimeapps.list, which is the XDG file and it's where browsers set themselves as the default. So if there is a default browser set in there, KRun will consume that information immediately instead of doing the time-consuming and possibly error-inducing link introspection round-trip.

CCBUG: 347870
CCBUG: 100016

Test Plan:

  1. Open System Settings > Applications > Default Applications > Browser and click "In an application based on the contents of the url" (which is the default setting, but you might have changed it)
  2. Set BrowserApplication[$e]= in ~/.config/kdeglobals
  3. Ensure that ~/.config/mimeapps/list has a default browser set
  4. Open any KDE app > Help menu > About KDE > Click on one of the links in the dialog

Without this patch, a KRun job is spawned that shows up in the notification widget and the link may take a second or two to open in your default browser.

With this patch, the link instantly opens in the browser.

Reviewers: Frameworks, broulik, cfeck, elvisangelaccio, dfaure

Reviewed By: dfaure

Subscribers: dfaure, rdieter, achauvel, kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D17371