From a493b0cf6105a4ac5be3db3fdc87771bee7dc429 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 13 Dec 2019 17:04:56 -0400 Subject: [PATCH] Add "invite members" to room context menu --- TODO.md | 3 ++- src/qml/MainPane/RoomDelegate.qml | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index eb515100..97a36c79 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,6 @@ # TODO -- invite keybind & context menu +- invite keybind - better cancel for all boxes + disablewhileloading false - use defaulttext/checked elsewhere @@ -134,6 +134,7 @@ ## Backend +- Saving the room settings - Refetch profile after manual profile change, don't wait for a room event - Prevent starting multiple client instances, causes problems with E2E DB diff --git a/src/qml/MainPane/RoomDelegate.qml b/src/qml/MainPane/RoomDelegate.qml index d8596b0a..f2b47c83 100644 --- a/src/qml/MainPane/RoomDelegate.qml +++ b/src/qml/MainPane/RoomDelegate.qml @@ -21,7 +21,9 @@ HTileDelegate { Behavior on opacity { HOpacityAnimator {} } - readonly property bool invited: model.data.inviter_id && ! model.data.left + readonly property bool joined: ! invited && ! parted + readonly property bool invited: model.data.inviter_id && ! parted + readonly property bool parted: model.data.left readonly property var lastEvent: model.data.last_event @@ -88,6 +90,23 @@ HTileDelegate { } contextMenu: HMenu { + HMenuItem { + visible: joined + enabled: model.data.can_invite + icon.name: "room-send-invite" + text: qsTr("Invite members") + + onTriggered: Utils.makePopup( + "Popups/InviteToRoomPopup.qml", + window, + { + userId: model.user_id, + roomId: model.data.room_id, + invitingAllowed: Qt.binding(() => model.data.can_invite) + } + ) + } + HMenuItem { icon.name: "copy-room-id" text: qsTr("Copy room ID") @@ -109,7 +128,7 @@ HTileDelegate { } HMenuItem { - visible: ! model.data.left + visible: invited || joined icon.name: invited ? "invite-decline" : "room-leave" icon.color: theme.colors.negativeBackground text: invited ? qsTr("Decline invite") : qsTr("Leave")