From 26b01be23c08273f050bb74adac3f83d723f2978 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 21 Aug 2019 16:38:34 -0400 Subject: [PATCH] Add accept invite to room context menu --- TODO.md | 2 ++ src/qml/Base/HMenu.qml | 2 +- src/qml/SidePane/DelegateRoom.qml | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 78cb3008..84e7aff4 100644 --- a/TODO.md +++ b/TODO.md @@ -5,6 +5,7 @@ - File format - Make all icon SVG files white/black, since we can now use ColorOverlay - Make the icon blue in EditAccount when hovering and no avatar set + - Remove the filled theme - Use [Animators](https://doc.qt.io/qt-5/qml-qtquick-animator.html) - Choose a better default easing type for animations @@ -33,6 +34,7 @@ - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` - UI + - Use a Loader for context menus - Make HListView scrollbars visible - Remove first html lists left margin - Adapt UI for small heights diff --git a/src/qml/Base/HMenu.qml b/src/qml/Base/HMenu.qml index 75595cbc..f96ba127 100644 --- a/src/qml/Base/HMenu.qml +++ b/src/qml/Base/HMenu.qml @@ -17,7 +17,7 @@ Menu { rightPadding = Math.max(item.rightPadding, rightPadding) } return Math.min( - result + leftPadding + rightPadding, theme.minimumSupportedWidth + result + leftPadding + rightPadding, window.width ) } diff --git a/src/qml/SidePane/DelegateRoom.qml b/src/qml/SidePane/DelegateRoom.qml index 21815608..fa9f98eb 100644 --- a/src/qml/SidePane/DelegateRoom.qml +++ b/src/qml/SidePane/DelegateRoom.qml @@ -77,10 +77,24 @@ HTileDelegate { } contextMenu: HMenu { + HMenuItem { + visible: invited + icon.name: "invite-accept" + text: qsTr("Accept %1's invite").arg(Utils.coloredNameHtml( + model.data.inviter_name, model.data.inviter_id + )) + label.textFormat: Text.StyledText + + onTriggered: py.callClientCoro( + model.user_id, "join", [model.data.room_id] + ) + } + HMenuItem { visible: ! model.data.left icon.name: invited ? "invite-decline" : "room-leave" text: invited ? qsTr("Decline invite") : qsTr("Leave") + onTriggered: py.callClientCoro( model.user_id, "room_leave", [model.data.room_id] ) @@ -89,6 +103,7 @@ HTileDelegate { HMenuItem { icon.name: "room-forget" text: qsTr("Forget") + onTriggered: py.callClientCoro( model.user_id, "room_forget", [model.data.room_id] )