summaryrefslogtreecommitdiffstats
path: root/components/mailviewer/qml/MailPart.qml
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-10-19 14:28:08 +0200
committerSandro Knauß <sknauss@kde.org>2016-10-19 14:28:08 +0200
commit6833c46a9522be3c55cefe79676293a0a571cbf5 (patch)
tree6a91b7e00cff34aec70341c24921fd9a1dd095ea /components/mailviewer/qml/MailPart.qml
parentbe38c2ebaa77b116028cbe34f777e3d8e5cbc776 (diff)
downloadkube-6833c46a9522be3c55cefe79676293a0a571cbf5.tar.gz
kube-6833c46a9522be3c55cefe79676293a0a571cbf5.zip
use treemodel in qml
Diffstat (limited to 'components/mailviewer/qml/MailPart.qml')
-rw-r--r--components/mailviewer/qml/MailPart.qml76
1 files changed, 18 insertions, 58 deletions
diff --git a/components/mailviewer/qml/MailPart.qml b/components/mailviewer/qml/MailPart.qml
index d47b4c5f..ad51a7ba 100644
--- a/components/mailviewer/qml/MailPart.qml
+++ b/components/mailviewer/qml/MailPart.qml
@@ -20,67 +20,27 @@ import QtQuick 2.4
20 20
21Item { 21Item {
22 id: root 22 id: root
23 property alias rootIndex: visualModel.rootIndex
24 property bool debug: true
25 height: partListView.height + 10
26 width: parent.width
27
28 MailDataModel {
29 id: visualModel
30 debug: root.debug
31 model: messageParser.newTree
32 }
23 33
24 height: partColumn.height + 20 34 ListView {
25 width: delegateRoot.width 35 id: partListView
26 36 model: visualModel
27 Column {
28 id: partColumn
29 anchors { 37 anchors {
30 top: parent.top 38 top: parent.top
31 left: parent.left 39 left: parent.left
32 right: parent.right 40 margins: 5
33 margins: 10
34 } 41 }
35
36 spacing: 5 42 spacing: 5
37 43 height: contentHeight
38 Repeater { 44 width: parent.width - 10
39 model: contents
40 delegate: Column {
41 id: delegateRoot
42
43 width: partColumn.width
44
45 Loader {
46 id: loader
47 }
48
49 Component.onCompleted: {
50 switch (model.type) {
51 case "AlternativePart":
52 case "SinglePart":
53 loader.source = "MailPart.qml";
54 break;
55
56 case "PlainTextContent":
57 case "Content":
58 loader.source = "TextPart.qml";
59 break;
60 case "HtmlContent":
61 loader.source = "HtmlPart.qml";
62 break;
63
64 case "alternativeframe":
65 loader.source = "Frame.qml"
66 break;
67 case "encrypted":
68 loader.source = "EncryptedPart.qml";
69 break;
70 case "embeded":
71 loader.source = "EmbededPart.qml";
72 break;
73 }
74 }
75 }
76 }
77
78
79 Item {
80 id: footer
81
82 height: 5
83 width: 10
84 }
85 } 45 }
86} 46}