-
Stefano Crocco authored
Summary: From Qt 5.12.0, before installing custom url scheme handlers, the scheme itself must be registered using QWebEngineUrlScheme. Registering URL schemes must be done before instantiating any QWebEngine class, so we do that at the beginning of WebEnginePart's constructor using a static function which only does the registration the first time it's called. Having to register url schemes before creating QWebEngine classes creates a problem beacuse we install scheme handlers dynamically from WebEnginePart::openUrl if the default mimetype for the URL (according to KProtocolManager::defaultMimeType) is 'text/html'. To avoid this issue, we use KProtocolInfo::protocols to obtain a list of all availlable protocols, create a fake URL for that protocol (as there's no way I can see to obtain the default mimetype for a protocol from KProtocolInfo) and use KProtocolManager::defaultMimeType on this URL to decide whether to register the URL scheme or not. Using QWebEngineUrlScheme also allows to specify that a given protocol can access local files, removing the need to use the html embedder from WebEnginePartKioHandler. Since this only works with Qt 5.12 or later, the html embedder is only disabled depending on the Qt version in use. Test Plan: run Konqueror with Qt 5.12 and check that no warnings about registering custom protocol are displayed on the terminal. Ensure that protocols such as about:, error:, man:, info: work correctly (for example, try man:cp or info:cp) Reviewers: dfaure Reviewed By: dfaure Differential Revision: https://phabricator.kde.org/D21741
9552130e