summaryrefslogtreecommitdiffstats
path: root/components/mailviewer/contents
diff options
context:
space:
mode:
Diffstat (limited to 'components/mailviewer/contents')
-rw-r--r--components/mailviewer/contents/ui/EncryptionPart.qml77
-rw-r--r--components/mailviewer/contents/ui/ErrorPart.qml (renamed from components/mailviewer/contents/ui/SignaturePart.qml)38
-rw-r--r--components/mailviewer/contents/ui/MailDataModel.qml45
3 files changed, 11 insertions, 149 deletions
diff --git a/components/mailviewer/contents/ui/EncryptionPart.qml b/components/mailviewer/contents/ui/EncryptionPart.qml
deleted file mode 100644
index e72c30f9..00000000
--- a/components/mailviewer/contents/ui/EncryptionPart.qml
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/
18
19import QtQuick 2.4
20
21Item {
22 id: encryption
23 property alias rootIndex: visualModel.rootIndex
24 property alias model: visualModel.model
25 property alias debug: visualModel.debug
26 property variant securityLevel
27 property variant errorType
28 property string errorString
29 height: partListView.height
30 width: parent.width
31
32 MailDataModel {
33 id: visualModel
34 }
35
36 Column {
37 id: partListView
38 anchors {
39 top: parent.top
40 left: parent.left
41 }
42 width: parent.width
43 spacing: 5
44 Text {
45 width: parent.width
46 visible: encryption.debug
47 text: model.type
48 }
49 Text {
50 visible: errorType || encryption.debug
51 text: errorType + ": " + errorString
52 }
53 BorderImage {
54 width: parent.width
55 height: childrenRect.height + 40
56 border { left: 5; top: 5; right: 6; bottom: 6 }
57 horizontalTileMode: BorderImage.Round
58 verticalTileMode: BorderImage.Round
59
60 source: /* "securityborders"+ */ securityLevel +".png"
61 ListView {
62 model: visualModel
63 anchors {
64 top: parent.top
65 left: parent.left
66 margins: 20
67 }
68 height: contentHeight
69 width: parent.width - 40
70
71 spacing: 20
72
73 interactive: false
74 }
75 }
76 }
77}
diff --git a/components/mailviewer/contents/ui/SignaturePart.qml b/components/mailviewer/contents/ui/ErrorPart.qml
index 5e88f963..734d5c5f 100644
--- a/components/mailviewer/contents/ui/SignaturePart.qml
+++ b/components/mailviewer/contents/ui/ErrorPart.qml
@@ -1,5 +1,6 @@
1/* 1/*
2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> 2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
3 4
4 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -19,18 +20,12 @@
19import QtQuick 2.4 20import QtQuick 2.4
20 21
21Item { 22Item {
22 id: signature 23 id: root
23 property alias rootIndex: visualModel.rootIndex 24 property variant errorType
24 property alias model: visualModel.model 25 property string errorString
25 property alias debug: visualModel.debug
26 property variant securityLevel
27 property string type
28 height: partListView.height 26 height: partListView.height
29 width: parent.width 27 width: parent.width
30 28
31 MailDataModel {
32 id: visualModel
33 }
34 Column { 29 Column {
35 id: partListView 30 id: partListView
36 anchors { 31 anchors {
@@ -40,30 +35,7 @@ Item {
40 width: parent.width 35 width: parent.width
41 spacing: 5 36 spacing: 5
42 Text { 37 Text {
43 width: parent.width 38 text: "An error occured: " + errorString
44 visible: signature.debug
45 text: type
46 }
47 BorderImage {
48 width: parent.width
49 height: childrenRect.height + 40
50 border { left: 5; top: 5; right: 6; bottom: 6 }
51 horizontalTileMode: BorderImage.Round
52 verticalTileMode: BorderImage.Round
53 source: /* "securityborders"+ */ securityLevel +".png"
54 ListView {
55 model: visualModel
56 anchors {
57 top: parent.top
58 left: parent.left
59 margins: 20
60 }
61 height: contentHeight
62 width: parent.width - 40
63
64 spacing: 20
65 interactive: false
66 }
67 } 39 }
68 } 40 }
69} 41}
diff --git a/components/mailviewer/contents/ui/MailDataModel.qml b/components/mailviewer/contents/ui/MailDataModel.qml
index 6a4beda5..99bd0dc2 100644
--- a/components/mailviewer/contents/ui/MailDataModel.qml
+++ b/components/mailviewer/contents/ui/MailDataModel.qml
@@ -22,26 +22,6 @@ import QtQml.Models 2.2
22DelegateModel { 22DelegateModel {
23 id: mailDataModel 23 id: mailDataModel
24 property bool debug: true 24 property bool debug: true
25 function getPartType(type, hasModelChildren, forcePlain) {
26 switch (type) {
27 case "PlainTextContent":
28 case "Content":
29 return "plain";
30 case "HtmlContent":
31 if (forcePlain) {
32 return "plain";
33 }
34 return "html";
35 case "Signature":
36 return "signature";
37 case "Encryption":
38 return "encryption";
39 }
40 if (hasModelChildren) {
41 return "envelope";
42 }
43 return "";
44 }
45 25
46 delegate: Item { 26 delegate: Item {
47 id: partColumn 27 id: partColumn
@@ -57,40 +37,27 @@ DelegateModel {
57 width: parent.width 37 width: parent.width
58 } 38 }
59 Component.onCompleted: { 39 Component.onCompleted: {
60 //If the content is not complex, avoid using a full browser 40 switch (model.type) {
61 var forcePlain = !model.complexHtmlContent
62 var partType = getPartType(model.type, model.hasModelChildren, forcePlain);
63
64 switch (partType) {
65 case "plain": 41 case "plain":
66 partLoader.setSource("TextContent.qml", 42 partLoader.setSource("TextContent.qml",
67 {"content": model.content, 43 {"content": model.content,
68 "embedded": model.embeded, 44 "embedded": model.embeded,
45 "securityLevel": model.securityLevel,
69 "type": model.type, 46 "type": model.type,
70 "debug": debug}) 47 "debug": debug})
71 break 48 break
72 case "html": 49 case "html":
73 partLoader.setSource("HtmlContent.qml", 50 partLoader.setSource("HtmlContent.qml",
74 {"content": model.content, 51 {"content": model.content,
75 "debug": debug})
76 break;
77 case "signature":
78 partLoader.setSource("SignaturePart.qml",
79 {"rootIndex": mailDataModel.modelIndex(index),
80 "securityLevel": model.securityLevel, 52 "securityLevel": model.securityLevel,
81 "model": mailDataModel.model,
82 "type": model.type,
83 "debug": debug}) 53 "debug": debug})
84 break; 54 break;
85 case "encryption": 55 case "error":
86 partLoader.setSource("EncryptionPart.qml", 56 partLoader.setSource("ErrorPart.qml",
87 {"rootIndex": mailDataModel.modelIndex(index), 57 {
88 "securityLevel": model.securityLevel,
89 "type": model.type,
90 "model": mailDataModel.model,
91 "errorType": model.errorType, 58 "errorType": model.errorType,
92 "errorString": model.errorString, 59 "errorString": model.errorString,
93 "debug": debug}) 60 })
94 break; 61 break;
95 case "envelope": 62 case "envelope":
96 partLoader.setSource("MailPart.qml", 63 partLoader.setSource("MailPart.qml",