summaryrefslogtreecommitdiffstats
path: root/components/mailviewer/contents
diff options
context:
space:
mode:
Diffstat (limited to 'components/mailviewer/contents')
-rw-r--r--components/mailviewer/contents/ui/MailDataModel.qml131
1 files changed, 68 insertions, 63 deletions
diff --git a/components/mailviewer/contents/ui/MailDataModel.qml b/components/mailviewer/contents/ui/MailDataModel.qml
index ad0b1cc9..029e8707 100644
--- a/components/mailviewer/contents/ui/MailDataModel.qml
+++ b/components/mailviewer/contents/ui/MailDataModel.qml
@@ -43,81 +43,86 @@ DelegateModel {
43 return Kube.Colors.lightgrey 43 return Kube.Colors.lightgrey
44 } 44 }
45 45
46 function getDetails(signed, encrypted, signatureDetails) 46 function getDetails(signatureDetails)
47 { 47 {
48 var details = ""; 48 var details = "";
49 if (encrypted) { 49 if (signatureDetails.noSignaturesFound) {
50 details += qsTr("This message is encrypted.") + "\n"; 50 details += qsTr("This message has been signed but we failed to validate the signature.") + "\n"
51 } 51 } else if (!signatureDetails.signatureIsGood) {
52 52 details += qsTr("This message is signed but the signature is invalid.") + "\n"
53 if (signed) { 53 } else if (signatureDetails.keyMissing) {
54 if (details.noSignaturesFound) { 54 details += qsTr("This message has been signed using the key %1.").arg(signatureDetails.keyId) + "\n";
55 details += qsTr("This message has been signed but we failed to validate the signature.") + "\n" 55 details += qsTr("The key details are not available.") + "\n";
56 } else if (!signatureDetails.signatureIsGood) { 56 return details;
57 details += qsTr("This message is signed but the signature is invalid.") + "\n" 57 } else {
58 } else if (signatureDetails.keyMissing) { 58 details += qsTr("This message has been signed using the key %1 by %2.").arg(signatureDetails.keyId).arg(signatureDetails.signer) + "\n";
59 details += qsTr("This message has been signed using the key %1.").arg(signatureDetails.keyId) + "\n"; 59 if (signatureDetails.keyRevoked) {
60 details += qsTr("The key details are not available.") + "\n"; 60 details += qsTr("The key was revoked.") + "\n"
61 return details; 61 }
62 } else { 62 if (signatureDetails.keyExpired) {
63 details += qsTr("This message has been signed using the key %1 by %2.").arg(signatureDetails.keyId).arg(signatureDetails.signer) + "\n"; 63 details += qsTr("The key has expired.") + "\n"
64 if (signatureDetails.keyRevoked) { 64 }
65 details += qsTr("The key was revoked.") + "\n" 65 if (signatureDetails.keyIsTrusted) {
66 } 66 details += qsTr("You are trusting this key.") + "\n"
67 if (signatureDetails.keyExpired) {
68 details += qsTr("The key has expired.") + "\n"
69 }
70 if (signatureDetails.keyIsTrusted) {
71 details += qsTr("You are trusting this key.") + "\n"
72 }
73 } 67 }
74 } 68 }
75 return details 69 return details
76 } 70 }
77 71
78 Row { 72 Column {
79 anchors { 73 id: buttons
80 top: parent.top 74 anchors.right: parent.left
81 left: parent.left 75 anchors.top: parent.top
82 right: parent.right 76 anchors.rightMargin: Kube.Units.smallSpacing
83 }
84 height: partLoader.height
85 spacing: Kube.Units.smallSpacing 77 spacing: Kube.Units.smallSpacing
86 Rectangle { 78 Kube.IconButton {
87 id: border 79 id: encryptedButton
88 visible: model.encrypted || model.signed 80 width: Kube.Units.gridUnit
89 anchors { 81 height: width
90 top: parent.top 82 iconName: Kube.Icons.secure
91 bottom: parent.bottom
92 }
93 width: Kube.Units.smallSpacing
94 color: getColor(model.securityLevel) 83 color: getColor(model.securityLevel)
95 opacity: 0.5 84 backgroundOpacity: 0.5
96 Kube.ToolTip { 85 visible: model.encrypted
97 id: tooltip 86 tooltip: qsTr("This message is encrypted.");
98 text: getDetails(model.signed, model.encrypted, model.signatureDetails); 87 //FIXME make text copyable
99 visible: mouseArea.containsMouse 88 // Kube.SelectableItem {
100 } 89 // visualParent: encryptedButton
101 Kube.SelectableItem { 90 // text: parent.tooltip
102 visualParent: border 91 // }
103 text: tooltip.text 92 }
104 } 93 Kube.IconButton {
105 MouseArea { 94 id: signedButton
106 id: mouseArea 95 width: Kube.Units.gridUnit
107 anchors.fill: parent 96 height: width
108 hoverEnabled: true 97 iconName: Kube.Icons.signed
109 acceptedButtons: Qt.NoButton 98 color: getColor(model.securityLevel)
110 } 99 backgroundOpacity: 0.5
100 visible: model.signed
101 tooltip: getDetails(model.signatureDetails)
111 } 102 }
103 }
104 Rectangle {
105 id: border
106 visible: encryptedButton.hovered || signedButton.hovered
107 anchors.topMargin: Kube.Units.smallSpacing
108 anchors.top: buttons.bottom
109 anchors.bottom: partLoader.bottom
110 anchors.right: parent.left
111 anchors.rightMargin: Kube.Units.smallSpacing
112 width: Kube.Units.smallSpacing
113 color: getColor(model.securityLevel)
114 opacity: 0.5
115 }
112 116
113 Loader { 117 Loader {
114 id: partLoader 118 id: partLoader
115 anchors { 119 anchors {
116 top: parent.top 120 top: parent.top
117 } 121 left: parent.left
118 height: item? item.contentHeight : 0 122 right: parent.right
119 width: parent.width
120 } 123 }
124 height: item ? item.contentHeight : 0
125 width: parent.width
121 } 126 }
122 Component.onCompleted: { 127 Component.onCompleted: {
123 switch (model.type) { 128 switch (model.type) {