Warning, /network/tokodon/src/content/ui/ModerationTools/MainFederationToolPage.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 QtQuick.Layouts 0006 import QtQuick.Controls 2 as QQC2 0007 import org.kde.kirigami 2 as Kirigami 0008 import org.kde.kirigamiaddons.formcard 1 as FormCard 0009 0010 FormCard.FormCardPage { 0011 id: root 0012 0013 property int index 0014 property var model 0015 property int id 0016 property string domain 0017 property date createdAt 0018 property string severity 0019 property bool rejectMedia 0020 property bool rejectReports 0021 property bool obfuscate 0022 property string privateComment 0023 property string publicComment 0024 0025 title: root.domain 0026 0027 actions.contextualActions: Kirigami.Action { 0028 icon.name: "edit-delete-remove" 0029 text: i18n("Remove Domain Block") 0030 onTriggered: { 0031 root.model.removeDomainBlock(root.index) 0032 showPassiveNotification(i18n("Domain Block Removed")) 0033 pageStack.layers.pop() 0034 } 0035 } 0036 0037 data: Kirigami.PromptDialog { 0038 id: textPromptDialog 0039 0040 title: i18n("Edit domain block") 0041 0042 contentPadding: 0 0043 implicitWidth: Kirigami.Units.gridUnit * 20 0044 0045 mainItem: ColumnLayout { 0046 spacing: 0 0047 0048 FormCard.FormComboBoxDelegate { 0049 id: severityCombobox 0050 text: i18n("Moderation") 0051 textRole: "display" 0052 valueRole: "value" 0053 model: [ 0054 { 0055 display: i18nc("@info:Filter out all the allowed domains", "Silence"), 0056 value: "silence" 0057 }, 0058 { 0059 display: i18nc("@info:Filter out all the blocked domains", "Suspend"), 0060 value: "suspend" 0061 }, 0062 { 0063 display: i18nc("@info:Filter out all the blocked domains", "None"), 0064 value: "noop" 0065 }, 0066 ] 0067 onCurrentIndexChanged: root.severity = model[currentIndex].value 0068 Component.onCompleted: severityCombobox.currentIndex = severityCombobox.indexOfValue(root.severity); 0069 } 0070 FormCard.FormDelegateSeparator {} 0071 FormCard.FormTextFieldDelegate { 0072 id: publicComment 0073 text: root.publicComment 0074 label: i18n("Public comment") 0075 } 0076 FormCard.FormDelegateSeparator {} 0077 FormCard.FormTextFieldDelegate { 0078 id: privateComment 0079 text: root.privateComment 0080 label: i18n("Private comment") 0081 } 0082 FormCard.FormDelegateSeparator { above: rejectMedia } 0083 FormCard.FormCheckDelegate { 0084 id: rejectMedia 0085 text: i18n("Reject media files") 0086 description: i18n("Removes locally stored media files and refuses to download any in the future. Irrelevant for suspensions") 0087 checked: root.rejectMedia 0088 onToggled: root.rejectMedia = rejectMedia.checked 0089 } 0090 FormCard.FormDelegateSeparator { below: rejectMedia; above: rejectReports } 0091 FormCard.FormCheckDelegate { 0092 id: rejectReports 0093 text: i18n("Reject reports") 0094 description: i18n("Ignore all reports coming from this domain. Irrelevant for suspensions") 0095 checked: root.rejectReports 0096 onToggled: root.rejectReports = rejectReports.checked 0097 } 0098 FormCard.FormDelegateSeparator { below: rejectReports; above: obfuscateReport } 0099 FormCard.FormCheckDelegate { 0100 id: obfuscateReports 0101 text: i18n("Obfuscate domain name") 0102 description: i18n("Partially obfuscate the domain name in the list if advertising the list of domain limitations is enabled") 0103 checked: root.obfuscate 0104 onToggled: root.obfuscate = obfuscateReports.checked 0105 } 0106 } 0107 standardButtons: Kirigami.Dialog.NoButton 0108 customFooterActions: [ 0109 Kirigami.Action { 0110 text: i18nc("@info:Cancel button to close the dailog", "Cancel") 0111 icon.name: "dialog-cancel" 0112 onTriggered: textPromptDialog.close(); 0113 }, 0114 Kirigami.Action { 0115 text: i18nc("@info:Button to update the domain block with new values", "Update Block") 0116 icon.name: "view-refresh" 0117 onTriggered: { 0118 root.privateComment = privateComment.text 0119 root.publicComment = publicComment.text 0120 root.model.updateDomainBlock(root.index, severityCombobox.currentValue, publicComment.text, privateComment.text, rejectMedia.checked, rejectReports.checked, obfuscateReports.checked) 0121 textPromptDialog.close(); 0122 showPassiveNotification(i18n("Domain block updated")) 0123 } 0124 } 0125 ] 0126 } 0127 0128 FormCard.FormCard { 0129 Layout.topMargin: Kirigami.Units.largeSpacing 0130 0131 FormCard.FormTextDelegate { 0132 text: i18n("Blocked at") 0133 description: root.createdAt.toLocaleDateString() 0134 } 0135 0136 FormCard.FormDelegateSeparator {} 0137 0138 FormCard.FormTextDelegate { 0139 text: i18n("Public comment") 0140 description: root.publicComment.length !== 0 ? root.publicComment : i18nc("@info: No public comment provided", "None") 0141 } 0142 0143 FormCard.FormDelegateSeparator {} 0144 0145 FormCard.FormTextDelegate { 0146 text: i18n("Private comment") 0147 description: root.privateComment.length !== 0 ? root.privateComment : i18nc("@info: No private comment provided", "None") 0148 } 0149 0150 FormCard.FormDelegateSeparator {} 0151 0152 FormCard.FormTextDelegate { 0153 text: i18nc("@info:The policy to be applied by this domain block", "Policy") 0154 description: root.severity 0155 } 0156 0157 FormCard.FormDelegateSeparator {} 0158 0159 FormCard.FormTextDelegate { 0160 text: i18nc("@info:Whether to obfuscate public displays of this domain block", "Obfuscate") 0161 description: root.obfuscate 0162 } 0163 0164 FormCard.FormDelegateSeparator {} 0165 0166 FormCard.FormTextDelegate { 0167 text: i18nc("@info:Whether to reject incoming media from this domain", "Reject media") 0168 description: root.rejectMedia 0169 } 0170 0171 FormCard.FormDelegateSeparator {} 0172 0173 FormCard.FormTextDelegate { 0174 text: i18nc("@info:Whether to reject incoming reports from this domain", "Reject reports") 0175 description: root.rejectReports 0176 } 0177 } 0178 0179 footer: QQC2.ToolBar { 0180 contentItem: RowLayout { 0181 Item { 0182 Layout.fillWidth: true 0183 } 0184 QQC2.Button { 0185 text: i18n("Edit Domain Block") 0186 icon.name: 'cell_edit' 0187 Layout.margins: Kirigami.Units.smallSpacing 0188 onClicked: { 0189 textPromptDialog.open() 0190 } 0191 } 0192 } 0193 } 0194 }