Warning, /network/tokodon/src/content/ui/ModerationTools/ReportToolPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Rishi Kumar <rsi.dev17@gmail.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 org.kde.kirigami 2 as Kirigami 0006 import QtQuick.Controls 2 as QQC2 0007 import QtQuick.Layouts 0008 import org.kde.tokodon 0009 import org.kde.kirigamiaddons.delegates 1 as Delegates 0010 import org.kde.kirigamiaddons.components 1 as KirigamiComponents 0011 0012 import "../StatusDelegate" 0013 0014 Kirigami.ScrollablePage { 0015 title: i18n("Accounts Tool Page") 0016 id: root 0017 0018 header: ColumnLayout { 0019 id: comboboxColumn 0020 spacing: 0 0021 Layout.fillWidth: true 0022 RowLayout { 0023 id: filterOptions 0024 Layout.topMargin: Kirigami.Units.largeSpacing 0025 Layout.bottomMargin: Kirigami.Units.largeSpacing 0026 Layout.leftMargin: Kirigami.Units.largeSpacing * 5 0027 Layout.rightMargin: Kirigami.Units.largeSpacing * 5 0028 Layout.fillWidth: true 0029 0030 ColumnLayout { 0031 Kirigami.Heading { 0032 level: 4 0033 text: i18nc("@info:Combobox to choose Report Status", "Report Status") 0034 type: Kirigami.Heading.Type.Primary 0035 horizontalAlignment: Text.AlignHCenter 0036 Layout.fillWidth: true 0037 } 0038 QQC2.ComboBox { 0039 id: reportStatusCombobox 0040 Layout.fillWidth: true 0041 Layout.leftMargin: Kirigami.Units.largeSpacing 0042 Layout.rightMargin: Kirigami.Units.largeSpacing 0043 model: [ 0044 { 0045 display: i18nc("@info:Filter out unresolved reports", "Unresolved"), 0046 value: "" 0047 }, 0048 { 0049 display: i18nc("@info:Filter out resolved reports", "Resolved"), 0050 value: "resolved" 0051 }, 0052 ] 0053 textRole: "display" 0054 valueRole: "value" 0055 Component.onCompleted: reportStatusCombobox.currentIndex = reportStatusCombobox.indexOfValue(reportView.model.moderationStatus); 0056 onCurrentIndexChanged: reportView.model.moderationStatus = model[currentIndex].value 0057 } 0058 } 0059 0060 ColumnLayout { 0061 Kirigami.Heading { 0062 level: 4 0063 text: i18nc("@info:Combobox to choose the origin of report", "Report Origin") 0064 type: Kirigami.Heading.Type.Primary 0065 horizontalAlignment: Text.AlignHCenter 0066 0067 Layout.fillWidth: true 0068 } 0069 QQC2.ComboBox { 0070 id: originCombobox 0071 Layout.fillWidth: true 0072 Layout.leftMargin: Kirigami.Units.largeSpacing 0073 Layout.rightMargin: Kirigami.Units.largeSpacing 0074 model: [ 0075 { 0076 display: i18nc("@info:Filter out accounts with any origin", "All"), 0077 value: "" 0078 }, 0079 { 0080 display: i18nc("@info:Filter out accounts with local origin", "Local"), 0081 value: "local" 0082 }, 0083 { 0084 display: i18nc("@info:Filter out accounts with remote origin", "Remote"), 0085 value: "remote" 0086 }, 0087 ] 0088 textRole: "display" 0089 valueRole: "value" 0090 Component.onCompleted: originCombobox.currentIndex = originCombobox.indexOfValue(reportView.model.origin); 0091 onCurrentIndexChanged: reportView.model.origin = model[currentIndex].value 0092 } 0093 } 0094 } 0095 Kirigami.Separator { 0096 Layout.fillWidth: true 0097 } 0098 } 0099 0100 ListView { 0101 id: reportView 0102 model: ReportToolModel{} 0103 0104 delegate: Delegates.RoundedItemDelegate { 0105 id: delegate 0106 0107 required property int index 0108 required property var reportInfo 0109 visible: (delegate.reportInfo) !== null 0110 0111 //hide the report if we get a {} response 0112 Component.onCompleted: { 0113 if ((delegate.reportInfo) === null) 0114 { 0115 delegate.implicitHeight = 0 0116 } 0117 } 0118 0119 implicitWidth: ListView.view.width 0120 Layout.fillWidth: true 0121 0122 onClicked: applicationWindow().pageStack.layers.push("./MainReportToolPage.qml", { 0123 reportInfo: delegate.reportInfo, 0124 index: delegate.index, 0125 model: reportView.model 0126 }) 0127 0128 contentItem: Kirigami.FlexColumn { 0129 spacing: 0 0130 0131 RowLayout { 0132 spacing: 0 0133 Layout.fillWidth: true 0134 InlineIdentityInfo { 0135 identity: delegate.reportInfo.targetAccount.userLevelIdentity 0136 secondary: false 0137 admin: true 0138 ip: delegate.reportInfo.targetAccount.ip 0139 } 0140 Kirigami.Heading { 0141 level: 3 0142 text: delegate.reportInfo.targetAccount.loginStatus 0143 type: Kirigami.Heading.Type.Secondary 0144 elide: Text.ElideRight 0145 } 0146 } 0147 RowLayout { 0148 spacing: 0 0149 Layout.fillWidth: true 0150 ColumnLayout { 0151 spacing: 0 0152 0153 Kirigami.Heading { 0154 level: 5 0155 text: i18n("Reported By:") 0156 type: Kirigami.Heading.Type.Primary 0157 elide: Text.ElideRight 0158 Layout.alignment: Qt.AlignLeft 0159 Layout.leftMargin: Kirigami.Units.smallSpacing 0160 } 0161 0162 RowLayout { 0163 spacing: 0 0164 Layout.alignment: Qt.AlignLeft 0165 Layout.rightMargin: Kirigami.Units.largeSpacing * 3 0166 Item { 0167 Layout.preferredWidth: height 0168 Layout.preferredHeight: Kirigami.Units.gridUnit * 2 0169 0170 KirigamiComponents.Avatar { 0171 id: avatar 0172 anchors.fill: parent 0173 anchors.margins: Kirigami.Units.smallSpacing 0174 source: delegate.reportInfo.filedAccount.userLevelIdentity.avatarUrl 0175 cache: true 0176 name: delegate.reportInfo.filedAccount.userLevelIdentity.displayName 0177 implicitWidth: avatar.width 0178 implicitHeight: avatar.height 0179 Layout.rightMargin: Kirigami.Units.smallSpacing * 3 0180 } 0181 } 0182 Kirigami.Heading { 0183 level: 4 0184 text: delegate.reportInfo.filedAccount.userLevelIdentity.account 0185 type: Kirigami.Heading.Type.Secondary 0186 elide: Text.ElideRight 0187 Layout.alignment: Qt.AlignRight 0188 Layout.minimumWidth: Kirigami.Units.gridUnit * 4 0189 } 0190 } 0191 } 0192 ColumnLayout { 0193 spacing: 0 0194 Layout.alignment: Qt.AlignLeft 0195 Layout.topMargin: Kirigami.Units.largeSpacing * 2 0196 Kirigami.Heading { 0197 level: 5 0198 text: delegate.reportInfo.comment 0199 type: Kirigami.Heading.Type.Secondary 0200 elide: Text.ElideRight 0201 maximumLineCount: 1 0202 wrapMode: Text.Wrap 0203 Layout.fillWidth: true 0204 clip: true 0205 Layout.rightMargin: Kirigami.Units.largeSpacing * 10 0206 } 0207 RowLayout { 0208 Layout.fillWidth: true 0209 Kirigami.Icon { 0210 source: `comment-symbolic` 0211 color: Kirigami.Theme.disabledTextColor 0212 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0213 Layout.preferredWidth: Kirigami.Units.largeSpacing * 2 0214 } 0215 Kirigami.Heading { 0216 level: 5 0217 text: delegate.reportInfo.statusCount 0218 type: Kirigami.Heading.Type.Secondary 0219 elide: Text.ElideRight 0220 } 0221 Kirigami.Icon { 0222 source: `camera-web-symbolic` 0223 color: Kirigami.Theme.disabledTextColor 0224 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2 0225 Layout.preferredWidth: Kirigami.Units.largeSpacing * 2 0226 } 0227 Kirigami.Heading { 0228 level: 5 0229 text: delegate.reportInfo.mediaAttachmentCount 0230 type: Kirigami.Heading.Type.Secondary 0231 elide: Text.ElideRight 0232 } 0233 } 0234 } 0235 ColumnLayout { 0236 spacing: 0 0237 0238 Kirigami.Heading { 0239 level: 5 0240 text: i18n("Assigned Account:") 0241 type: Kirigami.Heading.Type.Primary 0242 elide: Text.ElideRight 0243 Layout.alignment: Qt.AlignLeft 0244 } 0245 RowLayout { 0246 spacing: 0 0247 Layout.alignment: Qt.AlignRight 0248 Layout.fillWidth: true 0249 Item { 0250 Layout.preferredWidth: height 0251 Layout.preferredHeight: Kirigami.Units.gridUnit * 2 0252 0253 KirigamiComponents.Avatar { 0254 anchors.fill: parent 0255 visible: delegate.reportInfo.assignedModerator 0256 anchors.margins: Kirigami.Units.smallSpacing 0257 source: delegate.reportInfo.assignedModerator ? delegate.reportInfo.assignedAccount.userLevelIdentity.avatarUrl : '' 0258 name: delegate.reportInfo.assignedModerator ? delegate.reportInfo.assignedAccount.userLevelIdentity.displayName : '' 0259 implicitWidth: avatar.width 0260 implicitHeight: avatar.height 0261 } 0262 } 0263 Kirigami.Heading { 0264 level: 4 0265 text: delegate.reportInfo.assignedModerator ? delegate.reportInfo.assignedAccount.userLevelIdentity.account : i18nc("@info: No account assigned to the report","N/A") 0266 type: Kirigami.Heading.Type.Secondary 0267 elide: Text.ElideRight 0268 Layout.alignment: Qt.AlignRight 0269 } 0270 } 0271 } 0272 } 0273 Kirigami.Separator { 0274 Layout.fillWidth: true 0275 } 0276 0277 QQC2.ProgressBar { 0278 visible: reportView.model.loading && (index == reportView.count - 1) 0279 indeterminate: true 0280 padding: Kirigami.Units.largeSpacing * 2 0281 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter 0282 Layout.topMargin: Kirigami.Units.largeSpacing 0283 Layout.bottomMargin: Kirigami.Units.largeSpacing 0284 Layout.leftMargin: Kirigami.Units.largeSpacing 0285 Layout.rightMargin: Kirigami.Units.largeSpacing 0286 } 0287 } 0288 } 0289 QQC2.ProgressBar { 0290 visible: reportView.model.loading && reportView.count === 0 0291 anchors.centerIn: parent 0292 indeterminate: true 0293 } 0294 Kirigami.PlaceholderMessage { 0295 anchors.centerIn: parent 0296 text: i18n("No reports found") 0297 visible: reportView.count === 0 && !reportView.model.loading 0298 width: parent.width - Kirigami.Units.gridUnit * 4 0299 } 0300 } 0301 } 0302 0303