summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-11-17 19:41:21 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2024-11-17 19:42:22 +0100
commitae9d8ba4aed22028ab3412460b9d4c8d390a7264 (patch)
treeb5df79484dae623d7ce0c99c3ac8ecfdc04cf819 /resources/qml
parentMerge pull request #1804 from Laevos/laevos/fix-untrusted-source-message (diff)
downloadnheko-ae9d8ba4aed22028ab3412460b9d4c8d390a7264.tar.xz
Try to improve the native menu situation on Qt 6.8
Diffstat (limited to '')
-rw-r--r--resources/qml/CommunitiesList.qml7
-rw-r--r--resources/qml/MessageView.qml20
-rw-r--r--resources/qml/RoomList.qml23
-rw-r--r--resources/qml/TopBar.qml9
-rw-r--r--resources/qml/components/SpaceMenuLevel.qml2
5 files changed, 51 insertions, 10 deletions
diff --git a/resources/qml/CommunitiesList.qml b/resources/qml/CommunitiesList.qml
index 2b0be72c..a1344749 100644
--- a/resources/qml/CommunitiesList.qml
+++ b/resources/qml/CommunitiesList.qml
@@ -209,6 +209,13 @@ Page {
                 popup(parent);
             }
 
+            Component.onCompleted: {
+                if (communityContextMenu.popupType != undefined) {
+                    communityContextMenu.popupType = 2; // Popup.Native with fallback on older Qt (<6.8.0)
+                }
+            }
+
+
             MenuItem {
                 checkable: true
                 checked: communityContextMenu.muted
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index a49761b2..b8315bca 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -447,6 +447,12 @@ Item {
             ReportMessage {}
         }
 
+        Component.onCompleted: {
+            if (messageContextMenuC.popupType != undefined) {
+                messageContextMenuC.popupType = 2; // Popup.Native with fallback on older Qt (<6.8.0)
+            }
+        }
+
         MenuItem {
             enabled: visible
             text: qsTr("Go to &message")
@@ -472,6 +478,7 @@ Item {
             onTriggered: Clipboard.text = messageContextMenuC.link
         }
         MenuItem {
+            enabled: visible
             id: reactionOption
 
             text: qsTr("Re&act")
@@ -483,6 +490,7 @@ Item {
                 })
         }
         MenuItem {
+            enabled: visible
             text: qsTr("Repl&y")
             visible: room ? room.permissions.canSend(MtxEvent.TextMessage) : false
 
@@ -510,11 +518,13 @@ Item {
             onTriggered: visible && room.pinnedMessages.includes(messageContextMenuC.eventId) ? room.unpin(messageContextMenuC.eventId) : room.pin(messageContextMenuC.eventId)
         }
         MenuItem {
+            enabled: visible
             text: qsTr("&Read receipts")
 
             onTriggered: room.showReadReceipts(messageContextMenuC.eventId)
         }
         MenuItem {
+            enabled: visible
             text: qsTr("&Forward")
             visible: messageContextMenuC.eventType == MtxEvent.ImageMessage || messageContextMenuC.eventType == MtxEvent.VideoMessage || messageContextMenuC.eventType == MtxEvent.AudioMessage || messageContextMenuC.eventType == MtxEvent.FileMessage || messageContextMenuC.eventType == MtxEvent.Sticker || messageContextMenuC.eventType == MtxEvent.TextMessage || messageContextMenuC.eventType == MtxEvent.LocationMessage || messageContextMenuC.eventType == MtxEvent.EmoteMessage || messageContextMenuC.eventType == MtxEvent.NoticeMessage
 
@@ -526,9 +536,11 @@ Item {
             }
         }
         MenuItem {
+            enabled: visible
             text: qsTr("&Mark as read")
         }
         MenuItem {
+            enabled: visible
             text: qsTr("View raw message")
 
             onTriggered: room.viewRawMessage(messageContextMenuC.eventId)
@@ -542,6 +554,7 @@ Item {
             onTriggered: room.viewDecryptedRawMessage(messageContextMenuC.eventId)
         }
         MenuItem {
+            enabled: visible
             text: qsTr("Remo&ve message")
             visible: (room ? room.permissions.canRedact() : false) || messageContextMenuC.isSender
 
@@ -605,6 +618,13 @@ Item {
             open();
         }
 
+        Component.onCompleted: {
+            if (replyContextMenuC.popupType != undefined) {
+                replyContextMenuC.popupType = 2; // Popup.Native with fallback on older Qt (<6.8.0)
+            }
+        }
+
+
         MenuItem {
             enabled: visible
             text: qsTr("&Copy")
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index 44a3e333..4557b5a3 100644
--- a/resources/qml/RoomList.qml
+++ b/resources/qml/RoomList.qml
@@ -732,14 +732,6 @@ Page {
                 }
             }
         }
-        Component {
-            id: nestedSpaceMenuLevel
-
-            SpaceMenuLevel {
-                childMenu: rootSpaceMenu.childMenu
-                roomid: roomContextMenu.roomid
-            }
-        }
         Menu {
             id: roomContextMenu
 
@@ -752,6 +744,21 @@ Page {
                 popup(parent);
             }
 
+            Component.onCompleted: {
+                if (roomContextMenu.popupType != undefined) {
+                    roomContextMenu.popupType = 2; // Popup.Native with fallback on older Qt (<6.8.0)
+                }
+            }
+
+            Component {
+                id: nestedSpaceMenuLevel
+
+                SpaceMenuLevel {
+                    childMenu: rootSpaceMenu.childMenu
+                    roomid: roomContextMenu.roomid
+                }
+            }
+
             InputDialog {
                 id: newTag
 
diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml
index 4ffa2ecb..0bdd4ab8 100644
--- a/resources/qml/TopBar.qml
+++ b/resources/qml/TopBar.qml
@@ -239,9 +239,16 @@ Pane {
                 Menu {
                     id: roomOptionsMenu
 
+                    Component.onCompleted: {
+                        if (roomOptionsMenu.popupType != undefined) {
+                            roomOptionsMenu.popupType = 2; // Popup.Native with fallback on older Qt (<6.8.0)
+                        }
+                    }
+
+
                     MenuItem {
                         text: qsTr("Invite users")
-                        visible: room ? room.permissions.canInvite() : false
+                        enabled: room ? room.permissions.canInvite() : false
 
                         onTriggered: TimelineManager.openInviteUsers(roomId)
                     }
diff --git a/resources/qml/components/SpaceMenuLevel.qml b/resources/qml/components/SpaceMenuLevel.qml
index e191b32b..570e115d 100644
--- a/resources/qml/components/SpaceMenuLevel.qml
+++ b/resources/qml/components/SpaceMenuLevel.qml
@@ -82,7 +82,7 @@ Menu {
         onObjectAdded: (idx, o) => {
             spacesMenu.insertMenu(idx + (spacesMenu.position != -1 ? 6 : 0), o)
         }
-        //onObjectRemoved: spacesMenu.removeMenu(object)
+        onObjectRemoved: (index, object) => tagsMenu.removeItem(object)
 
         delegate: childMenu
     }