LeaveRoomPopup: new text for declining invites

This commit is contained in:
miruka 2021-04-13 14:44:24 -04:00
parent 334065895f
commit 96a1e57f47
3 changed files with 17 additions and 5 deletions

View File

@ -238,6 +238,7 @@ HTile {
userId: model.for_account, userId: model.for_account,
roomId: model.id, roomId: model.id,
roomName: model.display_name, roomName: model.display_name,
inviterId: model.inviter_id,
}) })
} }

View File

@ -54,7 +54,12 @@ Item {
active: userInfo && userInfo.presence !== "offline" active: userInfo && userInfo.presence !== "offline"
onActivated: window.makePopup( onActivated: window.makePopup(
"Popups/LeaveRoomPopup.qml", "Popups/LeaveRoomPopup.qml",
{userId, roomId, roomName: roomInfo.display_name}, {
userId,
roomId,
roomName: roomInfo.display_name,
inviterId: roomInfo.inviter_id,
},
) )
} }

View File

@ -11,13 +11,14 @@ HFlickableColumnPopup {
property string userId: "" property string userId: ""
property string roomId: "" property string roomId: ""
property string roomName: "" property string roomName: ""
property string inviterId: ""
property var leftCallback: null property var leftCallback: null
page.footer: AutoDirectionLayout { page.footer: AutoDirectionLayout {
ApplyButton { ApplyButton {
id: leaveButton id: leaveButton
icon.name: "room-leave" icon.name: "room-leave"
text: qsTr("Leave") text: inviterId ? qsTr("Decline") : qsTr("Leave")
onClicked: { onClicked: {
py.callClientCoro(userId, "room_leave", [roomId], leftCallback) py.callClientCoro(userId, "room_leave", [roomId], leftCallback)
@ -33,13 +34,18 @@ HFlickableColumnPopup {
onOpened: leaveButton.forceActiveFocus() onOpened: leaveButton.forceActiveFocus()
SummaryLabel { SummaryLabel {
text: qsTr("Leave %1?").arg( readonly property string roomText:
utils.htmlColorize(roomName, theme.colors.accentText), utils.htmlColorize(roomName, theme.colors.accentText)
)
textFormat: Text.StyledText textFormat: Text.StyledText
text:
inviterId ?
qsTr("Decline invite to %1?").arg(roomText) :
qsTr("Leave %1?").arg(roomText)
} }
DetailsLabel { DetailsLabel {
visible: inviterId === ""
text: qsTr( text: qsTr(
"If this room is private, you will not be able to rejoin it." "If this room is private, you will not be able to rejoin it."
) )