From af40d555d4714285f4485676d8a04af6e39ec055 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 16 Nov 2024 14:25:12 +0000 Subject: [PATCH] Improve the layout and function of the room context menu The room context menu is a jumbled mess of actions, so the first idea of this commit is to organize them. The first item is "Mark as Read" because let's be honest, you're going to be using that the most. Then the next "group" of actions are what users can "do" with the room. This is like "Notification settings", "Favorite" and etc. Then there's room settings, and leave. Secondly, the "Favorite" action now uses the same icon we use elsewhere. Third, "Notification State" is a weird name for this action and renamed to simply "Notifications". Finally, the "Mark as Read" action is now disabled when there's nothing else to read. --- src/qml/ContextMenu.qml | 53 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/qml/ContextMenu.qml b/src/qml/ContextMenu.qml index bff25c285..041f8f2b8 100644 --- a/src/qml/ContextMenu.qml +++ b/src/qml/ContextMenu.qml @@ -27,38 +27,17 @@ Loader { Component { id: regularMenu QQC2.Menu { - QQC2.MenuItem { - text: room.isFavourite ? i18n("Remove from Favorites") : i18n("Add to Favorites") - icon.name: room.isFavourite ? "bookmark-remove" : "bookmark-new" - onTriggered: room.isFavourite ? room.removeTag("m.favourite") : room.addTag("m.favourite", 1.0) - } - - QQC2.MenuItem { - text: room.isLowPriority ? i18n("Reprioritize") : i18n("Deprioritize") - icon.name: room.isLowPriority ? "arrow-up-symbolic" : "arrow-down-symbolic" - onTriggered: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0) - } - QQC2.MenuItem { text: i18n("Mark as Read") icon.name: "checkmark" + enabled: room.notificationCount > 0 onTriggered: room.markAllMessagesAsRead() } - QQC2.MenuItem { - text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard") - icon.name: "edit-copy" - onTriggered: if (room.isDirectChat()) { - Clipboard.saveText(room.directChatRemoteMember.id); - } else if (room.canonicalAlias.length === 0) { - Clipboard.saveText(room.id); - } else { - Clipboard.saveText(room.canonicalAlias); - } - } + QQC2.MenuSeparator {} QQC2.Menu { - title: i18n("Notification State") + title: i18nc("@action:inmenu", "Notifications") icon.name: "notifications" QQC2.MenuItem { @@ -107,6 +86,32 @@ Loader { } } + QQC2.MenuItem { + text: room.isFavourite ? i18n("Remove from Favorites") : i18n("Add to Favorites") + icon.name: room.isFavourite ? "rating" : "rating-unrated" + onTriggered: room.isFavourite ? room.removeTag("m.favourite") : room.addTag("m.favourite", 1.0) + } + + QQC2.MenuItem { + text: room.isLowPriority ? i18n("Reprioritize") : i18n("Deprioritize") + icon.name: room.isLowPriority ? "arrow-up-symbolic" : "arrow-down-symbolic" + onTriggered: room.isLowPriority ? room.removeTag("m.lowpriority") : room.addTag("m.lowpriority", 1.0) + } + + QQC2.MenuSeparator {} + + QQC2.MenuItem { + text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard") + icon.name: "edit-copy" + onTriggered: if (room.isDirectChat()) { + Clipboard.saveText(room.directChatRemoteMember.id); + } else if (room.canonicalAlias.length === 0) { + Clipboard.saveText(room.id); + } else { + Clipboard.saveText(room.canonicalAlias); + } + } + QQC2.MenuItem { text: i18nc("@action:inmenu", "Room Settings") icon.name: 'settings-configure-symbolic'