diff --git a/src/qml/Popups/LeaveRoomPopup.qml b/src/qml/Popups/LeaveRoomPopup.qml new file mode 100644 index 00000000..17b62070 --- /dev/null +++ b/src/qml/Popups/LeaveRoomPopup.qml @@ -0,0 +1,17 @@ +import QtQuick 2.12 + +BoxPopup { + summary.text: qsTr("Leave %1?").arg(roomName) + details.text: qsTr( + "If this room is private, you will not be able to rejoin it." + ) + okText: qsTr("Leave") + box.focusButton: "ok" + + onOk: py.callClientCoro(userId, "room_leave", [roomId]) + + + property string userId: "" + property string roomId: "" + property string roomName: "" +} diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index 3a86b492..addf498a 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -108,8 +108,14 @@ HTileDelegate { icon.color: theme.colors.negativeBackground text: invited ? qsTr("Decline invite") : qsTr("Leave") - onTriggered: py.callClientCoro( - model.user_id, "room_leave", [model.data.room_id] + onTriggered: Utils.makePopup( + "Popups/LeaveRoomPopup.qml", + sidePane, + { + userId: model.user_id, + roomId: model.data.room_id, + roomName: model.data.display_name, + } ) }