2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-09-09 23:24:45 +10:00
|
|
|
import QtQuick 2.12
|
2020-06-25 22:32:08 +10:00
|
|
|
import "../Base/ButtonLayout"
|
2019-09-09 23:24:45 +10:00
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
HFlickableColumnPopup {
|
2019-09-10 10:56:10 +10:00
|
|
|
id: popup
|
2019-09-09 23:24:45 +10:00
|
|
|
|
|
|
|
|
|
|
|
property string userId: ""
|
|
|
|
property string roomId: ""
|
|
|
|
property string roomName: ""
|
2019-09-10 10:56:10 +10:00
|
|
|
|
|
|
|
property bool canDestroy: false
|
2020-06-25 22:32:08 +10:00
|
|
|
|
|
|
|
|
|
|
|
function forget() {
|
|
|
|
py.callClientCoro(userId, "room_forget", [roomId], () => {
|
|
|
|
if (window.uiState.page === "Pages/Chat/Chat.qml" &&
|
|
|
|
window.uiState.pageProperties.userId === userId &&
|
|
|
|
window.uiState.pageProperties.roomId === roomId)
|
|
|
|
{
|
|
|
|
window.mainUI.pageLoader.showPrevious() ||
|
|
|
|
window.mainUI.pageLoader.showPage("Default")
|
|
|
|
|
|
|
|
Qt.callLater(popup.destroy)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
page.footer: ButtonLayout {
|
|
|
|
ApplyButton {
|
|
|
|
id: forgetButton
|
|
|
|
text: qsTr("Forget")
|
|
|
|
icon.name: "room-forget"
|
|
|
|
onClicked: forget()
|
|
|
|
}
|
|
|
|
|
|
|
|
CancelButton {
|
|
|
|
onClicked: {
|
|
|
|
canDestroy = true
|
|
|
|
popup.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onOpened: forgetButton.forceActiveFocus()
|
|
|
|
onClosed: if (canDestroy) Qt.callLater(popup.destroy)
|
|
|
|
|
|
|
|
|
|
|
|
SummaryLabel {
|
|
|
|
text: qsTr("Leave <i>%1</i> and lose the history?").arg(roomName)
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
}
|
|
|
|
|
|
|
|
DetailsLabel {
|
|
|
|
text: qsTr(
|
|
|
|
"You will not be able to see the messages you received in " +
|
|
|
|
"this room anymore.\n\n" +
|
|
|
|
|
|
|
|
"If all members forget the room, it will be removed from the " +
|
|
|
|
"servers."
|
|
|
|
)
|
|
|
|
}
|
2019-09-09 23:24:45 +10:00
|
|
|
}
|