mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 07:06:45 +00:00
feat(GODT-2770): proof of concept for web view as a tool window.
This commit is contained in:
@ -272,6 +272,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
|
|||||||
void hideMainWindow(); ///< Signal for the 'hideMainWindow' gRPC stream event.
|
void hideMainWindow(); ///< Signal for the 'hideMainWindow' gRPC stream event.
|
||||||
void showHelp(); ///< Signal for the 'showHelp' event (from the context menu).
|
void showHelp(); ///< Signal for the 'showHelp' event (from the context menu).
|
||||||
void showSettings(); ///< 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 selectUser(QString const& userID, bool forceShowWindow); ///< Signal emitted in order to selected a user with a given ID in the list.
|
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 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.
|
void imapLoginWhileSignedOut(QString const& username); ///< Signal for the notification of IMAP login attempt on a signed out account.
|
||||||
|
|||||||
@ -100,6 +100,7 @@
|
|||||||
<file>qml/Proton/TextArea.qml</file>
|
<file>qml/Proton/TextArea.qml</file>
|
||||||
<file>qml/Proton/TextField.qml</file>
|
<file>qml/Proton/TextField.qml</file>
|
||||||
<file>qml/Proton/Toggle.qml</file>
|
<file>qml/Proton/Toggle.qml</file>
|
||||||
|
<file>qml/Proton/WebView.qml</file>
|
||||||
<file>qml/Proton/WebViewOverlay.qml</file>
|
<file>qml/Proton/WebViewOverlay.qml</file>
|
||||||
<file>qml/QuestionItem.qml</file>
|
<file>qml/QuestionItem.qml</file>
|
||||||
<file>qml/Resources/bug_report_flow.json</file>
|
<file>qml/Resources/bug_report_flow.json</file>
|
||||||
@ -111,5 +112,6 @@
|
|||||||
<file>qml/SplashScreen.qml</file>
|
<file>qml/SplashScreen.qml</file>
|
||||||
<file>qml/Status.qml</file>
|
<file>qml/Status.qml</file>
|
||||||
<file>qml/WelcomeGuide.qml</file>
|
<file>qml/WelcomeGuide.qml</file>
|
||||||
|
<file>qml/WebViewWindow.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -69,6 +69,21 @@ QtObject {
|
|||||||
Backend.setNormalTrayIcon();
|
Backend.setNormalTrayIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
property WebViewWindow _webviewWindow: WebViewWindow {
|
||||||
|
id: webViewWindow
|
||||||
|
flags: Qt.Tool
|
||||||
|
transientParent: mainWindow
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onShowWebViewWindow(url) {
|
||||||
|
webViewWindow.url = url;
|
||||||
|
webViewWindow.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: Backend
|
||||||
|
}
|
||||||
|
}
|
||||||
property var title: Backend.appname
|
property var title: Backend.appname
|
||||||
|
|
||||||
function bound(num, lowerLimit, upperLimit) {
|
function bound(num, lowerLimit, upperLimit) {
|
||||||
|
|||||||
@ -104,7 +104,7 @@ SettingsView {
|
|||||||
type: Label.Caption
|
type: Label.Caption
|
||||||
|
|
||||||
onLinkActivated: function (link) {
|
onLinkActivated: function (link) {
|
||||||
Qt.openUrlExternally(link);
|
Backend.showWebViewWindow(link)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,6 +191,16 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebView {
|
||||||
|
id: webViewOverlay
|
||||||
|
anchors.fill: parent
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
overlay: true
|
||||||
|
url: ""
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
NotificationPopups {
|
NotificationPopups {
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
mainWindow: root
|
mainWindow: root
|
||||||
@ -200,11 +210,4 @@ ApplicationWindow {
|
|||||||
id: splashScreen
|
id: splashScreen
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
}
|
}
|
||||||
WebViewOverlay {
|
|
||||||
id: webViewOverlay
|
|
||||||
anchors.fill: parent
|
|
||||||
colorScheme: root.colorScheme
|
|
||||||
url: ""
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,41 +16,47 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.impl
|
import QtQuick.Controls.impl
|
||||||
import QtWebView
|
import QtWebView
|
||||||
import QtQuick.Templates as T
|
|
||||||
import "." as Proton
|
import "." as Proton
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property ColorScheme colorScheme
|
property ColorScheme colorScheme
|
||||||
property url url
|
property bool overlay: true
|
||||||
|
property string url: ""
|
||||||
|
|
||||||
|
function showBlankPage() {
|
||||||
|
webView.loadHtml("<!doctype html><meta charset=utf-8><title>blank</title>", "blank.html");
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "#000"
|
color: "#000"
|
||||||
opacity: ProtonStyle.web_view_overlay_opacity
|
opacity: ProtonStyle.web_view_overlay_opacity
|
||||||
|
visible: overlay
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: ProtonStyle.web_view_overlay_margin
|
anchors.margins: overlay ? ProtonStyle.web_view_overlay_margin : 0
|
||||||
color: root.colorScheme.background_norm
|
color: root.colorScheme.background_norm
|
||||||
radius: ProtonStyle.web_view_corner_radius
|
radius: ProtonStyle.web_view_corner_radius
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.bottomMargin: 0
|
anchors.bottomMargin: 0
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: ProtonStyle.web_view_overlay_horizontal_margin
|
anchors.leftMargin: overlay ? ProtonStyle.web_view_overlay_horizontal_margin : 0
|
||||||
anchors.rightMargin: ProtonStyle.web_view_overlay_horizontal_margin
|
anchors.rightMargin: overlay ? ProtonStyle.web_view_overlay_horizontal_margin : 0
|
||||||
anchors.topMargin: ProtonStyle.web_view_overlay_vertical_margin
|
anchors.topMargin: overlay ? ProtonStyle.web_view_overlay_vertical_margin : 0
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
border.color: root.colorScheme.border_norm
|
border.color: root.colorScheme.border_norm
|
||||||
border.width: ProtonStyle.web_view_overley_border_width
|
border.width: overlay ? ProtonStyle.web_view_overley_border_width : 0
|
||||||
|
|
||||||
WebView {
|
WebView {
|
||||||
|
id: webView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: ProtonStyle.web_view_overley_border_width
|
anchors.margins: ProtonStyle.web_view_overley_border_width
|
||||||
url: root.url
|
url: root.url
|
||||||
@ -63,6 +69,7 @@ Item {
|
|||||||
Layout.topMargin: ProtonStyle.web_view_overlay_button_vertical_margin
|
Layout.topMargin: ProtonStyle.web_view_overlay_button_vertical_margin
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("Close")
|
text: qsTr("Close")
|
||||||
|
visible: overlay
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.url = "";
|
root.url = "";
|
||||||
@ -36,4 +36,4 @@ Switch 4.0 Switch.qml
|
|||||||
TextArea 4.0 TextArea.qml
|
TextArea 4.0 TextArea.qml
|
||||||
TextField 4.0 TextField.qml
|
TextField 4.0 TextField.qml
|
||||||
Toggle 4.0 Toggle.qml
|
Toggle 4.0 Toggle.qml
|
||||||
WebViewOverlay 4.0 WebViewOverlay.qml
|
WebView 4.0 WebView.qml
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
// 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 <https://www.gnu.org/licenses/>.
|
||||||
|
import QtQml
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import Proton
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id: root
|
||||||
|
height: 600
|
||||||
|
width: 800
|
||||||
|
minimumWidth: 600
|
||||||
|
property string url
|
||||||
|
WebView {
|
||||||
|
anchors.fill: parent
|
||||||
|
colorScheme: ProtonStyle.currentStyle
|
||||||
|
overlay: false
|
||||||
|
url: root.url
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user