summaryrefslogtreecommitdiffstats
path: root/components/mailviewer
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-10-11 16:18:50 +0200
committerSandro Knauß <sknauss@kde.org>2016-10-11 16:18:50 +0200
commit1974c19eadd497e355ac985a00d0571f3e6c7712 (patch)
tree051b61cfe222150dc114e5da04fdd072ceffb3b7 /components/mailviewer
parent6b6f20ffbe06402abcc7d4721ad1f647c3fc4c46 (diff)
downloadkube-1974c19eadd497e355ac985a00d0571f3e6c7712.tar.gz
kube-1974c19eadd497e355ac985a00d0571f3e6c7712.zip
create model for new mailviewer
Diffstat (limited to 'components/mailviewer')
-rw-r--r--components/mailviewer/qml/DummyApp.qml55
-rw-r--r--components/mailviewer/qml/HtmlPart.qml2
-rw-r--r--components/mailviewer/qml/MailPart.qml36
-rw-r--r--components/mailviewer/qml/TextPart.qml4
-rw-r--r--components/mailviewer/qml/dummyapp.qml90
5 files changed, 78 insertions, 109 deletions
diff --git a/components/mailviewer/qml/DummyApp.qml b/components/mailviewer/qml/DummyApp.qml
new file mode 100644
index 00000000..acb91ac1
--- /dev/null
+++ b/components/mailviewer/qml/DummyApp.qml
@@ -0,0 +1,55 @@
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 {
22Column {
23 anchors {
24 top: parent.top
25 left: parent.left
26 right: parent.right
27 margins: 20
28 }
29
30 spacing: 10
31 width: parent.width
32 Repeater {
33 model: messageParser.newTree
34
35 delegate: Column {
36 id: delegateRoot
37
38 width: parent.width
39
40 Loader {
41 id: loader
42 }
43
44 Component.onCompleted: {
45 switch (model.type) {
46 case "AlternativePart":
47 case "SinglePart":
48 loader.source = "MailPart.qml";
49 break;
50 }
51 }
52 }
53 }
54}
55}
diff --git a/components/mailviewer/qml/HtmlPart.qml b/components/mailviewer/qml/HtmlPart.qml
index f1add75c..f812ecb4 100644
--- a/components/mailviewer/qml/HtmlPart.qml
+++ b/components/mailviewer/qml/HtmlPart.qml
@@ -24,7 +24,7 @@ import QtWebEngine 1.2
24 24
25Item { 25Item {
26 id: root 26 id: root
27 property string content: model.htmlContent 27 property string content: model.content
28 property int contentHeight: helperView.contentHeight; 28 property int contentHeight: helperView.contentHeight;
29 //FIXME workaround until QtWebEngine 1.3 with contentsSize 29 //FIXME workaround until QtWebEngine 1.3 with contentsSize
30 30
diff --git a/components/mailviewer/qml/MailPart.qml b/components/mailviewer/qml/MailPart.qml
index 966337cd..d47b4c5f 100644
--- a/components/mailviewer/qml/MailPart.qml
+++ b/components/mailviewer/qml/MailPart.qml
@@ -21,24 +21,22 @@ import QtQuick 2.4
21Item { 21Item {
22 id: root 22 id: root
23 23
24 height: partColumn.height + 40 24 height: partColumn.height + 20
25 width: delegateRoot.width 25 width: delegateRoot.width
26 26
27 Column { 27 Column {
28 id: partColumn 28 id: partColumn
29
30 anchors { 29 anchors {
31 top: parent.top 30 top: parent.top
32 left: parent.left 31 left: parent.left
33 right: parent.right 32 right: parent.right
34 margins: 20 33 margins: 10
35 } 34 }
36 35
37 spacing: 10 36 spacing: 5
38 37
39 Repeater { 38 Repeater {
40 model: content 39 model: contents
41
42 delegate: Column { 40 delegate: Column {
43 id: delegateRoot 41 id: delegateRoot
44 42
@@ -49,23 +47,29 @@ Item {
49 } 47 }
50 48
51 Component.onCompleted: { 49 Component.onCompleted: {
52
53 switch (model.type) { 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;
54 case "encrypted": 67 case "encrypted":
55 loader.source = "EncryptedPart.qml"; 68 loader.source = "EncryptedPart.qml";
56 break; 69 break;
57 case "embeded": 70 case "embeded":
58 loader.source = "EmbededPart.qml"; 71 loader.source = "EmbededPart.qml";
59 break; 72 break;
60 case "frame":
61 loader.source = "Frame.qml"
62 break;
63 case "plaintext":
64 loader.source = "TextPart.qml";
65 break;
66 case "html":
67 loader.source = "HtmlPart.qml";
68 break;
69 } 73 }
70 } 74 }
71 } 75 }
diff --git a/components/mailviewer/qml/TextPart.qml b/components/mailviewer/qml/TextPart.qml
index 5f183852..0267682f 100644
--- a/components/mailviewer/qml/TextPart.qml
+++ b/components/mailviewer/qml/TextPart.qml
@@ -21,8 +21,8 @@ import QtQuick 2.4
21Text { 21Text {
22 width: delegateRoot.width 22 width: delegateRoot.width
23 23
24 text: model.textContent 24 text: model.content
25 wrapMode: Text.WordWrap 25 wrapMode: Text.WordWrap
26 26
27 color: embeded ? "grey" : "black" 27 color: model.securityLevel //embeded ? "grey" : "black"
28} 28}
diff --git a/components/mailviewer/qml/dummyapp.qml b/components/mailviewer/qml/dummyapp.qml
deleted file mode 100644
index a186f0f1..00000000
--- a/components/mailviewer/qml/dummyapp.qml
+++ /dev/null
@@ -1,90 +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
21Rectangle {
22 id: app
23
24 width: 1200
25 height: 700
26
27 Rectangle {
28 anchors.fill: parent
29
30 color: "black"
31
32 opacity: 0.8
33
34 }
35
36 Rectangle {
37
38 anchors.centerIn: parent
39
40 height: mainColumn.height + 50
41 width: parent.width * 0.9
42
43 Column {
44 id: mainColumn
45
46 anchors.centerIn: parent
47
48 width: parent.width - 50
49
50 spacing: 10
51
52 Repeater {
53 model: MailModel {}
54
55 delegate: Column {
56 id: delegateRoot
57
58 width: mainColumn.width
59
60 Loader {
61 id: loader
62 }
63
64 Component.onCompleted: {
65 switch (model.type) {
66 case "red":
67 loader.source = "Rect2.qml";
68 break;
69 case "green":
70 loader.source = "Rect1.qml";
71 break;
72 case "encrypted":
73 loader.source = "EncryptedPart.qml";
74 break;
75 case "frame":
76 loader.source = "Frame.qml";
77 break;
78 case "plaintext":
79 loader.source = "TextPart.qml";
80 break;
81 case "html":
82 loader.source = "HtmlPart.qml";
83 break;
84 }
85 }
86 }
87 }
88 }
89 }
90}