summaryrefslogtreecommitdiffstats
path: root/components/mailviewer/qml
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-10-24 13:02:40 +0200
committerSandro Knauß <sknauss@kde.org>2016-10-24 13:02:40 +0200
commit6aa695939b63fc7370e5eb80ecf7528aea1bd5e1 (patch)
tree91e7951411f541d7b71d64f15a2a38c6bbd7c577 /components/mailviewer/qml
parent9be2b6515cf538673babda8764219b9af9691f6f (diff)
parenta93a649f34ffa794884019e05c57869bd3bd4672 (diff)
downloadkube-6aa695939b63fc7370e5eb80ecf7528aea1bd5e1.tar.gz
kube-6aa695939b63fc7370e5eb80ecf7528aea1bd5e1.zip
Merge branch 'dev/mimetreeinterface' into develop
Diffstat (limited to 'components/mailviewer/qml')
-rw-r--r--components/mailviewer/qml/EncryptionPart.qml68
-rw-r--r--components/mailviewer/qml/HtmlContent.qml (renamed from components/mailviewer/qml/HtmlPart.qml)4
-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.qml74
-rw-r--r--components/mailviewer/qml/MailViewer.qml (renamed from components/mailviewer/qml/EncryptedPart.qml)39
-rw-r--r--components/mailviewer/qml/SignaturePart.qml66
-rw-r--r--components/mailviewer/qml/TextContent.qml (renamed from components/mailviewer/qml/SignedPart.qml)47
-rw-r--r--components/mailviewer/qml/TextPart.qml28
-rw-r--r--components/mailviewer/qml/dummyapp.qml90
-rw-r--r--components/mailviewer/qml/qmldir3
12 files changed, 269 insertions, 293 deletions
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 f1add75c..15bd1915 100644
--- a/components/mailviewer/qml/HtmlPart.qml
+++ b/components/mailviewer/qml/HtmlContent.qml
@@ -24,12 +24,12 @@ 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
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 966337cd..ad51a7ba 100644
--- a/components/mailviewer/qml/MailPart.qml
+++ b/components/mailviewer/qml/MailPart.qml
@@ -20,63 +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 + 40 34 ListView {
25 width: delegateRoot.width 35 id: partListView
26 36 model: visualModel
27 Column {
28 id: partColumn
29
30 anchors { 37 anchors {
31 top: parent.top 38 top: parent.top
32 left: parent.left 39 left: parent.left
33 right: parent.right 40 margins: 5
34 margins: 20
35 }
36
37 spacing: 10
38
39 Repeater {
40 model: content
41
42 delegate: Column {
43 id: delegateRoot
44
45 width: partColumn.width
46
47 Loader {
48 id: loader
49 }
50
51 Component.onCompleted: {
52
53 switch (model.type) {
54 case "encrypted":
55 loader.source = "EncryptedPart.qml";
56 break;
57 case "embeded":
58 loader.source = "EmbededPart.qml";
59 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 }
70 }
71 }
72 }
73
74
75 Item {
76 id: footer
77
78 height: 5
79 width: 10
80 } 41 }
42 spacing: 5
43 height: contentHeight
44 width: parent.width - 10
81 } 45 }
82} 46}
diff --git a/components/mailviewer/qml/EncryptedPart.qml b/components/mailviewer/qml/MailViewer.qml
index 18a5d588..86a96913 100644
--- a/components/mailviewer/qml/EncryptedPart.qml
+++ b/components/mailviewer/qml/MailViewer.qml
@@ -17,27 +17,30 @@
17*/ 17*/
18 18
19import QtQuick 2.4 19import QtQuick 2.4
20import QtQuick.Controls 1.5
21 20
22Item { 21Item {
23 22 id: root
24 height: mailPart.height + 20 23 property alias rootIndex: visualModel.rootIndex
25 width: mailPart.width + 20 24 property bool debug: true
26 25 height: partListView.height + 50
27 BorderImage { 26 width: parent.width * 0.9
28 27
29 anchors.fill: parent 28 MailDataModel {
30 border { left: 40; top: 40; right: 40; bottom: 40 } 29 id: visualModel
31 horizontalTileMode: BorderImage.Round 30 debug: root.debug
32 verticalTileMode: BorderImage.Round 31 model: messageParser.newTree
33
34 source: "securityborders" + model.securityLevel + ".png"
35 } 32 }
36 33
37 MailPart { 34 ListView {
38 id: mailPart 35 id: partListView
39 36 model: visualModel
40 anchors.centerIn: parent 37 anchors {
41 38 top: parent.top
39 left: parent.left
40 margins: 5
41 }
42 spacing: 5
43 height: contentHeight
44 width: parent.width - 10
42 } 45 }
43} 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/TextContent.qml
index f0daedeb..2e0167d4 100644
--- a/components/mailviewer/qml/SignedPart.qml
+++ b/components/mailviewer/qml/TextContent.qml
@@ -17,28 +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}
44
diff --git a/components/mailviewer/qml/TextPart.qml b/components/mailviewer/qml/TextPart.qml
deleted file mode 100644
index 5f183852..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.textContent
25 wrapMode: Text.WordWrap
26
27 color: embeded ? "grey" : "black"
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}
diff --git a/components/mailviewer/qml/qmldir b/components/mailviewer/qml/qmldir
new file mode 100644
index 00000000..0d87b779
--- /dev/null
+++ b/components/mailviewer/qml/qmldir
@@ -0,0 +1,3 @@
1module org.kube.mailviewer
2
3MailViewer 1.0 MailViewer.qml