From 13f05a09952f665ed3b69c9e2e6c4c7488ba52f4 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Thu, 5 Jan 2023 14:56:29 +0000 Subject: [PATCH] Move invite option to header of members section This patch moves the invite option to header of members section. We also check if user can send invitation event and we won't show the invite button if it's not allowed. This patch also added an toggle button to show the member search bar since it won't needed by the user in most of the cases. --- src/qml/Panel/RoomDrawer.qml | 37 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/qml/Panel/RoomDrawer.qml b/src/qml/Panel/RoomDrawer.qml index 4a0b697a4..d36516089 100644 --- a/src/qml/Panel/RoomDrawer.qml +++ b/src/qml/Panel/RoomDrawer.qml @@ -198,18 +198,6 @@ Kirigami.OverlayDrawer { }) } } - Kirigami.BasicListItem { - id: inviteButton - - Layout.alignment: Qt.AlignRight - icon: "list-add-user" - text: i18n("Invite user to room") - - onClicked: { - applicationWindow().pageStack.layers.push("qrc:/InviteUserPage.qml", {room: room}) - roomDrawer.close(); - } - } Kirigami.BasicListItem { id: favouriteButton @@ -236,6 +224,30 @@ Kirigami.OverlayDrawer { Kirigami.ListSectionHeader { label: i18n("Members") activeFocusOnTab: false + spacing: 0 + + QQC2.ToolButton { + id: memberSearchToggle + checkable: true + icon.name: "search" + QQC2.ToolTip.text: i18n("Search user in room") + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + } + + QQC2.ToolButton { + visible: roomDrawer.room.canSendState("invite") + icon.name: "list-add-user" + + onClicked: { + applicationWindow().pageStack.layers.push("qrc:/InviteUserPage.qml", {room: roomDrawer.room}) + roomDrawer.close(); + } + + QQC2.ToolTip.text: i18n("Invite user to room") + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + } QQC2.Label { Layout.alignment: Qt.AlignRight @@ -245,6 +257,7 @@ Kirigami.OverlayDrawer { Kirigami.SearchField { id: userListSearchField + visible: memberSearchToggle.checked Layout.fillWidth: true Layout.leftMargin: Kirigami.Units.largeSpacing - 1