From 5e106ea66533d4fe969d8fafd5bada40218c3693 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 22 Mar 2023 15:51:32 -0400
Subject: [PATCH] tips: title should not go outside the box

Change-Id: I28ed5573adb50b4372f4b763d3565eefeb00ae35
GitLab: #1018
---
 src/app/mainview/components/BackupTipBox.qml  | 21 ++++++++++++-------
 .../mainview/components/CustomizeTipBox.qml   | 18 +++++++++-------
 .../mainview/components/InformativeTipBox.qml | 16 ++++++++------
 3 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/src/app/mainview/components/BackupTipBox.qml b/src/app/mainview/components/BackupTipBox.qml
index d58ef9c88..e239cbef4 100644
--- a/src/app/mainview/components/BackupTipBox.qml
+++ b/src/app/mainview/components/BackupTipBox.qml
@@ -31,6 +31,10 @@ Item {
     width: parent.width
     height: backupLayout.height
 
+    property var iconSize: 26
+    property var margin: 5
+    property var prefWidth: 170
+
     signal ignore
 
     ColumnLayout {
@@ -50,9 +54,9 @@ Item {
                 visible: !opened
 
                 Layout.alignment: Qt.AlignLeft
-                Layout.topMargin: 5
-                Layout.preferredWidth: 26
-                Layout.preferredHeight: 26
+                Layout.topMargin: root.margin
+                Layout.preferredWidth: root.iconSize
+                Layout.preferredHeight: root.iconSize
 
                 containerHeight: Layout.preferredHeight
                 containerWidth: Layout.preferredWidth
@@ -61,21 +65,22 @@ Item {
                 color: JamiTheme.buttonTintedBlue
             }
 
-            Label {
+            Text {
                 text: JamiStrings.backupAccountBtn
                 color: JamiTheme.textColor
                 font.weight: Font.Medium
-                Layout.topMargin: 5
+                Layout.topMargin: root.margin
                 visible: !opened
                 Layout.alignment: Qt.AlignLeft
-                Layout.leftMargin: 5
+                Layout.leftMargin: root.margin
+                Layout.preferredWidth: root.prefWidth - 2 * root.margin - root.iconSize
                 font.pixelSize: JamiTheme.tipBoxTitleFontSize
+                elide: Qt.ElideRight
             }
         }
 
         Text {
-
-            Layout.preferredWidth: 170
+            Layout.preferredWidth: root.prefWidth
             Layout.leftMargin: 20
             Layout.topMargin: 8
             Layout.bottomMargin: 15
diff --git a/src/app/mainview/components/CustomizeTipBox.qml b/src/app/mainview/components/CustomizeTipBox.qml
index d2d4dbf82..8aff49607 100644
--- a/src/app/mainview/components/CustomizeTipBox.qml
+++ b/src/app/mainview/components/CustomizeTipBox.qml
@@ -26,9 +26,12 @@ import net.jami.Constants 1.1
 import "../../commoncomponents"
 
 ColumnLayout {
-
+    id: column
     width: parent.width
 
+    property var iconSize: 26
+    property var margin: 5
+    property var prefWidth: 170
 
     RowLayout {
 
@@ -41,9 +44,9 @@ ColumnLayout {
             visible: !opened
 
             Layout.alignment: Qt.AlignLeft
-            Layout.topMargin: 5
-            Layout.preferredWidth: 26
-            Layout.preferredHeight: 26
+            Layout.topMargin: column.margin
+            Layout.preferredWidth: column.iconSize
+            Layout.preferredHeight: column.iconSize
 
             containerHeight: Layout.preferredHeight
             containerWidth: Layout.preferredWidth
@@ -56,16 +59,17 @@ ColumnLayout {
             text: JamiStrings.customize
             color: JamiTheme.textColor
             font.weight: Font.Medium
-            Layout.topMargin: 5
+            Layout.topMargin: column.margin
+            Layout.preferredWidth: column.prefWidth - 2 * column.margin - column.iconSize
             visible: !opened
             Layout.alignment: Qt.AlignLeft
-            Layout.leftMargin: 5
+            Layout.leftMargin: column.margin
             font.pixelSize: JamiTheme.tipBoxTitleFontSize
+            elide: Qt.ElideRight
         }
     }
 
     Text {
-
         Layout.preferredWidth: 170
         Layout.leftMargin: 20
         Layout.topMargin: 8
diff --git a/src/app/mainview/components/InformativeTipBox.qml b/src/app/mainview/components/InformativeTipBox.qml
index ca7fd846b..f5fbe9459 100644
--- a/src/app/mainview/components/InformativeTipBox.qml
+++ b/src/app/mainview/components/InformativeTipBox.qml
@@ -27,9 +27,12 @@ import "../../commoncomponents"
 
 
 ColumnLayout {
-
+    id: column
     width: parent.width
 
+    property var iconSize: 26
+    property var margin: 5
+    property var prefWidth: 170
 
     RowLayout {
 
@@ -42,9 +45,9 @@ ColumnLayout {
             visible: !opened
 
             Layout.alignment: Qt.AlignLeft
-            Layout.topMargin: 5
-            Layout.preferredWidth: 26
-            Layout.preferredHeight: 26
+            Layout.topMargin: column.margin
+            Layout.preferredWidth: column.iconSize
+            Layout.preferredHeight: column.iconSize
 
             containerHeight: Layout.preferredHeight
             containerWidth: Layout.preferredWidth
@@ -57,16 +60,17 @@ ColumnLayout {
             text: JamiStrings.tip
             color: JamiTheme.textColor
             font.weight: Font.Medium
-            Layout.topMargin: 5
+            Layout.topMargin: column.margin
             visible: !opened
             Layout.alignment: Qt.AlignLeft
             Layout.leftMargin: 8
+            Layout.preferredWidth: column.prefWidth - 2 * column.margin - column.iconSize
             font.pixelSize: JamiTheme.tipBoxTitleFontSize
+            elide: Qt.ElideRight
         }
     }
 
     Text {
-
         Layout.preferredWidth: opened ? 140 : 150
         Layout.leftMargin: 20
         Layout.topMargin: opened ? 0 : 8
-- 
GitLab