Add accept invite to room context menu

This commit is contained in:
miruka 2019-08-21 16:38:34 -04:00
parent 076ff743ad
commit 26b01be23c
3 changed files with 18 additions and 1 deletions

View File

@ -5,6 +5,7 @@
- File format - File format
- Make all icon SVG files white/black, since we can now use ColorOverlay - 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 - 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) - Use [Animators](https://doc.qt.io/qt-5/qml-qtquick-animator.html)
- Choose a better default easing type for animations - Choose a better default easing type for animations
@ -33,6 +34,7 @@
- Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb`
- UI - UI
- Use a Loader for context menus
- Make HListView scrollbars visible - Make HListView scrollbars visible
- Remove first html lists left margin - Remove first html lists left margin
- Adapt UI for small heights - Adapt UI for small heights

View File

@ -17,7 +17,7 @@ Menu {
rightPadding = Math.max(item.rightPadding, rightPadding) rightPadding = Math.max(item.rightPadding, rightPadding)
} }
return Math.min( return Math.min(
result + leftPadding + rightPadding, theme.minimumSupportedWidth result + leftPadding + rightPadding, window.width
) )
} }

View File

@ -77,10 +77,24 @@ HTileDelegate {
} }
contextMenu: HMenu { 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 { HMenuItem {
visible: ! model.data.left visible: ! model.data.left
icon.name: invited ? "invite-decline" : "room-leave" icon.name: invited ? "invite-decline" : "room-leave"
text: invited ? qsTr("Decline invite") : qsTr("Leave") text: invited ? qsTr("Decline invite") : qsTr("Leave")
onTriggered: py.callClientCoro( onTriggered: py.callClientCoro(
model.user_id, "room_leave", [model.data.room_id] model.user_id, "room_leave", [model.data.room_id]
) )
@ -89,6 +103,7 @@ HTileDelegate {
HMenuItem { HMenuItem {
icon.name: "room-forget" icon.name: "room-forget"
text: qsTr("Forget") text: qsTr("Forget")
onTriggered: py.callClientCoro( onTriggered: py.callClientCoro(
model.user_id, "room_forget", [model.data.room_id] model.user_id, "room_forget", [model.data.room_id]
) )