summaryrefslogtreecommitdiffstats
path: root/components/mailviewer
diff options
context:
space:
mode:
Diffstat (limited to 'components/mailviewer')
-rw-r--r--components/mailviewer/qml/DummyApp.qml55
-rw-r--r--components/mailviewer/qml/EncryptionPart.qml68
-rw-r--r--components/mailviewer/qml/HtmlContent.qml (renamed from components/mailviewer/qml/HtmlPart.qml)2
-rw-r--r--components/mailviewer/qml/MailDataModel.qml65
-rw-r--r--components/mailviewer/qml/MailModel.qml50
-rw-r--r--components/mailviewer/qml/MailModel2.qml28
-rw-r--r--components/mailviewer/qml/MailPart.qml76
-rw-r--r--components/mailviewer/qml/MailViewer.qml52
-rw-r--r--components/mailviewer/qml/SignaturePart.qml66
-rw-r--r--components/mailviewer/qml/SignedPart.qml44
-rw-r--r--components/mailviewer/qml/TextContent.qml (renamed from components/mailviewer/qml/EncryptedPart.qml)46
-rw-r--r--components/mailviewer/qml/TextPart.qml28
12 files changed, 262 insertions, 318 deletions
diff --git a/components/mailviewer/qml/DummyApp.qml b/components/mailviewer/qml/DummyApp.qml
deleted file mode 100644
index acb91ac1..00000000
--- a/components/mailviewer/qml/DummyApp.qml
+++ /dev/null
@@ -1,55 +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 {
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/EncryptionPart.qml b/components/mailviewer/qml/EncryptionPart.qml
new file mode 100644
index 00000000..a1adea43
--- /dev/null
+++ b/components/mailviewer/qml/EncryptionPart.qml
@@ -0,0 +1,68 @@
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 bool debug: true
25 height: partListView.height
26 width: parent.width
27
28 MailDataModel {
29 id: visualModel
30 debug: encryption.debug
31 model: messageParser.newTree
32 }
33
34 Column {
35 id: partListView
36 anchors {
37 top: parent.top
38 left: parent.left
39 }
40 width: parent.width
41 spacing: 5
42 Text {
43 width: parent.width
44 visible: encryption.debug
45 text: model.type
46 }
47 BorderImage {
48 width: parent.width
49 height: childrenRect.height + 40
50 border { left: 10; top: 10; right: 10; bottom: 10 }
51 horizontalTileMode: BorderImage.Round
52 verticalTileMode: BorderImage.Round
53
54 source: "securityborders"+ model.securityLevel +".png"
55 ListView {
56 model: visualModel
57 anchors {
58 top: parent.top
59 left: parent.left
60 margins: 20
61 }
62 spacing: 20
63 height: contentHeight
64 width: parent.width - 40
65 }
66 }
67 }
68}
diff --git a/components/mailviewer/qml/HtmlPart.qml b/components/mailviewer/qml/HtmlContent.qml
index f812ecb4..15bd1915 100644
--- a/components/mailviewer/qml/HtmlPart.qml
+++ b/components/mailviewer/qml/HtmlContent.qml
@@ -29,7 +29,7 @@ Item {
29 //FIXME workaround until QtWebEngine 1.3 with contentsSize 29 //FIXME workaround until QtWebEngine 1.3 with contentsSize
30 30
31 height: contentHeight 31 height: contentHeight
32 width: delegateRoot.width 32 width: partColumn.width
33 33
34 WebView { 34 WebView {
35 id: helperView 35 id: helperView
diff --git a/components/mailviewer/qml/MailDataModel.qml b/components/mailviewer/qml/MailDataModel.qml
new file mode 100644
index 00000000..408d02e8
--- /dev/null
+++ b/components/mailviewer/qml/MailDataModel.qml
@@ -0,0 +1,65 @@
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
21VisualDataModel {
22 id: mailDataModel
23 property bool debug: true
24 delegate: Rectangle {
25 id: partColumn
26 width: parent.width
27 height: childrenRect.height
28 Loader {
29 id: partLoader
30 anchors {
31 top: parent.top
32 left: parent.left
33 }
34 height: item? item.contentHeight : 0
35 width: parent.width
36 }
37 Component.onCompleted: {
38 switch (model.type) {
39 case "PlainTextContent":
40 case "Content":
41 partLoader.source = "TextContent.qml"
42 partLoader.item.debug = mailDataModel.debug
43 return;
44 case "HtmlContent":
45 partLoader.source = "HtmlContent.qml"
46 return;
47 case "Signature":
48 partLoader.source = "SignaturePart.qml"
49 partLoader.item.rootIndex = mailDataModel.modelIndex(index)
50 partLoader.item.debug = mailDataModel.debug
51 return;
52 case "Encryption":
53 partLoader.source = "EncryptionPart.qml"
54 partLoader.item.rootIndex = mailDataModel.modelIndex(index)
55 partLoader.item.debug = mailDataModel.debug
56 return;
57 }
58 if (model.hasModelChildren) {
59 partLoader.source = "MailPart.qml"
60 partLoader.item.rootIndex = mailDataModel.modelIndex(index)
61 partLoader.item.debug = mailDataModel.debug
62 }
63 }
64 }
65}
diff --git a/components/mailviewer/qml/MailModel.qml b/components/mailviewer/qml/MailModel.qml
deleted file mode 100644
index d18f5ece..00000000
--- a/components/mailviewer/qml/MailModel.qml
+++ /dev/null
@@ -1,50 +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
21ListModel {
22
23 ListElement {
24 type: "encrypted"
25 securityLevel: "GREEN"
26 content: [
27 ListElement {
28 type: "plaintext"
29 textContent: "Moin, \n find the forwarded mail below. \n \n - M"
30 embeded: false
31 },
32 ListElement {
33 type: "embeded"
34 sender: "Senderson"
35 date: "05/05/2055"
36 content: [
37 ListElement{
38 type: "plaintext"
39 textContent: "sender mc senderson is a sender. sender mc senderson is a sender. sender mc senderson is a mc senderson is a sender sender mc senderson is a sender sender mc senderson is a sender sender mc senderson is a sender sender mc senderson is a sender sender mc a sender sender mc is a sender sender mc senderson is a sendersender mc senderson is a sender"
40 embeded: true
41 }]
42 }
43 ]
44 }
45 ListElement {
46 type: "plaintext"
47 textContent: "footer mc footerson"
48 embeded: false
49 }
50}
diff --git a/components/mailviewer/qml/MailModel2.qml b/components/mailviewer/qml/MailModel2.qml
deleted file mode 100644
index 9ea45d57..00000000
--- a/components/mailviewer/qml/MailModel2.qml
+++ /dev/null
@@ -1,28 +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
21ListModel {
22
23 ListElement {
24 type: "html"
25 htmlContent: "<!DOCTYPE html> <html> <body> <h1>Some Heading</h1> <p>My some paragraph.</p> </body> </html>"
26 }
27}
28
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}
diff --git a/components/mailviewer/qml/MailViewer.qml b/components/mailviewer/qml/MailViewer.qml
index f5714e25..86a96913 100644
--- a/components/mailviewer/qml/MailViewer.qml
+++ b/components/mailviewer/qml/MailViewer.qml
@@ -19,42 +19,28 @@
19import QtQuick 2.4 19import QtQuick 2.4
20 20
21Item { 21Item {
22 id: mailviewer 22 id: root
23 height: mainColumn.height + 50 23 property alias rootIndex: visualModel.rootIndex
24 property bool debug: true
25 height: partListView.height + 50
24 width: parent.width * 0.9 26 width: parent.width * 0.9
25 27
26 Column { 28 MailDataModel {
27 id: mainColumn 29 id: visualModel
28 anchors { 30 debug: root.debug
29 top: parent.top 31 model: messageParser.newTree
30 left: parent.left 32 }
31 right: parent.right
32 margins: 20
33 }
34 spacing: 10
35 width: parent.width - 50
36
37 Repeater {
38 model: messageParser.newTree
39
40 delegate: Column {
41 id: delegateRoot
42
43 width: mainColumn.width
44
45 Loader {
46 id: loader
47 }
48 33
49 Component.onCompleted: { 34 ListView {
50 switch (model.type) { 35 id: partListView
51 case "AlternativePart": 36 model: visualModel
52 case "SinglePart": 37 anchors {
53 loader.source = "MailPart.qml"; 38 top: parent.top
54 break; 39 left: parent.left
55 } 40 margins: 5
56 }
57 }
58 } 41 }
42 spacing: 5
43 height: contentHeight
44 width: parent.width - 10
59 } 45 }
60} 46}
diff --git a/components/mailviewer/qml/SignaturePart.qml b/components/mailviewer/qml/SignaturePart.qml
new file mode 100644
index 00000000..8a0e33ce
--- /dev/null
+++ b/components/mailviewer/qml/SignaturePart.qml
@@ -0,0 +1,66 @@
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: signature
23 property alias rootIndex: visualModel.rootIndex
24 property bool debug: true
25 height: partListView.height
26 width: parent.width
27
28 MailDataModel {
29 id: visualModel
30 debug: signature.debug
31 model: messageParser.newTree
32 }
33 Column {
34 id: partListView
35 anchors {
36 top: parent.top
37 left: parent.left
38 }
39 width: parent.width
40 spacing: 5
41 Text {
42 width: parent.width
43 visible: signature.debug
44 text: model.type
45 }
46 BorderImage {
47 width: parent.width
48 height: childrenRect.height + 40
49 border { left: 10; top: 10; right: 10; bottom: 10 }
50 horizontalTileMode: BorderImage.Round
51 verticalTileMode: BorderImage.Round
52 source: "securityborders"+ model.securityLevel +".png"
53 ListView {
54 model: visualModel
55 anchors {
56 top: parent.top
57 left: parent.left
58 margins: 20
59 }
60 spacing: 20
61 height: contentHeight
62 width: parent.width - 40
63 }
64 }
65 }
66}
diff --git a/components/mailviewer/qml/SignedPart.qml b/components/mailviewer/qml/SignedPart.qml
deleted file mode 100644
index f0daedeb..00000000
--- a/components/mailviewer/qml/SignedPart.qml
+++ /dev/null
@@ -1,44 +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
20import QtQuick.Controls 1.5
21
22Item {
23
24 height: mailPart.height + 20
25 width: mailPart.width + 20
26
27 BorderImage {
28
29 anchors.fill: parent
30 border { left: 40; top: 40; right: 40; bottom: 40 }
31 horizontalTileMode: BorderImage.Round
32 verticalTileMode: BorderImage.Round
33
34 source: "securityborders" + model.securityLevel + ".png"
35 }
36
37 MailPart {
38 id: mailPart
39
40 anchors.centerIn: parent
41
42 }
43}
44
diff --git a/components/mailviewer/qml/EncryptedPart.qml b/components/mailviewer/qml/TextContent.qml
index 18a5d588..2e0167d4 100644
--- a/components/mailviewer/qml/EncryptedPart.qml
+++ b/components/mailviewer/qml/TextContent.qml
@@ -17,27 +17,31 @@
17*/ 17*/
18 18
19import QtQuick 2.4 19import QtQuick 2.4
20import QtQuick.Controls 1.5
21
22Item { 20Item {
23 21 id: textItem
24 height: mailPart.height + 20 22 property bool debug: true
25 width: mailPart.width + 20 23 width: partColumn.width
26 24 height: textColumn.height
27 BorderImage { 25 Column {
28 26 id: textColumn
29 anchors.fill: parent 27 anchors {
30 border { left: 40; top: 40; right: 40; bottom: 40 } 28 top: parent.top
31 horizontalTileMode: BorderImage.Round 29 left: parent.left
32 verticalTileMode: BorderImage.Round 30 }
33 31 width: parent.width
34 source: "securityborders" + model.securityLevel + ".png" 32 spacing: 5
35 } 33 Text {
36 34 width: parent.width
37 MailPart { 35 visible: textItem.debug
38 id: mailPart 36 text: model.type
39 37 }
40 anchors.centerIn: parent 38 Text {
41 39 width: parent.width
40
41 text: model.content
42 wrapMode: Text.WordWrap
43
44 color: model.embeded ? "grey" : "black"
45 }
42 } 46 }
43} 47}
diff --git a/components/mailviewer/qml/TextPart.qml b/components/mailviewer/qml/TextPart.qml
deleted file mode 100644
index 0267682f..00000000
--- a/components/mailviewer/qml/TextPart.qml
+++ /dev/null
@@ -1,28 +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
21Text {
22 width: delegateRoot.width
23
24 text: model.content
25 wrapMode: Text.WordWrap
26
27 color: model.securityLevel //embeded ? "grey" : "black"
28}