19import QtQuick.Controls.Suru 2.2
20import Lomiri.Components 1.3
21import Lomiri.Components.Popups 1.3
24import Dekko.Components 1.0
25import Dekko.Mail.Settings 1.0
26import Dekko.Mail.API 1.0
27import Dekko.Mail.Stores.Views 1.0
28import Dekko.Lomiri.Components 1.0
32import Dekko.Lomiri.Constants 1.0
37 pageHeader.showDivider: false
38 pageHeader.visible: false
40 DefaultMessagePageHeader {
50 property alias msgId: message.messageId
54 onFormFactorChanged: {
55 if ((ViewStore.formFactor !== "small") && (stageArea.stageID === ViewKeys.messageListStack)) {
56 ViewActions.switchMessageViewLocation(ViewKeys.messageListStack, msgId)
57 }
else if ((ViewStore.formFactor ===
"small") && (stageArea.stageID === ViewKeys.messageViewStack)) {
58 ViewActions.switchMessageViewLocation(ViewKeys.messageViewStack, msgId)
66 webview.setCidQuery(message.messageId)
67 webview.setBodyUrl(body)
68 if (!message.isRead) {
69 switch(mailPolicy.markRead) {
70 case MailPolicy.Never:
71 Log.logInfo(
"DefaultMessagePage::onBodyChanged",
"Not marking message as read");
73 case MailPolicy.AfterInterval:
74 Log.logInfo(
"DefaultMessagePage::onBodyChanged",
"Marking message read after interval");
77 case MailPolicy.Immediately:
78 Log.logInfo(
"DefaultMessagePage::onBodyChanged",
"Marking message read immediately");
79 MessageActions.markMessageRead(message.messageId,
true)
88 accountId: message.parentAccountId
93 interval: mailPolicy.markAsReadInterval
95 onTriggered: MessageActions.markMessageRead(message.messageId,
true)
98 ContentBlockedNotice {
99 id: contentBlockedItem
100 contentBlocked: webview.contentBlocked
103 top: msgPgHeader.bottom
106 onAllowClicked: webview.allowBlockedContent()
115 top: contentBlockedItem.bottom
116 bottom: hiddenMargin.top
121 invite: message.invite
123 maxHeight: container.height / 2
127 top: detailsPanel.bottom
136 top: inviteCard.bottom
137 bottom: parent.bottom
138 leftMargin: !dekko.isSmallFF ?
Style.smallSpacing : 0
150 property string contextContentText:
""
151 property bool contextContentIsMail: contextContentText.startsWith(
"mailto:")
153 backgroundColor: theme.palette.normal.overlay
154 width: actionShapeRow.width + units.gu(1)
155 height: copyShape.height + units.gu(0.2) + (linkToCopyOrOpenLabel.visible ? linkToCopyOrOpenLabel.contentHeight + units.gu(0.1) : 0)
171 horizontalCenter: parent.horizontalCenter
173 topMargin: units.gu(0.1)
177 width: gripImage.width
178 height: copyShape.height
179 backgroundColor: theme.palette.normal.overlay
180 aspect: LomiriShape.Flat
181 anchors.verticalCenter: parent.verticalCenter
191 height: parent.height
199 source: gripIcon.source
200 fillMode: Image.PreserveAspectCrop
205 drag.target: contextMenuShape
206 drag.axis: Drag.XAndYAxis
212 width: (selectAllIcon.width > selectAllLabel.contentWidth ? selectAllIcon.width : selectAllLabel.contentWidth)
213 height: selectAllIcon.height + selectAllLabel.contentHeight + units.gu(1.5)
214 backgroundColor: theme.palette.normal.overlay
215 aspect: LomiriShape.Flat
219 name:
"edit-select-all"
224 topMargin: units.gu(0.5)
225 horizontalCenter: parent.horizontalCenter
232 top: selectAllIcon.bottom
233 topMargin: units.gu(0.5)
234 horizontalCenter: parent.horizontalCenter
236 text: qsTr(
"Select all")
243 webview.triggerWebAction(WebEngineView.SelectAll)
250 width: (copyIcon.width > copyLabel.contentWidth ? copyIcon.width : copyLabel.contentWidth)
251 height: copyIcon.height + copyLabel.contentHeight + units.gu(1.5)
252 backgroundColor: theme.palette.normal.overlay
253 aspect: LomiriShape.Flat
262 topMargin: units.gu(0.5)
263 horizontalCenter: parent.horizontalCenter
271 topMargin: units.gu(0.5)
272 horizontalCenter: parent.horizontalCenter
281 if (contextMenuShape.contextContentText !==
"") {
282 webview.triggerWebAction(WebEngineView.CopyLinkToClipboard)
284 webview.triggerWebAction(WebEngineView.Copy)
286 contextMenuShape.visible =
false
293 width: (openUrlIcon.width > openUrlLabel.contentWidth ? openUrlIcon.width : openUrlLabel.contentWidth)
294 height: openUrlIcon.height + openUrlLabel.contentHeight + units.gu(1.5)
295 backgroundColor: theme.palette.normal.overlay
296 aspect: LomiriShape.Flat
297 visible: contextMenuShape.contextContentText !==
""
301 name: contextMenuShape.contextContentIsMail ?
"mail-unread" :
"external-link"
306 topMargin: units.gu(0.5)
307 horizontalCenter: parent.horizontalCenter
314 top: openUrlIcon.bottom
315 topMargin: units.gu(0.5)
316 horizontalCenter: parent.horizontalCenter
318 text: contextMenuShape.contextContentIsMail ? qsTr(
"New mail") : qsTr(
"Open link")
325 Qt.openUrlExternally(contextMenuShape.contextContentText)
326 contextMenuShape.visible =
false
332 width: (closeIcon.width > closeLabel.contentWidth ? closeIcon.width : closeLabel.contentWidth)
333 height: closeIcon.height + closeLabel.contentHeight + units.gu(1.5)
334 backgroundColor: theme.palette.normal.overlay
335 aspect: LomiriShape.Flat
344 topMargin: units.gu(0.5)
345 horizontalCenter: parent.horizontalCenter
352 top: closeIcon.bottom
353 topMargin: units.gu(0.5)
354 horizontalCenter: parent.horizontalCenter
363 contextMenuShape.visible =
false
370 id: linkToCopyOrOpenLabel
371 text: contextMenuShape.contextContentText
372 width: parent.width - units.gu(1)
374 top: actionShapeRow.bottom
375 topMargin: units.gu(0.1)
377 leftMargin: units.gu(0.5)
380 elide: Text.ElideRight
389 detailsVisible: detailsPanel.showDetails
391 onShowDetails: detailsPanel.showDetails = !detailsPanel.showDetails
396 property bool showDetails:
false
397 property int detailsHeight: details.height > units.gu(30) ? units.gu(30) : details.height
398 color: Suru.backgroundColor
405 expansion.height: detailsHeight
406 expansion.expanded: showDetails
407 divider.visible: showDetails
410 contentHeight: details.height
415 leftMargin:
Style.smallSpacing
417 rightMargin:
Style.smallSpacing
424 width: tl.width +
Style.smallSpacing
428 bottom: parent.bottom
436 topMargin:
Style.defaultSpacing
437 leftMargin:
Style.smallSpacing
444 aspect: LomiriShape.Flat
445 color: Qt.rgba(0, 0, 0, 0.05)
448 width: inner_avatar.width + label.width + units.gu(1.5)
451 leftMargin:
Style.smallSpacing
453 topMargin: units.gu(1.5)
462 bottom: parent.bottom
465 name: message.from.name
466 initials: message.from.initials
467 email: message.from.address
475 left: inner_avatar.right
476 leftMargin: units.gu(0.5)
477 verticalCenter: parent.verticalCenter
479 text: message.from.name
485 PopupUtils.open(Qt.resolvedUrl(
"../popovers/RecipientPopover.qml"), delegate, {address: message.from})
496 visible: message.cc.count
509 bottom: parent.bottom
512 height: attachmentPanel.visible ? attachmentPanel.height : 0
517 attachments: message.attachments.model
521 bottom: parent.bottom
524 maxHeight: container.height -
Style.defaultSpacing