Debian Codegraph @

resources/qml/dialogs/ReportMessage.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import QtQuick
6 import QtQuick.Controls
7 import QtQuick.Layouts
8 import im.nheko
9
10 ApplicationWindow {
11 required property string eventId
12
13 width: 400
14 height: gl.implicitHeight + 2 * Nheko.paddingMedium
15 title: qsTr("Report message")
16
17 GridLayout {
18 id: gl
19
20 columnSpacing: Nheko.paddingMedium
21 rowSpacing: Nheko.paddingMedium
22 columns: 2
23 anchors.fill: parent
24 anchors.margins: Nheko.paddingMedium
25
26 Label {
27 Layout.columnSpan: 2
28 Layout.fillWidth: true
29 wrapMode: Label.WordWrap
30 text: qsTr("This message you are reporting will be sent to your server administrator for review. Please note that not all server administrators review reported content. You should also ask a room moderator to remove the content if necessary.")
31 }
32
33 Label {
34 text: qsTr("Enter your reason for reporting:")
35 }
36
37 TextField {
38 id: reason
39
40 Layout.fillWidth: true
41 }
42
43 Label {
44 text: qsTr("How bad is the message?")
45 }
46
47 Slider {
48 id: score
49
50 from: 0
51 to: -100
52 stepSize: 25
53 snapMode: Slider.SnapAlways
54 Layout.fillWidth: true
55 }
56
57 Item {}
58
59 Label {
60 text: {
61 if (score.value === 0)
62 return qsTr("Not bad")
63 else if (score.value === -25)
64 return qsTr("Mild")
65 else if (score.value === -50)
66 return qsTr("Bad")
67 else if (score.value === -75)
68 return qsTr("Serious")
69 else if (score.value === -100)
70 return qsTr("Extremely serious")
71 }
72 }
73
74 DialogButtonBox {
75 Layout.columnSpan: 2
76 Layout.alignment: Qt.AlignRight
77 standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
78 onAccepted: {
79 room.reportEvent(eventId, reason.text, score.value);
80 close();
81 }
82 onRejected: close()
83 }
84 }
85 }