feat(GODT-2772): use WebEngineView instead of WebView

This commit is contained in:
Xavier Michelon
2023-08-25 09:39:43 +02:00
parent 958e1280d7
commit 32f2c72575
8 changed files with 39 additions and 26 deletions

View File

@ -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.

View File

@ -107,7 +107,7 @@
<file>qml/Proton/TextArea.qml</file>
<file>qml/Proton/TextField.qml</file>
<file>qml/Proton/Toggle.qml</file>
<file>qml/Proton/WebView.qml</file>
<file>qml/Proton/WebFrame.qml</file>
<file>qml/QuestionItem.qml</file>
<file>qml/Resources/bug_report_flow.json</file>
<file>qml/SettingsItem.qml</file>
@ -126,6 +126,6 @@
<file>qml/ConnectionModeSettings.qml</file>
<file>qml/SplashScreen.qml</file>
<file>qml/Status.qml</file>
<file>qml/WebViewWindow.qml</file>
<file>qml/WebFrameWindow.qml</file>
</qresource>
</RCC>

View File

@ -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

View File

@ -104,7 +104,7 @@ SettingsView {
type: Label.Caption
onLinkActivated: function (link) {
Backend.showWebViewWindow(link)
Backend.showWebFrameOverlay(link)
}
}
}

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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
}