Page MenuHome GnuPG

No OneTemporary

diff --git a/src/quick/qml/MailViewer.qml b/src/quick/qml/MailViewer.qml
index ecbdd93..483892d 100644
--- a/src/quick/qml/MailViewer.qml
+++ b/src/quick/qml/MailViewer.qml
@@ -1,198 +1,197 @@
// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
// SPDX-FileCopyrightText: 2022 Devin Lin <espidev@gmail.com>
// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import QtGraphicalEffects 1.15
import org.kde.pim.mimetreeparser 1.0
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kitemmodels 1.0 as KItemModels
import './private'
-Kirigami.Page {
+Kirigami.ScrollablePage {
id: root
property alias message: mailPartView.message
readonly property string subject: mailPartView.subject
readonly property string from: mailPartView.from
readonly property string sender: mailPartView.sender
readonly property string to: mailPartView.to
readonly property date dateTime: mailPartView.dateTime
Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false
padding: Kirigami.Units.largeSpacing * 2
title: i18n("Message viewer")
header: QQC2.ToolBar {
id: mailHeader
padding: root.padding
visible: root.from.length > 0 || root.to.length > 0 || root.subject.length > 0
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View
background: Item {
Rectangle {
anchors.fill: parent
color: Kirigami.Theme.alternateBackgroundColor
}
Kirigami.Separator {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
}
Kirigami.Separator {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
}
}
GridLayout {
width: mailHeader.width - mailHeader.leftPadding - mailHeader.rightPadding
rowSpacing: Kirigami.Units.smallSpacing
columnSpacing: Kirigami.Units.smallSpacing
columns: 3
QQC2.Label {
text: i18n('Subject:')
font.bold: true
visible: root.subject.length > 0
Layout.rightMargin: Kirigami.Units.largeSpacing
}
QQC2.Label {
text: root.subject
visible: text.length > 0
elide: Text.ElideRight
Layout.fillWidth: true
}
QQC2.Label {
text: root.dateTime.toLocaleString(Qt.locale(), Locale.ShortFormat)
visible: text.length > 0
horizontalAlignment: Text.AlignRight
}
QQC2.Label {
text: i18n('From:')
font.bold: true
visible: root.from.length > 0
Layout.rightMargin: Kirigami.Units.largeSpacing
}
QQC2.Label {
text: root.from
visible: text.length > 0
elide: Text.ElideRight
Layout.fillWidth: true
Layout.columnSpan: 2
}
QQC2.Label {
text: i18n('Sender:')
font.bold: true
visible: root.sender.length > 0 && root.sender !== root.from
Layout.rightMargin: Kirigami.Units.largeSpacing
}
QQC2.Label {
visible: root.sender.length > 0 && root.sender !== root.from
text: root.sender
elide: Text.ElideRight
Layout.fillWidth: true
Layout.columnSpan: 2
}
QQC2.Label {
text: i18n('To:')
font.bold: true
visible: root.to.length > 0
Layout.rightMargin: Kirigami.Units.largeSpacing
}
QQC2.Label {
text: root.to
elide: Text.ElideRight
visible: root.to.length > 0
Layout.fillWidth: true
Layout.columnSpan: 2
}
}
}
MailPartView {
id: mailPartView
- anchors.fill: parent
}
footer: QQC2.ToolBar {
padding: root.padding
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View
background: Item {
Kirigami.Separator {
anchors {
left: parent.left
right: parent.right
top: undefined
bottom: parent.bottom
}
}
}
Flow {
anchors.fill: parent
spacing: Kirigami.Units.smallSpacing
Repeater {
model: mailPartView.attachmentModel
delegate: AttachmentDelegate {
id: attachmentDelegate
required property int index
required property string iconName
icon.name: iconName
clip: true
actionIcon: 'download'
actionTooltip: i18n("Save attachment")
onExecute: mailPartView.attachmentModel.saveAttachmentToDisk(index)
onClicked: mailPartView.attachmentModel.openAttachment(index)
onPublicKeyImport: mailPartView.attachmentModel.importPublicKey(index)
}
}
}
}
Connections {
target: mailPartView.attachmentModel
function onInfo(message) {
applicationWindow().showPassiveNotification(message);
}
}
}
diff --git a/src/quick/qml/private/MailPartModel.qml b/src/quick/qml/private/MailPartModel.qml
index 45cb7ca..bc5c4ef 100644
--- a/src/quick/qml/private/MailPartModel.qml
+++ b/src/quick/qml/private/MailPartModel.qml
@@ -1,166 +1,167 @@
// SPDX-FileCopyrightText: 2016 Michael Bohlender <michael.bohlender@kdemail.net>
// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import QtQml.Models 2.2
import org.kde.pim.mimetreeparser 1.0
import org.kde.kirigami 2.19 as Kirigami
DelegateModel {
id: root
property string searchString: ""
property bool autoLoadImages: false
delegate: RowLayout {
id: partColumn
width: ListView.view.width
- height: childrenRect.height
function getType(securityLevel) {
if (securityLevel == "good") {
return Kirigami.MessageType.Positive
}
if (securityLevel == "bad") {
return Kirigami.MessageType.Error
}
if (securityLevel == "notsogood") {
return Kirigami.MessageType.Warning
}
return Kirigami.MessageType.Information
}
function getColor(securityLevel) {
if (securityLevel == "good") {
return Kirigami.Theme.positiveTextColor
}
if (securityLevel == "bad") {
return Kirigami.Theme.negativeTextColor
}
if (securityLevel == "notsogood") {
return Kirigami.Theme.neutralTextColor
}
return "transparent"
}
function getDetails(signatureDetails) {
let details = "";
if (signatureDetails.keyMissing) {
details += i18n("This message has been signed using the key %1.", signatureDetails.keyId) + "\n";
details += i18n("The key details are not available.")
} else {
details += i18n("This message has been signed using the key %1 by %2.", signatureDetails.keyId, signatureDetails.signer) + "\n";
if (signatureDetails.keyRevoked) {
details += "\n" + i18n("The key was revoked.")
}
if (signatureDetails.keyExpired) {
details += "\n" + i18n("The key has expired.")
}
if (signatureDetails.keyIsTrusted) {
details += "\n" + i18n("You are trusting this key.")
}
if (!signatureDetails.signatureIsGood && !signatureDetails.keyRevoked && !signatureDetails.keyExpired && !signatureDetails.keyIsTrusted) {
details += "\n" + i18n("The signature is invalid.")
}
}
return details
}
QQC2.Control {
Layout.preferredWidth: Kirigami.Units.smallSpacing
Layout.fillHeight: true
visible: model.encrypted
background: Rectangle {
id: border
color: getColor(model.securityLevel)
opacity: 0.5
}
QQC2.ToolTip.text: getDetails(model.encryptionSecurityLevel)
QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
}
ColumnLayout {
Banner {
iconName: "mail-encrypted"
type: getType(model.encryptionSecurityLevel)
visible: model.encrypted
text: model.encryptionDetails.keyId.length === 0 ? i18n("This message is encrypted but we don't have the key for it.") : i18n("This message is encrypted to the key: %1", model.encryptionDetails.keyId);
Layout.fillWidth: true
}
Banner {
iconName: 'mail-signed'
visible: model.signed
type: getType(model.signatureSecurityLevel)
text: getDetails(model.signatureDetails)
Layout.fillWidth: true
}
Loader {
id: partLoader
Layout.preferredHeight: item ? item.contentHeight : 0
Layout.fillWidth: true
+ Layout.leftMargin: Kirigami.Units.largeSpacing
+ Layout.rightMargin: Kirigami.Units.largeSpacing
Component.onCompleted: {
switch (model.type + 0) {
case PartModel.Plain:
partLoader.setSource("TextPart.qml", {
content: model.content,
embedded: model.embedded,
})
break
case PartModel.Html:
partLoader.setSource("HtmlPart.qml", {
content: model.content,
})
break;
case PartModel.Error:
partLoader.setSource("ErrorPart.qml", {
errorType: model.errorType,
errorString: model.errorString,
})
break;
case PartModel.Encapsulated:
partLoader.setSource("MailPart.qml", {
rootIndex: root.modelIndex(index),
model: root.model,
sender: model.sender,
date: model.date,
})
break;
case PartModel.Ical:
partLoader.setSource("ICalPart.qml", {
content: model.content,
})
break;
}
}
Binding {
target: partLoader.item
property: "searchString"
value: root.searchString
when: partLoader.status === Loader.Ready
}
Binding {
target: partLoader.item
property: "autoLoadImages"
value: root.autoLoadImages
when: partLoader.status === Loader.Ready
}
}
}
}
}
diff --git a/src/quick/qml/private/MailPartView.qml b/src/quick/qml/private/MailPartView.qml
index df7b178..efbd594 100644
--- a/src/quick/qml/private/MailPartView.qml
+++ b/src/quick/qml/private/MailPartView.qml
@@ -1,38 +1,40 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-FileCopyrightText: 2016 Michael Bohlender <michael.bohlender@kdemail.net>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.14 as Kirigami
import QtQuick.Controls 2.15 as Controls
import org.kde.pim.mimetreeparser 1.0
import org.kde.kitemmodels 1.0 as KItemModels
ListView {
id: root
property alias message: messageParser.message
readonly property string subject: messageParser.subject
readonly property string from: messageParser.from
readonly property string sender: messageParser.sender
readonly property string to: messageParser.to
readonly property date dateTime: messageParser.date
property alias rootIndex: visualModel.rootIndex
property alias searchString: visualModel.searchString
property alias autoLoadImages: visualModel.autoLoadImages
property var attachmentModel: messageParser.attachments
- implicitHeight: root.count === 0 ? Kirigami.Units.gridUnit * 20 : contentHeight
- interactive: false
+ topMargin: Kirigami.Units.smallSpacing
+ bottomMargin: Kirigami.Units.smallSpacing
+
spacing: Kirigami.Units.smallSpacing
+
model: MailPartModel {
id: visualModel
model: messageParser.parts
}
MessageParser {
id: messageParser
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Dec 8, 3:25 AM (8 h, 15 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c7/87/06d817d5b082640d76df2e545a11

Event Timeline