[Component Chooser] Update http(s) scheme handler when changing default browser
ClosedPublic

Authored by broulik on Jul 26 2017, 2:53 PM.

Details

Summary

BUG: 332817

Test Plan

Similar to how it's done with mailto in the Email client chooser.

Didn't actually test any of the apps mentioned but xdg-mime query default x-scheme-handler/http returned the correct handler after I changed the setting. If no service is found (custom commandline), the entry is removed from config and the inherited one from /usr/share/applications (Firefox in my case) will be used.

Should we also update the handler for text/html mime type?

(This obviously doesn't help when the user installed the browser that did not register itself as scheme handler and then does not touch this setting here...)

Diff Detail

Repository
R119 Plasma Desktop
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Jul 26 2017, 2:53 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 26 2017, 2:53 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
dfaure requested changes to this revision.Jul 27 2017, 5:25 AM
dfaure added inline comments.
kcms/componentchooser/componentchooserbrowser.cpp
132

Don't you mean mimeAppsList->sync()?

This revision now requires changes to proceed.Jul 27 2017, 5:25 AM
broulik updated this revision to Diff 17274.Jul 27 2017, 8:26 AM
broulik edited edge metadata.
broulik edited the test plan for this revision. (Show Details)
  • Sync mimeAppList instead of profile, fixes the change not being reflected immediately
dfaure accepted this revision.Jul 27 2017, 8:45 AM

I suppose updating the handler for text/html would make sense too, so that clicking on a local HTML file opens the same webbrowser.

Some people editing HTML files might prefer that local html files open kate though -- but they can simply set that afterwards...
or we could have more advanced logic here like "if the current handler for text/html is a WebBrowser then adjust it otherwise leave it alone"...

This revision is now accepted and ready to land.Jul 27 2017, 8:45 AM
This revision was automatically updated to reflect the committed changes.

I suppose updating the handler for text/html would make sense too, so that clicking on a local HTML file opens the same webbrowser.

Well, KRun has a special case for text/html to always open them in the default browser, no matter what. So you cannot actually have Kate as your default app for HTML :D

I suppose updating the handler for text/html would make sense too, so that clicking on a local HTML file opens the same webbrowser.

Well, KRun has a special case for text/html to always open them in the default browser, no matter what. So you cannot actually have Kate as your default app for HTML :D

Ah, I see. (comes from https://git.reviewboard.kde.org/r/103524). I think the reasoning was "after I set Firefox as my browser app, local HTML files still open in konqueror... bug!!! I shouldn't have to configure it twice".
But actually we get more flexibility if we don't mix up the two things. I.e. a user should be able to choose a browser *and* choose kate for local html files.

So I vote for

  1. setting the handler for text/html from here (if it's another BrowserApp)
  2. removing the text/html hack in KRun

This way in the simple case, both HTTP and *.html open in your preferred browser,
but for more advanced users it's still possible to open HTML files in something else.

PS: keditbookmarks shows up in the combo because it's been tagged WebBrowser, I guess for menu organization purposes. But it's not a webbrowser, so I'm not sure how to fix that...