From 139ad7539414a72b508137856af14fc32273f94f Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Tue, 12 Sep 2023 10:50:15 +0200 Subject: [PATCH] feat(GODT-2772): removed web frame. --- .../bridge-gui/bridge-gui/CMakeLists.txt | 3 +- .../bridge-gui/bridge-gui/QMLBackend.cpp | 22 ----- .../bridge-gui/bridge-gui/QMLBackend.h | 2 - .../bridge-gui/bridge-gui/Resources.qrc | 1 - .../frontend/bridge-gui/bridge-gui/main.cpp | 2 - .../bridge-gui/bridge-gui/qml/Bridge.qml | 3 - .../bridge-gui/bridge-gui/qml/MainWindow.qml | 12 --- .../bridge-gui/qml/Proton/WebFrame.qml | 83 ------------------- .../bridge-gui/qml/SetupWizard/LeftPane.qml | 7 +- 9 files changed, 5 insertions(+), 130 deletions(-) delete mode 100644 internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt b/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt index 84bca59b..2c14ed83 100644 --- a/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt +++ b/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt @@ -75,7 +75,7 @@ if(NOT UNIX) set(CMAKE_INSTALL_BINDIR ".") endif(NOT UNIX) -find_package(Qt6 COMPONENTS Core Quick Qml QuickControls2 Widgets Svg WebView REQUIRED) +find_package(Qt6 COMPONENTS Core Quick Qml QuickControls2 Widgets Svg REQUIRED) qt_standard_project_setup() set(CMAKE_AUTORCC ON) message(STATUS "Using Qt ${Qt6_VERSION}") @@ -148,7 +148,6 @@ target_link_libraries(bridge-gui Qt6::Qml Qt6::QuickControls2 Qt6::Svg - Qt6::WebView sentry::sentry bridgepp ) diff --git a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp index 8631a823..3bdd3012 100644 --- a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp +++ b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.cpp @@ -1099,28 +1099,6 @@ void QMLBackend::setUpdateTrayIcon(QString const &stateString, QString const &st } -//**************************************************************************************************************************************************** -/// \param[in] helpFileName The name of the help file with extension (e.g. "WhyBridge.html"). -//**************************************************************************************************************************************************** -void QMLBackend::showHelpOverlay(QString const &helpFileName) { - QDir const basePath(":/qml/Resources/Help"); - QString const templatePath = basePath.filePath("Template.html"); - QFile templateFile(templatePath); - if (!templateFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - app().log().error("Could not load help overlay HTML template"); - return; - } - - QFile helpFile(basePath.filePath(helpFileName)); - if (!helpFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - app().log().error(QString("Could not load help overlay HTML file %1").arg(helpFileName)); - return; - } - - emit showWebFrameOverlayHTML(QString::fromUtf8(templateFile.readAll()).arg(QString::fromUtf8(helpFile.readAll()))); -} - - //**************************************************************************************************************************************************** /// \param[in] isOn Does bridge consider internet as on. //**************************************************************************************************************************************************** diff --git a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h index 70692b70..f19f3113 100644 --- a/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h +++ b/internal/frontend/bridge-gui/bridge-gui/QMLBackend.h @@ -211,7 +211,6 @@ public slots: // slots for functions that need to be processed locally. void setErrorTrayIcon(QString const& stateString, QString const &statusIcon); ///< Set the tray icon to 'error' state. void setWarnTrayIcon(QString const& stateString, QString const &statusIcon); ///< Set the tray icon to 'warn' state. void setUpdateTrayIcon(QString const& stateString, QString const &statusIcon); ///< Set the tray icon to 'update' state. - void showHelpOverlay(QString const &helpFileName); ///< Slot triggering the display of help content as an overlay. public slots: // slot for signals received from gRPC that need transformation instead of simple forwarding void internetStatusChanged(bool isOn); ///< Check if bridge considers internet as on. @@ -278,7 +277,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 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. 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 3c27df20..19126b21 100644 --- a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc +++ b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc @@ -107,7 +107,6 @@ qml/Proton/TextArea.qml qml/Proton/TextField.qml qml/Proton/Toggle.qml - qml/Proton/WebFrame.qml qml/QuestionItem.qml qml/Resources/bug_report_flow.json qml/Resources/Help/Template.html diff --git a/internal/frontend/bridge-gui/bridge-gui/main.cpp b/internal/frontend/bridge-gui/bridge-gui/main.cpp index 6da1e70e..dc8eca14 100644 --- a/internal/frontend/bridge-gui/bridge-gui/main.cpp +++ b/internal/frontend/bridge-gui/bridge-gui/main.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #ifdef Q_OS_MACOS @@ -285,7 +284,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); // must be called before instantiating the BridgeApp } - QtWebView::initialize(); BridgeApp guiApp(argc, argv); initSentry(); auto sentryCloser = qScopeGuard([] { sentry_close(); }); diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml index 09d18726..7bd9f4b6 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Bridge.qml @@ -40,9 +40,6 @@ QtObject { function onHideMainWindow() { mainWindow.hide(); } - function onShowWebFrameOverlayHTML(html) { - mainWindow.showWebFrameOverlayHTML(html) - } target: Backend } } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml index 03498eca..7d012e84 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/MainWindow.qml @@ -67,10 +67,6 @@ ApplicationWindow { function showSettings() { contentWrapper.showSettings(); } - function showWebFrameOverlayHTML(html) { - webFrameOverlay.loadHTML(html); - webFrameOverlay.visible = true; - } colorScheme: ProtonStyle.currentStyle height: ProtonStyle.window_default_height @@ -178,14 +174,6 @@ ApplicationWindow { } } } - WebFrame { - id: webFrameOverlay - anchors.fill: parent - colorScheme: root.colorScheme - overlay: true - url: "" - visible: false - } NotificationPopups { colorScheme: root.colorScheme mainWindow: root diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml deleted file mode 100644 index 9bfe5eba..00000000 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/WebFrame.qml +++ /dev/null @@ -1,83 +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.Layouts -import QtQuick.Controls -import QtQuick.Controls.impl -import QtWebView - -Item { - id: root - - property ColorScheme colorScheme - property bool overlay: true - property string url: "" - - function loadHTML(html) { - webView.loadHtml(html) - } - - Rectangle { - anchors.fill: parent - color: "#000" - opacity: ProtonStyle.web_view_overlay_opacity - visible: overlay - } - Rectangle { - anchors.fill: parent - anchors.bottomMargin: overlay ? ProtonStyle.web_view_overlay_vertical_margin : 0 - anchors.leftMargin: overlay ? ProtonStyle.web_view_overlay_horizontal_margin : 0 - anchors.rightMargin: overlay ? ProtonStyle.web_view_overlay_horizontal_margin : 0 - anchors.topMargin: overlay ? ProtonStyle.web_view_overlay_vertical_margin : 0 - color: root.colorScheme.background_norm - radius: ProtonStyle.web_view_corner_radius - - ColumnLayout { - anchors.bottomMargin: 0 - anchors.fill: parent - anchors.leftMargin: overlay ? ProtonStyle.web_view_overlay_horizontal_padding : 0 - anchors.rightMargin: overlay ? ProtonStyle.web_view_overlay_horizontal_padding : 0 - anchors.topMargin: overlay ? ProtonStyle.web_view_overlay_vertical_padding : 0 - spacing: 0 - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - border.color: root.colorScheme.border_norm - border.width: overlay ? ProtonStyle.web_view_overley_border_width : 0 - - WebView { - id: webView - anchors.fill: parent - anchors.margins: ProtonStyle.web_view_overley_border_width - url: root.url - } - } - Button { - Layout.alignment: Qt.AlignCenter - Layout.bottomMargin: ProtonStyle.web_view_overlay_button_vertical_margin - Layout.preferredWidth: ProtonStyle.web_view_button_width - Layout.topMargin: ProtonStyle.web_view_overlay_button_vertical_margin - colorScheme: root.colorScheme - text: qsTr("Close") - visible: overlay - - onClicked: { - root.url = ""; - root.visible = false; - } - } - } - } -} diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml index 0def652c..054f66f6 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml @@ -26,7 +26,8 @@ Item { function showAppleMailAutoconfigCertificateInstall() { showAppleMailAutoconfigCommon(); descriptionLabel.text = qsTr("Apple Mail configuration is mostly automated, but in order to work, Bridge needs to install a certificate in your keychain."); - linkLabel1.setCallback(function() { Backend.showHelpOverlay("WhyCertificate.html"); }, qsTr("Why is this certificate needed?"), false); + linkLabel1.setLink("https://proton.me/support/bridge", qsTr("Why is this certificate needed?"), true); ///< TODO GODT-2772: replace link with link to KB article. + linkLabel2.clear(); } function showAppleMailAutoconfigCommon() { titleLabel.text = ""; @@ -39,7 +40,7 @@ Item { function showAppleMailAutoconfigProfileInstall() { showAppleMailAutoconfigCommon(); descriptionLabel.text = qsTr("The final step before you can start using Apple Mail is to install the Bridge server profile in the system preferences.\n\nAdding a server profile is necessary to ensure that your Mac can receive and send Proton Mails."); - linkLabel1.setCallback(function() { Backend.showHelpOverlay("WhyProfileWarning.html"); }, qsTr("Why is there a yellow warning sign?"), false); + linkLabel1.setLink("https://proton.me/support/bridge", qsTr("Why is there a yellow warning sign?"), true); ///< TODO GODT-2772: replace link with link to KB article. linkLabel2.setCallback(wizard.showClientParams, qsTr("Configure Apple Mail manually"), false); } function showClientSelector(newAccount = true) { @@ -63,7 +64,7 @@ Item { function showOnboarding() { titleLabel.text = (Backend.users.count === 0) ? qsTr("Welcome to\nProton Mail Bridge") : qsTr("Add a Proton Mail account"); descriptionLabel.text = qsTr("Bridge is the gateway between your Proton account and your email client. It runs in the background and encrypts and decrypts your messages seamlessly. "); - linkLabel1.setCallback(function() { Backend.showHelpOverlay("WhyBridge.html"); }, qsTr("Why do I need Bridge?"), false); + linkLabel1.setLink("https://proton.me/support/bridge", qsTr("Why do I need Bridge?"), true); ///< TODO GODT-2772: replace link with link to KB article. linkLabel2.clear(); root.iconSource = "/qml/icons/img-welcome.svg"; root.iconHeight = 148;