moment/src/gui/Popups/RemoveMemberPopup.qml

59 lines
1.4 KiB
QML
Raw Normal View History

2020-04-20 01:12:35 +10:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
BoxPopup {
summary.textFormat: Text.StyledText
summary.text:
operation === RemoveMemberPopup.Operation.Disinvite ?
qsTr("Disinvite %1 from the room?").arg(coloredTarget) :
2020-04-20 01:12:35 +10:00
operation === RemoveMemberPopup.Operation.Kick ?
qsTr("Kick %1 out of the room?").arg(coloredTarget) :
qsTr("Ban %1 from the room?").arg(coloredTarget)
okText:
operation === RemoveMemberPopup.Operation.Disinvite ?
qsTr("Disinvite") :
operation === RemoveMemberPopup.Operation.Kick ?
qsTr("Kick") :
qsTr("Ban")
2020-04-20 01:12:35 +10:00
onOpened: reasonField.item.forceActiveFocus()
2020-04-20 01:12:35 +10:00
onOk: py.callClientCoro(
userId,
operation === RemoveMemberPopup.Operation.Ban ?
"room_ban" : "room_kick",
[roomId, targetUserId, reasonField.item.text || null],
2020-04-20 01:12:35 +10:00
)
enum Operation { Disinvite, Kick, Ban }
2020-04-20 01:12:35 +10:00
property string userId
property string roomId
property string targetUserId
property string targetDisplayName
property int operation
2020-04-20 01:12:35 +10:00
readonly property string coloredTarget:
utils.coloredNameHtml(targetDisplayName, targetUserId)
HLabeledItem {
2020-04-20 01:12:35 +10:00
id: reasonField
label.text: qsTr("Optional reason:")
Layout.fillWidth: true
HTextField {
width: parent.width
}
2020-04-20 01:12:35 +10:00
}
}