19import QtQuick.Controls.Suru 2.2
20import Lomiri.Components 1.3
21import Lomiri.Components.Popups 1.1
22import QtGraphicalEffects 1.0
23import Dekko.Components 1.0
25import Dekko.Mail.API 1.0
26import Dekko.Mail.Settings 1.0
27import Dekko.Lomiri.Components 1.0
29import Dekko.Lomiri.Constants 1.0
32 id: normalMessageItemDelegate
37 property bool canLoad: false
47 property alias avatarVisible: inner_name.visible
49 property Action flagAction: Action {
51 text: canLoad && msg.isImportant ? qsTr("Un-mark flagged") : qsTr(
"Mark flagged")
52 iconSource: canLoad && msg.isImportant ? Paths.actionIconUrl(Paths.UnStarredIcon) :
53 Paths.actionIconUrl(Paths.StarredIcon)
55 onTriggered: MessageActions.markMessageImportant(msg.messageId, !msg.isImportant)
58 property Action readAction: Action {
60 text: canLoad && msg.isRead ? qsTr(
"Mark as un-read") : qsTr(
"Mark as read")
61 iconSource: canLoad && msg.isRead ? Paths.actionIconUrl(Paths.MailUnreadIcon) :
62 Paths.actionIconUrl(Paths.MailReadIcon)
63 onTriggered: Client.markMessageRead(msg.messageId, !msg.isRead);
66 property Action moveAction: Action {
67 text: qsTr(
"Move message")
68 iconSource: Paths.actionIconUrl(Paths.InboxIcon)
71 property Action contextAction: Action {
72 text: qsTr(
"Context menu")
73 iconName: "contextual-menu"
74 onTriggered: rightClickActions.trigger()
77 property Action rightClickActions: Action {
79 onTriggered: PopupUtils.open(Qt.resolvedUrl(
"../popovers/MessageListActionPopover.qml"),
82 msg: normalMessageItemDelegate.msg
91 triggerActionOnMouseRelease:
true
98 title.text: msg ? msg.from.name :
""
99 title.font.bold: canLoad && !msg.isRead
100 title.fontSize:
"x-small"
101 title.elide: Text.ElideRight
102 title.wrapMode: Text.NoWrap
104 subtitle.text: msg ? msg.subject :
""
105 subtitle.font.bold: canLoad && !msg.isRead
106 subtitle.fontSize:
"medium"
107 subtitle.elide: Text.ElideRight
108 subtitle.wrapMode: Text.NoWrap
110 summary.maximumLineCount: PolicyManager.views.previewLines
111 summary.text: canLoad && msg.preview ? msg.preview :
" "
112 summary.fontSize:
"medium"
114 padding.top: units.gu(1)
115 padding.bottom: units.gu(1)
119 msg: normalMessageItemDelegate.msg
123 SlotsLayout.position: SlotsLayout.Leading
125 if (inner_name.state ===
"front") {
126 ViewActions.pushToStageArea(ViewKeys.messageListStack, Qt.resolvedUrl(
"../views/ContactFilterView.qml"),
129 title: msg.from.name,
130 email: msg.from.address,
131 initials: msg.from.initials,
132 filterKey: msg.senderMsgKey
142 property int iconsVerticalSpacing: units.gu(0.5)
143 property int iconsHorizontalSpacing: units.gu(1.0)
145 height: inner_timeLabel.height + units.gu(1) + star.height
146 width: Math.max(inner_timeLabel.width, star.width + attachmentImg.width + units.gu(1))
147 SlotsLayout.overrideVerticalPositioning:
true
152 +
main.title.baselineOffset - baselineOffset
153 anchors.right: parent.right
154 text: msg ? msg.prettyDate :
""
160 height:
Style.defaultSpacing
164 top: inner_timeLabel.bottom
165 topMargin: parent.iconsVerticalSpacing
167 name: canLoad && msg.isImportant ? Icons.StarredIcon : Icons.UnStarredIcon
168 Suru.highlightType: Suru.WarningHighlight
169 color: canLoad && msg.isImportant ? Suru.highlightColor : LomiriColors.ash
172 onClicked: MessageActions.markMessageImportant(msg.messageId, !msg.isImportant)
178 height:
Style.defaultSpacing
179 width: visible ? height : 0
182 rightMargin: parent.iconsHorizontalSpacing
183 top: inner_timeLabel.bottom
184 topMargin: parent.iconsVerticalSpacing
186 visible: canLoad && msg.hasAttachments
187 name: Icons.AttachmentIcon
188 color: LomiriColors.ash