Warning, /pim/merkuro/src/mail/qml/ConversationViewer.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2016 Michael Bohlender <michael.bohlender@kdemail.net>
0002 // SPDX-FileCopyrightText: 2022 Devin Lin <espidev@gmail.com>
0003 // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Layouts 1.15
0007 import QtQuick.Controls 2.15 as QQC2
0008 
0009 import org.kde.merkuro.mail 1.0
0010 import org.kde.kirigami 2.14 as Kirigami
0011 import org.kde.kitemmodels 1.0 as KItemModels
0012 import org.kde.pim.mimetreeparser 1.0 as MimeTreeParser
0013 
0014 MimeTreeParser.MailViewer {
0015     id: root
0016 
0017     required property var emptyItem
0018     required property var props
0019 
0020     leftPadding: 0
0021     rightPadding: 0
0022     topPadding: 0
0023     bottomPadding: 0
0024 
0025     icalCustomComponent: Qt.resolvedUrl("./mailpartview/ICalPart.qml")
0026 
0027     actions: [
0028         Kirigami.Action {
0029             text: i18n("Move to trash")
0030             icon.name: "albumfolder-user-trash"
0031             onTriggered: {
0032                 MailManager.moveToTrash(root.emptyItem);
0033                 applicationWindow().pageStack.pop();
0034             }
0035         }
0036     ]
0037 
0038     header: ColumnLayout {
0039         width: parent.width
0040         spacing: 0
0041 
0042         QQC2.Pane {
0043             Kirigami.Theme.colorSet: Kirigami.Theme.View
0044             Kirigami.Theme.inherit: false
0045 
0046             Layout.fillWidth: true
0047             padding: root.padding
0048 
0049             contentItem: Kirigami.Heading {
0050                 text: props.title
0051                 maximumLineCount: 2
0052                 wrapMode: Text.Wrap
0053                 elide: Text.ElideRight
0054             }
0055         }
0056 
0057         QQC2.ToolBar {
0058             id: mailHeader
0059 
0060             Layout.fillWidth: true
0061 
0062             padding: root.padding
0063             visible: root.from.length > 0 || root.to.length > 0 || root.subject.length > 0 
0064 
0065             Kirigami.Theme.inherit: false
0066             Kirigami.Theme.colorSet: Kirigami.Theme.View
0067 
0068             background: Item {
0069                 Rectangle {
0070                     anchors.fill: parent
0071                     color: Kirigami.Theme.alternateBackgroundColor
0072                 }
0073 
0074                 Kirigami.Separator {
0075                     anchors.top: parent.top
0076                     anchors.left: parent.left
0077                     anchors.right: parent.right
0078                 }
0079 
0080                 Kirigami.Separator {
0081                     anchors.bottom: parent.bottom
0082                     anchors.left: parent.left
0083                     anchors.right: parent.right
0084                 }
0085             }
0086 
0087             contentItem: GridLayout {
0088                 rowSpacing: Kirigami.Units.smallSpacing
0089                 columnSpacing: Kirigami.Units.smallSpacing
0090 
0091                 columns: 2
0092 
0093                 QQC2.Label {
0094                     text: i18n('Date:')
0095                     font.bold: true
0096                     visible: date.text.length > 0
0097 
0098                     Layout.rightMargin: Kirigami.Units.largeSpacing
0099                 }
0100 
0101                 QQC2.Label {
0102                     id: date
0103                     text: root.dateTime.toLocaleString(Qt.locale(), Locale.ShortFormat)
0104                     visible: text.length > 0
0105                     horizontalAlignment: Text.AlignRight
0106                 }
0107 
0108                 QQC2.Label {
0109                     text: i18n('From:')
0110                     font.bold: true
0111                     visible: root.from.length > 0
0112 
0113                     Layout.rightMargin: Kirigami.Units.largeSpacing
0114                 }
0115 
0116                 QQC2.Label {
0117                     text: root.from
0118                     visible: text.length > 0
0119                     elide: Text.ElideRight
0120 
0121                     Layout.fillWidth: true
0122                 }
0123 
0124                 QQC2.Label {
0125                     text: i18n('Sender:')
0126                     font.bold: true
0127                     visible: root.sender.length > 0 && root.sender !== root.from
0128 
0129                     Layout.rightMargin: Kirigami.Units.largeSpacing
0130                 }
0131 
0132                 QQC2.Label {
0133                     visible: root.sender.length > 0 && root.sender !== root.from
0134                     text: root.sender
0135                     elide: Text.ElideRight
0136 
0137                     Layout.fillWidth: true
0138                 }
0139 
0140                 QQC2.Label {
0141                     text: i18n('To:')
0142                     font.bold: true
0143                     visible: root.to.length > 0
0144 
0145                     Layout.rightMargin: Kirigami.Units.largeSpacing
0146                 }
0147 
0148                 QQC2.Label {
0149                     text: root.to
0150                     elide: Text.ElideRight
0151                     visible: root.to.length > 0
0152 
0153                     Layout.fillWidth: true
0154                 }
0155             }
0156         }
0157     }
0158 
0159     MessageLoader {
0160         id: messageLoader
0161 
0162         item: root.emptyItem
0163         onMessageChanged: root.message = message
0164     }
0165 }