From e9e1e223f7c1f25bcc948b493688f26d55f6fcc9 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 5 Nov 2023 15:07:19 -0500 Subject: [PATCH] Allow right-clicking on a room without selecting it Same idea as the fix I did for spaces, we introduce a new signal called selected instead of using ItemDelegate's button signals. --- src/qml/ChooseRoomDialog.qml | 2 +- src/qml/QuickSwitcher.qml | 2 +- src/qml/RoomDelegate.qml | 12 ++++++++++-- src/qml/RoomListPage.qml | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/qml/ChooseRoomDialog.qml b/src/qml/ChooseRoomDialog.qml index 42ce72859..ee17240ee 100644 --- a/src/qml/ChooseRoomDialog.qml +++ b/src/qml/ChooseRoomDialog.qml @@ -31,7 +31,7 @@ Kirigami.ScrollablePage { delegate: RoomDelegate { id: roomDelegate filterText: "" - onClicked: { + onSelected: { root.chosen(roomDelegate.currentRoom.id) } connection: root.connection diff --git a/src/qml/QuickSwitcher.qml b/src/qml/QuickSwitcher.qml index ea3267b95..ff52440cf 100644 --- a/src/qml/QuickSwitcher.qml +++ b/src/qml/QuickSwitcher.qml @@ -94,7 +94,7 @@ QQC2.Dialog { connection: root.connection - onClicked: { + onSelected: { RoomManager.enterRoom(currentRoom); root.close() } diff --git a/src/qml/RoomDelegate.qml b/src/qml/RoomDelegate.qml index 25965c097..8c973b7c4 100644 --- a/src/qml/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -31,13 +31,21 @@ Delegates.RoundedItemDelegate { readonly property bool hasNotifications: notificationCount > 0 + signal selected() + Accessible.name: root.displayName onPressAndHold: createRoomListContextMenu() TapHandler { - acceptedButtons: Qt.RightButton - onTapped: createRoomListContextMenu() + acceptedButtons: Qt.RightButton | Qt.LeftButton + onTapped: (eventPoint, button) => { + if (button === Qt.RightButton) { + root.createRoomListContextMenu(); + } else { + root.selected(); + } + } } contentItem: RowLayout { diff --git a/src/qml/RoomListPage.qml b/src/qml/RoomListPage.qml index 4b987d39c..4f44c3df8 100644 --- a/src/qml/RoomListPage.qml +++ b/src/qml/RoomListPage.qml @@ -278,7 +278,7 @@ Kirigami.Page { visible: categoryVisible || filterText.length > 0 || Config.mergeRoomList - onClicked: RoomManager.enterRoom(currentRoom) + onSelected: RoomManager.enterRoom(currentRoom) Keys.onEnterPressed: RoomManager.enterRoom(currentRoom) Keys.onReturnPressed: RoomManager.enterRoom(currentRoom)