From 5f0163df05a46fe991d6bde2e2f39682f7784b0f Mon Sep 17 00:00:00 2001
From: lcoursodon <liam.coursodon@savoirfairelinux.com>
Date: Tue, 24 Oct 2023 16:35:37 -0400
Subject: [PATCH] Menu: add some details on menu

GitLab: #1388
Change-Id: Ia38dbd15b176afcaf7c03b6612695ee5b6e89723
---
 .../commoncomponents/LineEditContextMenu.qml  |  6 +++--
 src/app/commoncomponents/ShowMoreMenu.qml     | 24 +++++++++---------
 .../contextmenu/GeneralMenuItem.qml           | 25 ++++++++++---------
 src/app/constant/JamiTheme.qml                |  2 +-
 .../components/CallViewContextMenu.qml        |  5 ++++
 src/app/mainview/components/MessageBar.qml    |  6 +++--
 6 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/src/app/commoncomponents/LineEditContextMenu.qml b/src/app/commoncomponents/LineEditContextMenu.qml
index 5cc63660c..67ba765d4 100644
--- a/src/app/commoncomponents/LineEditContextMenu.qml
+++ b/src/app/commoncomponents/LineEditContextMenu.qml
@@ -35,7 +35,8 @@ ContextMenuAutoLoader {
         GeneralMenuItem {
             id: copy
 
-            canTrigger: lineEditObj.selectedText.length
+            canTrigger: true
+            isActif: lineEditObj.selectedText.length
             itemName: JamiStrings.copy
             hasIcon: false
             onClicked: {
@@ -45,7 +46,8 @@ ContextMenuAutoLoader {
         GeneralMenuItem {
             id: cut
 
-            canTrigger: lineEditObj.selectedText.length && !selectOnly
+            canTrigger: true
+            isActif: lineEditObj.selectedText.length && !selectOnly
             itemName: JamiStrings.cut
             hasIcon: false
             onClicked: {
diff --git a/src/app/commoncomponents/ShowMoreMenu.qml b/src/app/commoncomponents/ShowMoreMenu.qml
index fcddfc84f..d5fef3f4a 100644
--- a/src/app/commoncomponents/ShowMoreMenu.qml
+++ b/src/app/commoncomponents/ShowMoreMenu.qml
@@ -45,10 +45,10 @@ BaseContextMenu {
         const listViewWidth = listView.width;
         if (isOutgoing) {
             const leftMargin = msgBubble.mapToItem(listView, 0, 0).x;
-            return width > leftMargin ? -leftMargin : -width;
+            return width > leftMargin ? -leftMargin - 20 : -width - 20;
         } else {
             const rightMargin = listViewWidth - (msgBubble.x + msgBubble.width);
-            return width > rightMargin ? msgBubble.width - width : msgBubble.width;
+            return width > rightMargin ? msgBubble.width - width + 20 : msgBubble.width + 20;
         }
     }
     function yPositionProvider(height) {
@@ -121,16 +121,6 @@ BaseContextMenu {
             addMenuSeparatorAfter: true
             messageId: msgId
         },
-        GeneralMenuItem {
-            id: copyMessage
-
-            canTrigger: true
-            iconSource: JamiResources.copy_svg
-            itemName: JamiStrings.copy
-            onClicked: {
-                UtilsAdapter.setClipboardText(msgBody);
-            }
-        },
         GeneralMenuItem {
             id: saveFile
 
@@ -182,6 +172,16 @@ BaseContextMenu {
             onClicked: {
                 MessagesAdapter.editMessage(CurrentConversation.id, "", root.msgId);
             }
+        },
+        GeneralMenuItem {
+            id: copyMessage
+
+            canTrigger: true
+            iconSource: JamiResources.copy_svg
+            itemName: JamiStrings.copy
+            onClicked: {
+                UtilsAdapter.setClipboardText(msgBody);
+            }
         }
     ]
 
diff --git a/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml b/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml
index 641126a92..5c85dc8bf 100644
--- a/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml
+++ b/src/app/commoncomponents/contextmenu/GeneralMenuItem.qml
@@ -36,6 +36,7 @@ MenuItem {
     property bool autoTextSizeAdjustment: true
     property bool dangerous: false
     property BaseContextMenu parentMenu
+    property bool isActif: true
 
     property int itemPreferredWidth: hasIcon ? 50 + contextMenuItemText.contentWidth + contextMenuItemImage.width : 35 + contextMenuItemText.contentWidth
     property int itemRealWidth: itemPreferredWidth
@@ -43,7 +44,7 @@ MenuItem {
     property int leftBorderWidth: JamiTheme.menuItemsCommonBorderWidth
     property int rightBorderWidth: JamiTheme.menuItemsCommonBorderWidth
 
-    property int itemImageLeftMargin: 18
+    property int itemImageLeftMargin: 10
     property int itemTextMargin: 10
 
     signal clicked
@@ -51,20 +52,20 @@ MenuItem {
 
     width: itemRealWidth
 
-    contentItem: AbstractButton {
+    contentItem: PushButton {
         id: menuItemContentRect
 
-        background: Rectangle {
-            id: background
+        enabled: isActif
+        hoverEnabled: isActif
 
-            anchors.fill: parent
-            anchors.leftMargin: 6
-            anchors.rightMargin: 6
+        hoveredColor: JamiTheme.hoverColor
+        normalColor: JamiTheme.primaryBackgroundColor
+        circled: false
+        radius: 5
 
-            radius: 5
-
-            color: menuItemContentRect.hovered ? JamiTheme.hoverColor : JamiTheme.primaryBackgroundColor
-        }
+        //duration: 1000
+        anchors.leftMargin: 6
+        anchors.rightMargin: 6
 
         anchors.fill: parent
 
@@ -95,7 +96,7 @@ MenuItem {
                     id: contextMenuItemText
                     height: parent.height
                     text: itemName
-                    color: dangerous ? JamiTheme.redColor : JamiTheme.textColor
+                    color: dangerous ? JamiTheme.redColor : isActif ? JamiTheme.textColor : JamiTheme.chatViewFooterImgColor
                     font.pointSize: JamiTheme.textFontSize
                     horizontalAlignment: Text.AlignLeft
                     verticalAlignment: Text.AlignVCenter
diff --git a/src/app/constant/JamiTheme.qml b/src/app/constant/JamiTheme.qml
index 1e486bf37..2010d8915 100644
--- a/src/app/constant/JamiTheme.qml
+++ b/src/app/constant/JamiTheme.qml
@@ -76,7 +76,7 @@ Item {
     property color greyBorderColor: "#333"
     property color selectionBlue: darkTheme ? "#0061a5" : "#109ede"
 
-    property color hoverColor: darkTheme ? "#4d4d4d" : "#c7c7c7"
+    property color hoverColor: darkTheme ? "#4d4d4d" : "#DEDEDE"
     property color pressColor: darkTheme ? "#777" : "#c0c0c0"
     property color selectedColor: darkTheme ? "#0e81c5" : "#e0e0e0"
     property color smartListHoveredColor: darkTheme ? "#4d4d4d" : "#dedede"
diff --git a/src/app/mainview/components/CallViewContextMenu.qml b/src/app/mainview/components/CallViewContextMenu.qml
index eab0b9a11..60321e51c 100644
--- a/src/app/mainview/components/CallViewContextMenu.qml
+++ b/src/app/mainview/components/CallViewContextMenu.qml
@@ -106,13 +106,18 @@ Popup {
                     height: Top || Bottom ? 10 : 45
 
                     background: Rectangle {
+                        radius: 5
                         visible: !Top && !Bottom
                         anchors.fill: parent
+                        anchors.leftMargin: 5
+                        anchors.rightMargin: 5
                         color: menuItem.down ? "#c4aaaaaa" : menuItem.hovered ? "#c4777777" : "transparent"
                     }
 
                     RowLayout {
                         anchors.fill: parent
+                        anchors.leftMargin: 5
+                        anchors.rightMargin: 5
                         visible: !Top && !Bottom
                         ResponsiveImage {
                             Layout.leftMargin: JamiTheme.preferredMarginSize
diff --git a/src/app/mainview/components/MessageBar.qml b/src/app/mainview/components/MessageBar.qml
index eee26aa67..07bed113e 100644
--- a/src/app/mainview/components/MessageBar.qml
+++ b/src/app/mainview/components/MessageBar.qml
@@ -61,6 +61,7 @@ RowLayout {
         color: JamiTheme.transparentColor
         ComboBox {
             id: showMoreButton
+            focus: true
             width: JamiTheme.chatViewFooterButtonSize
             height: JamiTheme.chatViewFooterButtonSize
             anchors.bottom: parent.bottom
@@ -96,6 +97,7 @@ RowLayout {
             }
 
             onHoveredChanged: {
+                console.log("Hovered changed");
                 if (!sharePopup.opened) {
                     showMoreButton.indicator.color = hovered ? JamiTheme.chatViewFooterImgHoverColor : JamiTheme.chatViewFooterImgColor;
                     showMoreButton.background.color = hovered ? JamiTheme.hoveredButtonColor : JamiTheme.transparentColor;
@@ -104,6 +106,7 @@ RowLayout {
             }
 
             onPressedChanged: {
+                console.log("Pressed changed");
                 if (sharePopup.enabled)
                     sharePopup.close();
             }
@@ -119,9 +122,8 @@ RowLayout {
                 onShowMapClicked: {
                     root.showMapClicked();
                 }
-                parent: root
                 modelList: listViewMoreButton.menuMoreButton
-                y: -160
+                y: -140
                 x: -20
             }
         }
-- 
GitLab