Debian Codegraph @

resources/qml/dialogs/IgnoredUsers.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import QtQml
6 import QtQuick
7 import QtQuick.Controls
8 import QtQuick.Layouts
9 import QtQuick.Window
10 import im.nheko
11 import "../"
12
13 Window {
14 id: ignoredUsers
15
16 title: qsTr("Ignored users")
17 flags: Qt.WindowCloseButtonHint | Qt.WindowTitleHint
18 height: 650
19 width: 420
20 minimumHeight: 420
21 color: palette.window
22
23 ListView {
24 id: view
25 anchors.fill: parent
26 spacing: Nheko.paddingMedium
27 footerPositioning: ListView.OverlayFooter
28
29 model: TimelineManager.ignoredUsers
30 header: ColumnLayout {
31 Text {
32 Layout.fillWidth: true
33 Layout.maximumWidth: view.width
34 wrapMode: Text.Wrap
35 color: palette.text
36 text: qsTr("Ignoring a user hides their messages (they can still see yours!).")
37 }
38
39 Item { Layout.preferredHeight: Nheko.paddingLarge }
40 }
41 delegate: RowLayout {
42 property var profile: TimelineManager.getGlobalUserProfile(modelData)
43
44 width: view.width
45
46 Avatar {
47 enabled: false
48 displayName: profile.displayName
49 userid: profile.userid
50 url: profile.avatarUrl.replace("mxc://", "image://MxcImage/")
51 }
52
53 Text {
54 Layout.fillWidth: true
55 Layout.alignment: Qt.AlignLeft
56 elide: Text.ElideRight
57 color: palette.text
58 text: modelData
59 }
60
61 ImageButton {
62 Layout.preferredHeight: 24
63 Layout.preferredWidth: 24
64 image: ":/icons/icons/ui/dismiss.svg"
65 hoverEnabled: true
66 ToolTip.visible: hovered
67 ToolTip.text: qsTr("Stop Ignoring.")
68 onClicked: profile.ignored = false
69 }
70 }
71 footer: DialogButtonBox {
72 z: 2
73 width: view.width
74 alignment: Qt.AlignRight
75 standardButtons: DialogButtonBox.Ok
76 onAccepted: ignoredUsers.close()
77
78 background: Rectangle {
79 anchors.fill: parent
80 color: palette.window
81 }
82 }
83 }
84 }