feat(GODT-3121): added tooltip for KB suggestions.

This commit is contained in:
Xavier Michelon 2023-12-04 11:12:53 +01:00
parent 3a66063938
commit 6e2e622a2f
5 changed files with 75 additions and 7 deletions

View File

@ -96,6 +96,7 @@
<file>qml/Proton/ColorScheme.qml</file>
<file>qml/Proton/ComboBox.qml</file>
<file>qml/Proton/Dialog.qml</file>
<file>qml/Proton/InfoTooltip.qml</file>
<file>qml/Proton/Label.qml</file>
<file>qml/Proton/LinkLabel.qml</file>
<file>qml/Proton/Menu.qml</file>

View File

@ -82,11 +82,17 @@ SettingsView {
id: suggestionBox
visible: suggestions && suggestions.length > 0
spacing: 8
Label {
colorScheme: root.colorScheme
text: qsTr("We believe these links might be relevant for your problem")
type: Label.Body_semibold
RowLayout {
Label {
colorScheme: root.colorScheme
text: qsTr("We believe these links may help you solve your problem")
type: Label.Body_semibold
}
InfoTooltip {
colorScheme: root.colorScheme
text: qsTr("The links will open in an external browser. If you cancel the report, your input will be preserved until you restart Bridge.")
Layout.bottomMargin: -4
}
}
Repeater {
model: suggestions

View File

@ -0,0 +1,59 @@
// 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 QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ColorImage {
property var colorScheme
property string text
id: root
Layout.alignment: Qt.AlignVCenter
Layout.bottomMargin: root._bottomMargin
color: root.colorScheme.interaction_norm
height: sourceSize.height
width: sourceSize.width
source: "/qml/icons/ic-info-circle.svg"
sourceSize.height: 16
sourceSize.width: 16
visible: root.hint !== ""
MouseArea {
id: imageArea
anchors.fill: parent
hoverEnabled: true
}
ToolTip {
id: toolTipinfo
text: root.text
visible: imageArea.containsMouse
implicitWidth: Math.min(400, tooltipText.implicitWidth)
background: Rectangle {
radius: 4
border.color: root.colorScheme.border_weak
color: root.colorScheme.background_weak
}
contentItem: Text {
id: tooltipText
color: root.colorScheme.text_norm
text: root.text
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}

View File

@ -64,11 +64,12 @@ RowLayout {
}
ColorImage {
Layout.alignment: Qt.AlignVCenter
Layout.bottomMargin: -6
color: label.linkColor
height: sourceSize.height
source: "/qml/icons/ic-external-link.svg"
sourceSize.height: 16
sourceSize.width: 16
sourceSize.height: 14
sourceSize.width: 14
visible: external
width: sourceSize.width

View File

@ -27,6 +27,7 @@ Button 4.0 Button.qml
CheckBox 4.0 CheckBox.qml
ComboBox 4.0 ComboBox.qml
Dialog 4.0 Dialog.qml
InfoTooltip 4.0 InfoTooltip.qml
Label 4.0 Label.qml
LinkLabel 4.0 LinkLabel.qml
Menu 4.0 Menu.qml