From ed6379ff85cff76ee4f799d4fee754e91e81d059 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sun, 30 Jul 2023 15:41:40 +0200 Subject: [PATCH] Fix opening account menu on right click (cherry picked from commit 5f41b7b4c19063583cf631f41240fb15ac9513e7) --- src/qml/Page/RoomList/UserInfo.qml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/qml/Page/RoomList/UserInfo.qml b/src/qml/Page/RoomList/UserInfo.qml index 84ea9c5bf..4724463fd 100644 --- a/src/qml/Page/RoomList/UserInfo.qml +++ b/src/qml/Page/RoomList/UserInfo.qml @@ -146,24 +146,34 @@ QQC2.ToolBar { Layout.minimumHeight: Kirigami.Units.gridUnit * 2 - 2 // HACK: -2 here is to ensure the ChatBox and the UserInfo have the same height QQC2.AbstractButton { + id: accountButton + Layout.preferredWidth: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing Layout.preferredHeight: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing Layout.leftMargin: Kirigami.Units.largeSpacing TapHandler { - acceptedButtons: Qt.RightButton - acceptedDevices: PointerDevice.Mouse - onTapped: accountMenu.open() + acceptedButtons: Qt.RightButton | Qt.LeftButton + acceptedDevices: PointerDevice.Mouse + onTapped: (eventPoint, button) => { + // TODO Qt6 remove + if (!button) { + button = eventPoint.event.button; + } + if (button == Qt.RightButton) { + accountMenu.open(); + } else { + pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/AccountEditorPage.qml'), { + connection: Controller.activeConnection + }, { + title: i18n("Account editor") + }); + } + } } text: i18n("Edit this account") - onClicked: pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/AccountEditorPage.qml'), { - connection: Controller.activeConnection - }, { - title: i18n("Account editor") - }); - contentItem: KirigamiComponents.Avatar { readonly property string mediaId: Controller.activeConnection.localUser.avatarMediaId