diff --git a/src/qml/Dialog/UserDetailDialog.qml b/src/qml/Dialog/UserDetailDialog.qml index 88f2d2baa..86c3a76b1 100644 --- a/src/qml/Dialog/UserDetailDialog.qml +++ b/src/qml/Dialog/UserDetailDialog.qml @@ -112,7 +112,10 @@ Kirigami.OverlaySheet { icon.name: "im-ban-user" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - room.ban(user.id) + applicationWindow().pageStack.pushDialogLayer("qrc:/BanSheet.qml", {room: room, userId: user.id}, { + title: i18nc("@title", "Ban User"), + width: Kirigami.Units.gridUnit * 25 + }) root.close() } } diff --git a/src/qml/Menu/Timeline/BanSheet.qml b/src/qml/Menu/Timeline/BanSheet.qml new file mode 100644 index 000000000..65039263f --- /dev/null +++ b/src/qml/Menu/Timeline/BanSheet.qml @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2022 Tobias Fella +// SPDX-License-Identifier: GPL-2.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 as QQC2 +import QtQuick.Layouts 1.15 + +import org.kde.kirigami 2.20 as Kirigami + +Kirigami.Page { + id: banSheet + + property var room + property string userId + + title: i18n("Ban User") + + QQC2.TextArea { + id: reason + placeholderText: i18n("Reason for banning this user") + anchors.fill: parent + wrapMode: TextEdit.Wrap + } + + footer: QQC2.ToolBar { + QQC2.DialogButtonBox { + anchors.fill: parent + Item { + Layout.fillWidth: true + } + QQC2.Button { + text: i18nc("@action:button 'Ban' as in 'Ban this user'", "Ban") + icon.name: "im-ban-user" + QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole + onClicked: { + banSheet.room.ban(banSheet.userId, reason.text) + banSheet.closeDialog() + } + } + QQC2.Button { + text: i18nc("@action", "Cancel") + QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole + onClicked: banSheet.closeDialog() + } + } + } +} diff --git a/src/res.qrc b/src/res.qrc index d849d1154..c0ce26147 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -92,5 +92,6 @@ qml/Page/DevtoolsPage.qml qml/Dialog/ConfirmEncryptionDialog.qml qml/Menu/Timeline/RemoveSheet.qml + qml/Menu/Timeline/BanSheet.qml