diff --git a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h index 83ae80b8..0220f15e 100644 --- a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h +++ b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h @@ -277,7 +277,8 @@ signals: // Signals received from the Go backend, to be forwarded to QML void hideMainWindow(); ///< Signal for the 'hideMainWindow' gRPC stream event. void showHelp(); ///< Signal for the 'showHelp' event (from the context menu). void showSettings(); ///< Signal for the 'showHelp' event (from the context menu). - void showWebViewWindow(QString const &url); ///< Signal the the 'showWebViewWindow' event + void showWebFrameWindow(QString const &url); ///< Signal the the 'showWebFrameWindow' event + void showWebFrameOverlay(QString const &url); ////< Signal for the 'showWebFrameOverlay' event. void selectUser(QString const& userID, bool forceShowWindow); ///< Signal emitted in order to selected a user with a given ID in the list. void genericError(QString const &title, QString const &description); ///< Signal for the 'genericError' gRPC stream event. void imapLoginWhileSignedOut(QString const& username); ///< Signal for the notification of IMAP login attempt on a signed out account. diff --git a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc index aeea603f..b79a8b40 100644 --- a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc +++ b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc @@ -107,7 +107,7 @@ qml/Proton/TextArea.qml qml/Proton/TextField.qml qml/Proton/Toggle.qml - qml/Proton/WebView.qml + qml/Proton/WebFrame.qml qml/QuestionItem.qml qml/Resources/bug_report_flow.json qml/SettingsItem.qml @@ -126,6 +126,6 @@ qml/ConnectionModeSettings.qml qml/SplashScreen.qml qml/Status.qml - qml/WebViewWindow.qml + qml/WebFrameWindow.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml index 8ee7c5e8..9e1f6d06 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml @@ -69,16 +69,19 @@ QtObject { Backend.setNormalTrayIcon(); } } - property WebViewWindow _webviewWindow: WebViewWindow { - id: webViewWindow - flags: Qt.Tool + property WebFrameWindow _webFrameWindow: WebFrameWindow { + id: webFrameWindow + colorScheme: ProtonStyle.currentStyle transientParent: mainWindow - visible: false + flags: Qt.Tool Connections { - function onShowWebViewWindow(url) { - webViewWindow.url = url; - webViewWindow.show(); + function onShowWebFrameWindow(url) { + webFrameWindow.url = url; + webFrameWindow.showNormal(); + } + function onShowWebFrameOverlay(url) { + mainWindow.showWebFrameOverlay(url) } target: Backend diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/HelpView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/HelpView.qml index 4a604989..b27efd52 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/HelpView.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/HelpView.qml @@ -104,7 +104,7 @@ SettingsView { type: Label.Caption onLinkActivated: function (link) { - Backend.showWebViewWindow(link) + Backend.showWebFrameOverlay(link) } } } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml index 78db7480..c67bacb1 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml @@ -57,7 +57,7 @@ ApplicationWindow { setupWizard.showClientConfig(user, address); } function showHelp() { - showWebViewOverlay("https://proton.me/support/bridge"); + Backend.showWebFrameWindow("https://proton.me/support/bridge"); } function showLocalCacheSettings() { contentWrapper.showLocalCacheSettings(); @@ -69,9 +69,9 @@ ApplicationWindow { function showSettings() { contentWrapper.showSettings(); } - function showWebViewOverlay(url) { - webViewOverlay.visible = true; - webViewOverlay.url = url; + function showWebFrameOverlay(url) { + webFrameOverlay.visible = true; + webFrameOverlay.url = url; } colorScheme: ProtonStyle.currentStyle @@ -179,8 +179,8 @@ ApplicationWindow { } } } - WebView { - id: webViewOverlay + WebFrame { + id: webFrameOverlay anchors.fill: parent colorScheme: root.colorScheme overlay: true diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml similarity index 92% rename from internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebView.qml rename to internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml index dc064edd..19948270 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebView.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml @@ -15,8 +15,8 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import QtQuick.Controls.impl -import QtWebView -import "." as Proton +import QtWebEngine + Item { id: root @@ -55,11 +55,15 @@ Item { border.color: root.colorScheme.border_norm border.width: overlay ? ProtonStyle.web_view_overley_border_width : 0 - WebView { + WebEngineView { id: webView anchors.fill: parent anchors.margins: ProtonStyle.web_view_overley_border_width url: root.url + + onContextMenuRequested: function (request) { + request.accepted = true; // This prevent the default context menu from being presented. + } } } Button { diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/qmldir b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/qmldir index c866fc30..a13b58f2 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/qmldir +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/qmldir @@ -37,4 +37,4 @@ Switch 4.0 Switch.qml TextArea 4.0 TextArea.qml TextField 4.0 TextField.qml Toggle 4.0 Toggle.qml -WebView 4.0 WebView.qml +WebFrame 4.0 WebFrame.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/WebViewWindow.qml b/internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml similarity index 89% rename from internal/frontend/bridge-gui/bridge-gui/qml/WebViewWindow.qml rename to internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml index 12ecd3c3..597bcea6 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/WebViewWindow.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml @@ -17,13 +17,18 @@ import Proton Window { id: root - height: 600 - width: 800 - minimumWidth: 600 + property string url - WebView { + property ColorScheme colorScheme + + height: 600 + minimumWidth: 600 + width: 800 + + WebFrame { + id: frame anchors.fill: parent - colorScheme: ProtonStyle.currentStyle + colorScheme: root.colorScheme overlay: false url: root.url }