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 QtQuick 2.12
import "../../Base" import "../../Base"
import "../../utils.js" as Utils
Banner { Banner {
color: theme.chat.leftBanner.background color: theme.chat.leftBanner.background
@ -21,12 +22,22 @@ Banner {
buttonCallbacks: ({ buttonCallbacks: ({
forget: button => { forget: button => {
button.loading = true Utils.makePopup(
py.callClientCoro( "Popups/ForgetRoomPopup.qml",
chatPage.userId, "room_forget", [chatPage.roomId], () => { chatPage,
{
userId: chatPage.userId,
roomId: chatPage.roomId,
roomName: chatPage.roomInfo.display_name,
forgottenCallback: () => {
button.loading = false button.loading = false
Qt.callLater(pageLoader.showPage, "Default") Qt.callLater(pageLoader.showPage, "Default")
}) },
},
obj => {
obj.onOk.connect(() => { button.loading = true })
},
)
} }
}) })
} }

View File

@ -12,10 +12,11 @@ BoxPopup {
okText: qsTr("Forget") okText: qsTr("Forget")
box.focusButton: "ok" box.focusButton: "ok"
onOk: py.callClientCoro(userId, "room_forget", [roomId]) onOk: py.callClientCoro(userId, "room_forget", [roomId], forgottenCallback)
property string userId: "" property string userId: ""
property string roomId: "" property string roomId: ""
property string roomName: "" property string roomName: ""
property var forgottenCallback: null
} }

View File

@ -8,10 +8,11 @@ BoxPopup {
okText: qsTr("Leave") okText: qsTr("Leave")
box.focusButton: "ok" box.focusButton: "ok"
onOk: py.callClientCoro(userId, "room_leave", [roomId]) onOk: py.callClientCoro(userId, "room_leave", [roomId], leftCallback)
property string userId: "" property string userId: ""
property string roomId: "" property string roomId: ""
property string roomName: "" property string roomName: ""
property var leftCallback: null
} }