From 46e23542749aea93be132e74b48d62cfcdba9498 Mon Sep 17 00:00:00 2001
From: "capucine.berthet" <capucine.berthet@savoirfairelinux.com>
Date: Tue, 22 Aug 2023 13:33:24 -0400
Subject: [PATCH] messageBar: display "showLess" when needed

GitLab: #1309
GitLab: #1125
Change-Id: I2b443750731170bebe3532338517e5e0e0ed594b
---
 src/app/constant/JamiStrings.qml           | 1 +
 src/app/mainview/components/MessageBar.qml | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml
index bb0245a8a..4d6cbfb25 100644
--- a/src/app/constant/JamiStrings.qml
+++ b/src/app/constant/JamiStrings.qml
@@ -720,6 +720,7 @@ Item {
     property string leaveAudioMessage: qsTr("Audio message")
     property string leaveVideoMessage: qsTr("Video message")
     property string showMore: qsTr("Show more")
+    property string showLess: qsTr("Show less")
 
     property string bold: qsTr("Bold")
     property string italic: qsTr("Italic")
diff --git a/src/app/mainview/components/MessageBar.qml b/src/app/mainview/components/MessageBar.qml
index ab149b5c0..57d295fc6 100644
--- a/src/app/mainview/components/MessageBar.qml
+++ b/src/app/mainview/components/MessageBar.qml
@@ -98,6 +98,7 @@ RowLayout {
                     showMoreButton.indicator.color = hovered ? JamiTheme.chatViewFooterImgHoverColor : JamiTheme.chatViewFooterImgColor;
                     showMoreButton.background.color = hovered ? JamiTheme.hoveredButtonColor : JamiTheme.transparentColor;
                 }
+                toolTipMoreButton.text = sharePopup.opened ? JamiStrings.showLess : JamiStrings.showMore;
             }
 
             popup: SharePopup {
@@ -718,11 +719,10 @@ RowLayout {
 
                                 MaterialToolTip {
                                     id: toolTip
-
                                     parent: showMoreTypoButton
                                     visible: showMoreTypoButton.hovered && (text.length > 0)
                                     delay: Qt.styleHints.mousePressAndHoldInterval
-                                    text: JamiStrings.showMore
+                                    text: markdownPopup.visible ? JamiStrings.showLess : JamiStrings.showMore
                                 }
 
                                 background: Rectangle {
@@ -747,6 +747,7 @@ RowLayout {
                                 }
 
                                 popup: MarkdownPopup {
+                                    id: markdownPopup
                                     y: 1.5 * parent.height
                                     x: -parent.width * 2
                                     width: 155
-- 
GitLab