summary refs log tree commit diff
path: root/resources/qml/dialogs/ReportMessage.qml
blob: a0b6325ce15e8cecbff40ef4f4bbe0cbb850cfdc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import im.nheko

ApplicationWindow {
    required property string eventId

    width: 400
    height: gl.implicitHeight + 2 * Nheko.paddingMedium
    title: qsTr("Report message")

    GridLayout {
        id: gl

        columnSpacing: Nheko.paddingMedium
        rowSpacing: Nheko.paddingMedium
        columns: 2
        anchors.fill: parent
        anchors.margins: Nheko.paddingMedium

        Label {
            Layout.columnSpan: 2
            Layout.fillWidth: true
            wrapMode: Label.WordWrap
            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.")
        }

        Label {
            text: qsTr("Enter your reason for reporting:")
        }

        TextField {
            id: reason

            Layout.fillWidth: true
        }

        Label {
            text: qsTr("How bad is the message?")
        }

        Slider {
            id: score

            from: 0
            to: -100
            stepSize: 25
            snapMode: Slider.SnapAlways
            Layout.fillWidth: true
        }

        Item {}

        Label {
            text: {
                if (score.value === 0)
                    return qsTr("Not bad")
                else if (score.value === -25)
                    return qsTr("Mild")
                else if (score.value === -50)
                    return qsTr("Bad")
                else if (score.value === -75)
                    return qsTr("Serious")
                else if (score.value === -100)
                    return qsTr("Extremely serious")
            }
        }

        DialogButtonBox {
            Layout.columnSpan: 2
            Layout.alignment: Qt.AlignRight
            standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
            onAccepted: {
                room.reportEvent(eventId, reason.text, score.value);
                close();
            }
            onRejected: close()
        }
    }
}