Warning, /network/tokodon/src/content/ui/ReportDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003 
0004 import QtQuick
0005 import QtQuick.Controls 2 as QQC2
0006 import QtQuick.Layouts
0007 import org.kde.kirigami 2 as Kirigami
0008 import org.kde.tokodon
0009 
0010 Kirigami.Page {
0011     id: root
0012 
0013     enum Type {
0014         Post,
0015         User
0016     }
0017 
0018     property var type
0019     property var identity
0020     property string postId
0021 
0022     title: type === ReportDialog.Post ? i18nc("@title", "Report Post") : i18nc("@title", "Report User")
0023 
0024     property ReportEditorBackend backend: ReportEditorBackend {
0025         accountId: root.identity !== undefined ? root.identity.id : ""
0026         postId: root.postId
0027         comment: reason.text
0028     }
0029 
0030     Connections {
0031         target: backend
0032 
0033         function onReported() {
0034             root.closeDialog();
0035         }
0036     }
0037 
0038     QQC2.TextArea {
0039         id: reason
0040         placeholderText: type === ReportDialog.Post ? i18nc("@title", "Reason for reporting this post") : i18nc("@title", "Reason for reporting this user")
0041         anchors.fill: parent
0042         wrapMode: TextEdit.Wrap
0043         enabled: !backend.loading
0044     }
0045 
0046     footer: QQC2.ToolBar {
0047         enabled: !backend.loading
0048 
0049         QQC2.DialogButtonBox {
0050             anchors.fill: parent
0051             Item {
0052                 Layout.fillWidth: true
0053             }
0054             QQC2.Button {
0055                 text: i18nc("@action:button 'Report' as in 'Report this to moderators'", "Report")
0056                 icon.name: "dialog-warning-symbolic"
0057                 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
0058                 onClicked: {
0059                     root.backend.submit();
0060                     root.closeDialog();
0061                 }
0062             }
0063             QQC2.Button {
0064                 text: i18nc("@action", "Cancel")
0065                 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
0066                 onClicked: root.closeDialog()
0067             }
0068         }
0069     }
0070 }