Warning, /network/neochat/src/qml/RemoveSheet.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 
0008 import org.kde.kirigami as Kirigami
0009 
0010 import org.kde.neochat
0011 
0012 Kirigami.Page {
0013     id: root
0014 
0015     property NeoChatRoom room
0016     property string eventId
0017 
0018     property string userId: ""
0019 
0020     title: userId.length > 0 ? i18n("Remove Messages") : i18n("Remove Message")
0021 
0022     leftPadding: 0
0023     rightPadding: 0
0024     topPadding: 0
0025     bottomPadding: 0
0026 
0027     QQC2.TextArea {
0028         id: reason
0029         placeholderText: userId.length > 0 ? i18n("Reason for removing this user's recent messages") : i18n("Reason for removing this message")
0030         anchors.fill: parent
0031         wrapMode: TextEdit.Wrap
0032         background: Rectangle {
0033             color: Kirigami.Theme.backgroundColor
0034         }
0035     }
0036 
0037     footer: QQC2.ToolBar {
0038         QQC2.DialogButtonBox {
0039             anchors.fill: parent
0040             Item {
0041                 Layout.fillWidth: true
0042             }
0043             QQC2.Button {
0044                 text: i18nc("@action:button 'Remove' as in 'Remove this message'", "Remove")
0045                 icon.name: "delete"
0046                 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
0047                 onClicked: {
0048                     if (root.userId.length > 0) {
0049                         root.room.deleteMessagesByUser(root.userId, reason.text);
0050                     } else {
0051                         root.room.redactEvent(root.eventId, reason.text);
0052                     }
0053                     root.closeDialog();
0054                 }
0055             }
0056             QQC2.Button {
0057                 text: i18nc("@action", "Cancel")
0058                 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
0059                 onClicked: root.closeDialog()
0060             }
0061         }
0062     }
0063 }