From c8cf90abfed14006070000dc71c9a8febf29ca1b Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Fri, 1 Sep 2023 11:03:48 +0200 Subject: [PATCH] feat(GODT-2772): use os browser instead of integrated one for external links (for now). --- .../bridge-gui/bridge-gui/QMLBackend.h | 2 -- .../bridge-gui/bridge-gui/Resources.qrc | 1 - .../bridge-gui/bridge-gui/qml/Bridge.qml | 29 ++------------- .../bridge-gui/bridge-gui/qml/HelpView.qml | 2 +- .../bridge-gui/bridge-gui/qml/MainWindow.qml | 7 +--- .../bridge-gui/qml/Proton/WebFrame.qml | 3 -- .../SetupWizard/ClientConfigParameters.qml | 2 +- .../bridge-gui/qml/WebFrameWindow.qml | 35 ------------------- 8 files changed, 6 insertions(+), 75 deletions(-) delete mode 100644 internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h index 035fbca8..70692b70 100644 --- a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h +++ b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h @@ -278,8 +278,6 @@ 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 showWebFrameWindow(QString const &url); ///< Signal the the 'showWebFrameWindow' event - void showWebFrameOverlay(QString const &url); ////< Signal for the 'showWebFrameOverlay' event. void showWebFrameOverlayHTML(QString const &html); ///< Signal to display HTML content in a web frame overlay. 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. diff --git a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc index dccfa1ca..3c27df20 100644 --- a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc +++ b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc @@ -130,6 +130,5 @@ qml/ConnectionModeSettings.qml qml/SplashScreen.qml qml/Status.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 96a9e5d7..09d18726 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml @@ -40,33 +40,10 @@ QtObject { function onHideMainWindow() { mainWindow.hide(); } - - target: Backend - } - WebFrameWindow { - id: webFrameWindow - colorScheme: ProtonStyle.currentStyle - flags: Qt.Tool - transientParent: mainWindow - - Connections { - function onShowWebFrameOverlay(url) { - mainWindow.showWebFrameOverlay(url); - } - function onShowWebFrameOverlayHTML(html) { - mainWindow.showWebFrameOverlayHTML(html) - } - function onShowWebFrameWindow(url) { - webFrameWindow.url = url; - webFrameWindow.show(); - webFrameWindow.raise(); - if (!webFrameWindow.active) { - webFrameWindow.requestActivate(); - } - } - - target: Backend + function onShowWebFrameOverlayHTML(html) { + mainWindow.showWebFrameOverlayHTML(html) } + target: Backend } } property Notifications _notifications: Notifications { diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/HelpView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/HelpView.qml index b27efd52..e12516f6 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.showWebFrameOverlay(link) + Qt.openUrlExternally(link) } } } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml index 575981f2..03498eca 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml @@ -55,7 +55,7 @@ ApplicationWindow { setupWizard.showClientConfig(user, address, justLoggedIn); } function showHelp() { - Backend.showWebFrameWindow("https://proton.me/support/bridge"); + Qt.openUrlExternally("https://proton.me/support/bridge"); } function showLocalCacheSettings() { contentWrapper.showLocalCacheSettings(); @@ -67,11 +67,6 @@ ApplicationWindow { function showSettings() { contentWrapper.showSettings(); } - function showWebFrameOverlay(url) { - webFrameOverlay.visible = true; - webFrameOverlay.url = url; - } - function showWebFrameOverlayHTML(html) { webFrameOverlay.loadHTML(html); webFrameOverlay.visible = true; diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml index 99e8d357..9bfe5eba 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml @@ -24,9 +24,6 @@ Item { property bool overlay: true property string url: "" - function showBlankPage() { - webView.loadHtml("blank", ""); - } function loadHTML(html) { webView.loadHtml(html) } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml index 709b692c..eed7ff89 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/ClientConfigParameters.qml @@ -79,7 +79,7 @@ Rectangle { text: qsTr("Open guide") onClicked: function () { - Backend.showWebFrameWindow(wizard.setupGuideLink()); + Qt.openUrlExternally(wizard.setupGuideLink()); } } } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml b/internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml deleted file mode 100644 index 597bcea6..00000000 --- a/internal/frontend/bridge-gui/bridge-gui/qml/WebFrameWindow.qml +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2023 Proton AG -// This file is part of Proton Mail Bridge. -// Proton Mail Bridge is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// Proton Mail Bridge is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with Proton Mail Bridge. If not, see . -import QtQml -import QtQuick -import QtQuick.Controls -import Proton - -Window { - id: root - - property string url - property ColorScheme colorScheme - - height: 600 - minimumWidth: 600 - width: 800 - - WebFrame { - id: frame - anchors.fill: parent - colorScheme: root.colorScheme - overlay: false - url: root.url - } -}