Commit b165ee39 authored by Stefano Crocco's avatar Stefano Crocco
Browse files

Avoid automatically displaying local URLs in WebEnginePart

When a file URL is passed to WebEnginePage::acceptNavigationRequest,
don't allow QtWebEngine to decide what to do with it (open it in the
QWebEnginePage or not) but let Konqueror make the choice according to
the user's configuration.

Whitout this change, clicking on the "Home" link in the introduction
page (konq:konqueror) opens the page in WebEnginePart, while it should
open it in DolphinPart (or whichever part the user has chosen to display

Test Plan:
from the introduction page (konq:konqueror) click the "Home Folder"
link and check that the home folder is opened in DolphinPart and not
WebEnginePart. Create an HTML file with a link to a local image file, open the
HTML file in Konqueror and click on the link to the image. check that the image
is opened in the part chosen to handle images.

Reviewers: dfaure

Reviewed By: dfaure

Differential Revision:
parent aba7679d
......@@ -189,6 +189,14 @@ bool WebEnginePage::acceptNavigationRequest(const QUrl& url, NavigationType type
if (m_urlLoadedByPart != url) {
m_urlLoadedByPart = QUrl();
//Don't open local files using WebEnginePart except if configured to do so by the user. For example
//for example, this ensures that the "Home" link in the introduction page is opened in Dolphin part
//(or whichever part the user has chosen to open directories instead of WebEnginePart
if (url.isLocalFile()) {
emit m_part->browserExtension()->openUrlRequest(url);
return false;
// qCDebug(WEBENGINEPART_LOG) << url << "type=" << type;
QUrl reqUrl(url);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment