2020-09-23 19:57:54 -04:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-19 07:46:16 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-09-09 09:24:45 -04:00
|
|
|
import QtQuick 2.12
|
2020-07-11 22:52:14 -04:00
|
|
|
import "../Base"
|
|
|
|
import "../Base/Buttons"
|
2019-09-09 09:24:45 -04:00
|
|
|
|
2020-06-25 08:32:08 -04:00
|
|
|
HFlickableColumnPopup {
|
2019-09-09 20:56:10 -04:00
|
|
|
id: popup
|
2019-09-09 09:24:45 -04:00
|
|
|
|
|
|
|
property string userId: ""
|
|
|
|
property string roomId: ""
|
|
|
|
property string roomName: ""
|
2019-09-09 20:56:10 -04:00
|
|
|
|
|
|
|
property bool canDestroy: false
|
2020-06-25 08:32:08 -04:00
|
|
|
|
|
|
|
function forget() {
|
|
|
|
py.callClientCoro(userId, "room_forget", [roomId], () => {
|
|
|
|
if (window.uiState.page === "Pages/Chat/Chat.qml" &&
|
2020-09-13 12:47:25 -04:00
|
|
|
window.uiState.pageProperties.userRoomId[0] === userId &&
|
|
|
|
window.uiState.pageProperties.userRoomId[1] === roomId)
|
2020-06-25 08:32:08 -04:00
|
|
|
{
|
|
|
|
window.mainUI.pageLoader.showPrevious() ||
|
2020-09-03 17:33:19 -04:00
|
|
|
window.mainUI.pageLoader.show("Pages/Default.qml")
|
2020-06-25 08:32:08 -04:00
|
|
|
|
|
|
|
Qt.callLater(popup.destroy)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-07-11 22:52:14 -04:00
|
|
|
page.footer: AutoDirectionLayout {
|
2020-06-25 08:32:08 -04:00
|
|
|
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 {
|
2021-02-25 05:32:05 -04:00
|
|
|
text: qsTr("Leave %1 and lose the history?").arg(
|
|
|
|
utils.htmlColorize(roomName, theme.colors.accentText),
|
|
|
|
)
|
2020-06-25 08:32:08 -04:00
|
|
|
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 09:24:45 -04:00
|
|
|
}
|