2023-08-31 22:26:24 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQml.Models 2.15
|
2024-02-22 11:01:01 +00:00
|
|
|
import QtQuick.Layouts 1.15
|
2023-08-31 22:26:24 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core 0.1
|
2024-10-15 19:26:12 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-08-31 22:26:24 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2024-02-22 11:01:01 +00:00
|
|
|
import StatusQ.Components 0.1
|
2023-08-31 22:26:24 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
|
|
|
|
StatusDialog {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property string username: ""
|
|
|
|
property string communityName: ""
|
|
|
|
property int mode: KickBanPopup.Mode.Kick
|
|
|
|
|
2024-02-22 11:01:01 +00:00
|
|
|
signal banUserClicked(bool deleteAllMessages)
|
|
|
|
signal kickUserClicked()
|
|
|
|
|
2023-08-31 22:26:24 +00:00
|
|
|
enum Mode {
|
|
|
|
Kick, Ban
|
|
|
|
}
|
|
|
|
|
|
|
|
width: 400
|
|
|
|
|
|
|
|
title: root.mode === KickBanPopup.Mode.Kick
|
|
|
|
? qsTr("Kick %1").arg(root.username)
|
|
|
|
: qsTr("Ban %1").arg(root.username)
|
|
|
|
|
2024-02-22 11:01:01 +00:00
|
|
|
contentItem: ColumnLayout {
|
2023-08-31 22:26:24 +00:00
|
|
|
anchors.centerIn: parent
|
2024-02-22 11:01:01 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2024-02-22 11:01:01 +00:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
|
|
text: root.mode === KickBanPopup.Mode.Kick
|
|
|
|
? qsTr("Are you sure you want to kick <b>%1</b> from %2?")
|
|
|
|
.arg(root.username).arg(root.communityName)
|
|
|
|
: qsTr("Are you sure you want to ban <b>%1</b> from %2? This means that they will be kicked from this community and banned from re-joining.")
|
|
|
|
.arg(root.username).arg(root.communityName)
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
visible: root.mode === KickBanPopup.Mode.Ban
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
text: qsTr("Delete all messages posted by the user")
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2024-02-22 11:01:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusSwitch {
|
|
|
|
id: deleteAllMessagesSwitch
|
|
|
|
|
|
|
|
checked: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-31 22:26:24 +00:00
|
|
|
|
|
|
|
footer: StatusDialogFooter {
|
|
|
|
rightButtons: ObjectModel {
|
|
|
|
StatusFlatButton {
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
|
|
|
|
onClicked: root.close()
|
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
id: banButton
|
|
|
|
|
|
|
|
objectName: root.mode === KickBanPopup.Mode.Kick
|
|
|
|
? "CommunityMembers_KickModal_KickButton"
|
|
|
|
: "CommunityMembers_BanModal_BanButton"
|
|
|
|
|
2024-02-22 11:01:01 +00:00
|
|
|
text: root.mode === KickBanPopup.Mode.Kick ? qsTr("Kick %1").arg(root.username)
|
|
|
|
: qsTr("Ban %1").arg(root.username)
|
2023-08-31 22:26:24 +00:00
|
|
|
type: StatusBaseButton.Type.Danger
|
|
|
|
onClicked: {
|
2024-02-22 11:01:01 +00:00
|
|
|
root.mode === KickBanPopup.Mode.Kick ? root.kickUserClicked()
|
|
|
|
: root.banUserClicked(deleteAllMessagesSwitch.checked)
|
2023-08-31 22:26:24 +00:00
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-22 11:01:01 +00:00
|
|
|
|
|
|
|
onClosed: deleteAllMessagesSwitch.checked = false
|
2023-08-31 22:26:24 +00:00
|
|
|
}
|