From 3e01eeef711d4b595277138426e183c45b635730 Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 9 Sep 2019 20:24:29 -0400 Subject: [PATCH] LeftBanner: use ForgotRoomPopup --- src/qml/Chat/Banners/LeftBanner.qml | 23 +++++++++++++++++------ src/qml/Popups/ForgetRoomPopup.qml | 3 ++- src/qml/Popups/LeaveRoomPopup.qml | 3 ++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/qml/Chat/Banners/LeftBanner.qml b/src/qml/Chat/Banners/LeftBanner.qml index 2446e171..98922f05 100644 --- a/src/qml/Chat/Banners/LeftBanner.qml +++ b/src/qml/Chat/Banners/LeftBanner.qml @@ -1,5 +1,6 @@ import QtQuick 2.12 import "../../Base" +import "../../utils.js" as Utils Banner { color: theme.chat.leftBanner.background @@ -21,12 +22,22 @@ Banner { buttonCallbacks: ({ forget: button => { - button.loading = true - py.callClientCoro( - chatPage.userId, "room_forget", [chatPage.roomId], () => { - button.loading = false - Qt.callLater(pageLoader.showPage, "Default") - }) + Utils.makePopup( + "Popups/ForgetRoomPopup.qml", + chatPage, + { + userId: chatPage.userId, + roomId: chatPage.roomId, + roomName: chatPage.roomInfo.display_name, + forgottenCallback: () => { + button.loading = false + Qt.callLater(pageLoader.showPage, "Default") + }, + }, + obj => { + obj.onOk.connect(() => { button.loading = true }) + }, + ) } }) } diff --git a/src/qml/Popups/ForgetRoomPopup.qml b/src/qml/Popups/ForgetRoomPopup.qml index 67032731..15637544 100644 --- a/src/qml/Popups/ForgetRoomPopup.qml +++ b/src/qml/Popups/ForgetRoomPopup.qml @@ -12,10 +12,11 @@ BoxPopup { okText: qsTr("Forget") box.focusButton: "ok" - onOk: py.callClientCoro(userId, "room_forget", [roomId]) + onOk: py.callClientCoro(userId, "room_forget", [roomId], forgottenCallback) property string userId: "" property string roomId: "" property string roomName: "" + property var forgottenCallback: null } diff --git a/src/qml/Popups/LeaveRoomPopup.qml b/src/qml/Popups/LeaveRoomPopup.qml index 17b62070..26e7d88c 100644 --- a/src/qml/Popups/LeaveRoomPopup.qml +++ b/src/qml/Popups/LeaveRoomPopup.qml @@ -8,10 +8,11 @@ BoxPopup { okText: qsTr("Leave") box.focusButton: "ok" - onOk: py.callClientCoro(userId, "room_leave", [roomId]) + onOk: py.callClientCoro(userId, "room_leave", [roomId], leftCallback) property string userId: "" property string roomId: "" property string roomName: "" + property var leftCallback: null }