LeftBanner: use ForgotRoomPopup

This commit is contained in:
miruka 2019-09-09 20:24:29 -04:00
parent b7b309ad4c
commit 3e01eeef71
3 changed files with 21 additions and 8 deletions

View File

@ -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], () => {
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 })
},
)
}
})
}

View File

@ -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
}

View File

@ -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
}