From 650ad49ab0124b3e625a6691e5396ab2ed9ec53b Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Tue, 24 Oct 2023 17:40:26 +0200 Subject: [PATCH] feat(GODT-3046): link in pop-up banner. --- .../bridge-gui/bridge-gui/qml/Banner.qml | 34 +++++++++++++++---- .../qml/Notifications/Notifications.qml | 3 +- .../bridge-gui/qml/Proton/LinkLabel.qml | 3 +- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Banner.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Banner.qml index 47a80893..aea135f8 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Banner.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Banner.qml @@ -84,6 +84,7 @@ Popup { anchors.topMargin: 14 spacing: 8 + ColorImage { Layout.preferredHeight: 24 Layout.preferredWidth: 24 @@ -108,14 +109,35 @@ Popup { sourceSize.width: 24 width: 24 } - Label { - Layout.alignment: Qt.AlignVCenter + ColumnLayout { + Layout.alignment: Qt.AlignTop Layout.fillWidth: true Layout.leftMargin: 16 - color: root.colorScheme.text_invert - colorScheme: root.colorScheme - text: root.notification ? root.notification.description : "" - wrapMode: Text.WordWrap + Label { + id: messageLabel + Layout.alignment: Qt.AlignTop + Layout.fillWidth: true + color: root.colorScheme.text_invert + colorScheme: root.colorScheme + text: root.notification ? root.notification.description : "" + wrapMode: Text.WordWrap + } + LinkLabel { + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + Layout.fillWidth: true + colorScheme: root.colorScheme + color: messageLabel.color + external: true + link: root.notification ? root.notification.linkUrl : "" + text: root.notification ? root.notification.linkText : "" + visible: root.notification && root.notification.linkUrl.length > 0 + } + // Label { + // color: root.colorScheme.text_invert + // colorScheme: root.colorScheme + // text: "Youpi!" + // wrapMode: Text.WordWrap + // } } } } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Notifications/Notifications.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Notifications/Notifications.qml index 785b4120..a6361450 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Notifications/Notifications.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Notifications/Notifications.qml @@ -716,7 +716,8 @@ QtObject { group: Notifications.Group.Connection icon: "./icons/ic-no-connection.svg" type: Notification.NotificationType.Danger - + linkUrl: "https://proton.me/support/bridge" + linkText: qsTr("What happens with my messages when internet is down?") Connections { function onInternetOff() { root.noInternet.active = true; diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/LinkLabel.qml b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/LinkLabel.qml index 49db82ed..a1a6f8ee 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/Proton/LinkLabel.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/Proton/LinkLabel.qml @@ -22,6 +22,7 @@ RowLayout { property bool external: false property string link: "#" property string text: "" + property color color: colorScheme.interaction_norm function clear() { root.callback = null; @@ -49,9 +50,9 @@ RowLayout { id: label Layout.alignment: Qt.AlignVCenter colorScheme: root.colorScheme + linkColor: root.color text: label.link(root.link, root.text) type: Label.LabelType.Body - onLinkActivated: function (link) { if ((link !== "#") && (link.length > 0)) { Qt.openUrlExternally(link);