From 4b804873a63aa1c89aeba80e0dd3db3dbb467bd7 Mon Sep 17 00:00:00 2001 From: Jeena Date: Sat, 13 Jun 2020 00:20:46 +0200 Subject: [PATCH] Fix open in browser on enter This patch fixes the opening of the current item in a browser which was broken for a long time. --- html/content.html | 6 ++++-- qml/Content.qml | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/html/content.html b/html/content.html index 9a1c3ec..87d53aa 100644 --- a/html/content.html +++ b/html/content.html @@ -81,11 +81,13 @@ function checkKey(e) { e = e || window.event; + if (e.keyCode === 37) { window.location.href = "feedthemonkey:previous"; - } - else if (e.keyCode === 39) { + } else if (e.keyCode === 39) { window.location.href = "feedthemonkey:next"; + } else if(e.keyCode == 13) { + window.location.href = "feedthemonkey:open"; } } diff --git a/qml/Content.qml b/qml/Content.qml index 8d3faab..07440be 100644 --- a/qml/Content.qml +++ b/qml/Content.qml @@ -86,13 +86,14 @@ Item { onNavigationRequested: { if (request.url == "feedthemonkey:previous") { - // This is commented out because for some reason this reloads the page forever. - // This will show the error that the feedthemonkey:previous location is not supported - //request.action = WebEngineNavigationRequest.IgnoreRequest; + request.action = WebEngineView.IgnoreRequest; app.showPreviousPost(); } else if (request.url == "feedthemonkey:next") { - //request.action = WebEngineNavigationRequest.IgnoreRequest; + request.action = WebEngineView.IgnoreRequest; app.showNextPost(); + } else if (request.url == "feedthemonkey:open") { + request.action = WebEngineView.IgnoreRequest; + Qt.openUrlExternally(post.link) } else if (request.navigationType !== WebEngineNavigationRequest.LinkClickedNavigation) { request.action = WebEngineView.AcceptRequest; } else {