Remove unneeded QDesktopServices::setUrlHandler usages for khelpcenter
Open, Needs TriagePublic

Description

With https://invent.kde.org/system/khelpcenter/-/commit/85c3f5a965968b9dde8fb1da0a687124aeb449e7 the x-scheme-handler mimetypes are defined for all the URLS khelpcenter accepts. This makes the URL handlers configurable for users, because it uses the standardized XDG mechanism. To make sure that this does not interfer with any kio-slaves https://invent.kde.org/frameworks/kio/-/commit/01436fa259ed047fd5111f3e63f68e86646a75f1 was made.

The old logic which handles the help/man/info URLs is consequently not needed anymore. But because khelpcenter is part of the release service and not frameworks we can't assume a version is locally installed. Consequently we should wait that until KF6 is branched.

Usages that can be removed:

  • KCMultiDialog::slotHelpClicked
  • KontactKCMultiDialog::slotHelpClicked
  • KUrlHandler::openHelp
alex created this task.Jul 18 2021, 7:09 PM
alex added a project: KF6.Jul 18 2021, 7:17 PM
alex moved this task from Backlog to Waiting on KF6 Branching on the KF6 board.

KUrlHandler::openHelp() has a fallback to open the relevant docs at docs.kde.org if KHelpCenter isn't available while that code can be moved to to OpenUrlJob, it would mean that any KDE application that doesn't require KIO would be stranded.

The thing about KUrlHandler usage is that it comes via QDesktopServices::openUrl which is available everywhere Qt is installed, and and our override every where KGuiAddons is available (and app links to it, IIUC).

alex added a comment.Jul 19 2021, 11:10 AM

With https://doc.qt.io/qt-5/qdesktopservices.html#openUrl we get a bool if opening the URL was successful. If not we could create docs.kde.org URL and open that.

alex renamed this task from Remove unneeded QDesktopServices::openUrl usages for khelpcenter to Remove unneeded QDesktopServices::setUrlHandler usages for khelpcenter.Jul 19 2021, 12:53 PM

Sounded like a good idea, I tested it but it didn't work; then reading QDesktopServices::openUrl() docs:

A return value of true indicates that the application has successfully requested the operating system to open the URL in an external application. The external application may still fail to launch or fail to open the requested URL. This result will not be reported back to the application.

so that's not useful in this case.

(Each app ships its docs as html files, then any webbrowser would work to open them locally...).

alex added a comment.Aug 10 2021, 7:57 AM

Hmm, then we would need to check if kinfocenter exists in the $PATH. If yes we can assume that the QDesktopServices::openUrl method call will return anything useful and we use that to open the URL.