From 88042cd111f281e4b002b00bbd7e85e87471dd5f Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 9 Sep 2019 09:12:51 -0400 Subject: [PATCH] Confirm leaving room with popup --- src/qml/Popups/LeaveRoomPopup.qml | 17 +++++++++++++++++ src/qml/SidePane/RoomDelegate.qml | 10 ++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/qml/Popups/LeaveRoomPopup.qml 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, + } ) }