-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
ConversationDelegate.qml
73 lines (62 loc) · 2.36 KB
/
ConversationDelegate.qml
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
// SPDX-FileCopyrightText: 2022 Carl Schwan <[email protected]>
// SPDX-License-Identifier: LGPL-2.1-or-later
import QtQuick
import org.kde.kirigami 2 as Kirigami
import QtQuick.Controls 2 as QQC2
import QtQuick.Layouts
import org.kde.kirigamiaddons.delegates 1 as Delegates
import org.kde.kirigamiaddons.components 1 as KirigamiComponents
import org.kde.tokodon
Delegates.IndicatorItemDelegate {
id: root
required property string id
required property string content
required property var authorIdentity
required property string relativeTime
required property int conversationsCount
required property string conversationId
readonly property bool showSeparator: root.index !== conversationsCount - 1
signal markAsRead(conversationId: string)
onClicked: {
Navigation.openPost(root.id)
if (root.unread) {
root.markAsRead(root.conversationId);
}
}
contentItem: RowLayout {
id: rowLayout
KirigamiComponents.Avatar {
name: root.authorIdentity.displayName
source: root.authorIdentity.avatarUrl
Layout.rightMargin: Kirigami.Units.largeSpacing
sourceSize.width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
sourceSize.height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
Layout.preferredWidth: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
Layout.preferredHeight: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
}
ColumnLayout {
Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing
RowLayout {
Layout.fillWidth: true
QQC2.Label {
Layout.fillWidth: true
text: root.authorIdentity.displayNameHtml
elide: Text.ElideRight
font.weight: root.unread ? Font.Bold : Font.Normal
}
QQC2.Label {
text: root.relativeTime
color: Kirigami.Theme.disabledTextColor
}
}
QQC2.Label {
color: Kirigami.Theme.disabledTextColor
Layout.fillWidth: true
maximumLineCount: 1
elide: Text.ElideRight
text: root.content
}
}
}
}