From 4ffa3470c7a9ae29f75db5ee49af2f33c14522bf Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 9 Sep 2019 09:24:45 -0400 Subject: [PATCH] Confirm forgetting room with popup --- src/qml/Popups/ForgetRoomPopup.qml | 21 +++++++++++++++++++++ src/qml/SidePane/RoomDelegate.qml | 10 ++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/qml/Popups/ForgetRoomPopup.qml diff --git a/src/qml/Popups/ForgetRoomPopup.qml b/src/qml/Popups/ForgetRoomPopup.qml new file mode 100644 index 00000000..ee302588 --- /dev/null +++ b/src/qml/Popups/ForgetRoomPopup.qml @@ -0,0 +1,21 @@ +import QtQuick 2.12 + +BoxPopup { + summary.text: qsTr( + "You will leave the room and lose its messages. Forget %1?" + ).arg(roomName) + + details.text: qsTr( + "If all members forget the room, it will be removed from the servers." + ) + + okText: qsTr("Forget") + box.focusButton: "ok" + + onOk: py.callClientCoro(userId, "room_forget", [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 addf498a..b494c404 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -124,8 +124,14 @@ HTileDelegate { icon.color: theme.colors.negativeBackground text: qsTr("Forget") - onTriggered: py.callClientCoro( - model.user_id, "room_forget", [model.data.room_id] + onTriggered: Utils.makePopup( + "Popups/ForgetRoomPopup.qml", + sidePane, + { + userId: model.user_id, + roomId: model.data.room_id, + roomName: model.data.display_name, + } ) } }