Warning, /pim/merkuro/src/mail/qml/private/MailDelegate.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 2.15 0005 import QtQuick.Controls 2.15 as QQC2 0006 import QtQuick.Layouts 1.15 0007 0008 import org.kde.kirigami 2.19 as Kirigami 0009 import org.kde.kirigamiaddons.delegates 1.0 as Delegates 0010 import org.kde.kirigamiaddons.labs.components 1.0 as Components 0011 0012 Delegates.IndicatorItemDelegate { 0013 id: root 0014 0015 required property date datetime 0016 required property string from 0017 required property string to 0018 required property string sender 0019 required property string title 0020 required property var status 0021 required property var item 0022 0023 readonly property string datetimeText: datetime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat) 0024 0025 unread: status && !status.isRead 0026 0027 signal openMailRequested() 0028 signal starMailRequested() 0029 signal contextMenuRequested() 0030 0031 TapHandler { 0032 acceptedButtons: Qt.RightButton 0033 onTapped: root.contextMenuRequested() 0034 } 0035 0036 onPressAndHold: root.contextMenuRequested() 0037 onClicked: root.openMailRequested() 0038 0039 contentItem: RowLayout { 0040 Components.Avatar { 0041 // Euristic to extract name from "Name <email>" pattern 0042 name: root.from.replace(/<.*>/, '').replace(/\(.*\)/, '') 0043 // Extract and use email address as unique identifier for image provider 0044 source: 'image://contact/' + new RegExp("<(.*)>").exec(root.from)[1] ?? '' 0045 Layout.rightMargin: Kirigami.Units.largeSpacing 0046 sourceSize.width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 0047 sourceSize.height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 0048 Layout.preferredWidth: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 0049 Layout.preferredHeight: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 0050 } 0051 0052 ColumnLayout { 0053 Layout.fillWidth: true 0054 spacing: Kirigami.Units.smallSpacing 0055 0056 RowLayout { 0057 Layout.fillWidth: true 0058 QQC2.Label { 0059 Layout.fillWidth: true 0060 text: root.from 0061 elide: Text.ElideRight 0062 font.weight: root.unread ? Font.Bold : Font.Normal 0063 } 0064 0065 QQC2.Label { 0066 color: Kirigami.Theme.disabledTextColor 0067 text: root.datetimeText 0068 } 0069 } 0070 QQC2.Label { 0071 Layout.fillWidth: true 0072 text: root.title 0073 elide: Text.ElideRight 0074 font.weight: root.unread ? Font.Bold : Font.Normal 0075 } 0076 } 0077 } 0078 } 0079