summaryrefslogtreecommitdiffstats
path: root/components/mailviewer/contents/ui
diff options
context:
space:
mode:
Diffstat (limited to 'components/mailviewer/contents/ui')
-rw-r--r--components/mailviewer/contents/ui/EmbededPart.qml54
-rw-r--r--components/mailviewer/contents/ui/EncryptionPart.qml75
-rw-r--r--components/mailviewer/contents/ui/GREEN.pngbin0 -> 153 bytes
-rw-r--r--components/mailviewer/contents/ui/GREY.pngbin0 -> 153 bytes
-rw-r--r--components/mailviewer/contents/ui/HtmlContent.qml70
-rw-r--r--components/mailviewer/contents/ui/MailDataModel.qml66
-rw-r--r--components/mailviewer/contents/ui/MailPart.qml47
-rw-r--r--components/mailviewer/contents/ui/MailViewer.qml46
-rw-r--r--components/mailviewer/contents/ui/PURPLE.pngbin0 -> 153 bytes
-rw-r--r--components/mailviewer/contents/ui/RED.pngbin0 -> 153 bytes
-rw-r--r--components/mailviewer/contents/ui/SignaturePart.qml68
-rw-r--r--components/mailviewer/contents/ui/TextContent.qml61
-rw-r--r--components/mailviewer/contents/ui/YELLOW.pngbin0 -> 153 bytes
-rw-r--r--components/mailviewer/contents/ui/main.qml30
14 files changed, 517 insertions, 0 deletions
diff --git a/components/mailviewer/contents/ui/EmbededPart.qml b/components/mailviewer/contents/ui/EmbededPart.qml
new file mode 100644
index 00000000..8921ab6f
--- /dev/null
+++ b/components/mailviewer/contents/ui/EmbededPart.qml
@@ -0,0 +1,54 @@
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
23 height: mailPart.height
24 width: mailPart.width
25
26
27 Rectangle {
28 id: border
29 color: "lightgrey"
30 height: mailPart.height
31 width: 5
32 }
33
34 Text {
35 id: sender
36
37 anchors {
38 left: border.right
39 leftMargin: 15
40 }
41
42 text: "sent by " + model.sender + " on " + model.date
43 color: "grey"
44 }
45
46 MailPart {
47 id: mailPart
48
49 anchors.top: sender.bottom
50
51 }
52
53}
54
diff --git a/components/mailviewer/contents/ui/EncryptionPart.qml b/components/mailviewer/contents/ui/EncryptionPart.qml
new file mode 100644
index 00000000..058c9af7
--- /dev/null
+++ b/components/mailviewer/contents/ui/EncryptionPart.qml
@@ -0,0 +1,75 @@
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 Text {
48 visible: model.errorType || encryption.debug
49 text: model.errorType + ": " + model.errorString
50 }
51 BorderImage {
52 width: parent.width
53 height: childrenRect.height + 40
54 border { left: 5; top: 5; right: 6; bottom: 6 }
55 horizontalTileMode: BorderImage.Round
56 verticalTileMode: BorderImage.Round
57
58 source: /* "securityborders"+ */ model.securityLevel +".png"
59 ListView {
60 model: visualModel
61 anchors {
62 top: parent.top
63 left: parent.left
64 margins: 20
65 }
66 height: contentHeight
67 width: parent.width - 40
68
69 spacing: 20
70
71 interactive: false
72 }
73 }
74 }
75}
diff --git a/components/mailviewer/contents/ui/GREEN.png b/components/mailviewer/contents/ui/GREEN.png
new file mode 100644
index 00000000..60f8e10d
--- /dev/null
+++ b/components/mailviewer/contents/ui/GREEN.png
Binary files differ
diff --git a/components/mailviewer/contents/ui/GREY.png b/components/mailviewer/contents/ui/GREY.png
new file mode 100644
index 00000000..146e8927
--- /dev/null
+++ b/components/mailviewer/contents/ui/GREY.png
Binary files differ
diff --git a/components/mailviewer/contents/ui/HtmlContent.qml b/components/mailviewer/contents/ui/HtmlContent.qml
new file mode 100644
index 00000000..4fc694f9
--- /dev/null
+++ b/components/mailviewer/contents/ui/HtmlContent.qml
@@ -0,0 +1,70 @@
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.3
21import QtWebEngine 1.3
22
23Item {
24 id: root
25 property string content: model.content
26 //We have to give it a minimum size so the html content starts to expand
27 property int contentHeight: 10;
28
29 height: contentHeight
30 width: partColumn.width
31
32 WebEngineView {
33 id: htmlView
34 anchors.fill: parent
35 Component.onCompleted: loadHtml(content, "file:///")
36 onContentsSizeChanged: {
37 root.contentHeight = contentsSize.height;
38 }
39 onLoadingChanged: {
40 if (loadRequest.status === WebEngineView.LoadFailedStatus) {
41 console.warn("Failed to load html content.");
42 console.warn("Error is ", loadRequest.errorString);
43 }
44 }
45 settings {
46 webGLEnabled: false
47 touchIconsEnabled: false
48 spatialNavigationEnabled: false
49 screenCaptureEnabled: false
50 pluginsEnabled: false
51 localStorageEnabled: false
52 localContentCanAccessRemoteUrls: false
53 localContentCanAccessFileUrls: false
54 linksIncludedInFocusChain: false
55 javascriptEnabled: false
56 javascriptCanOpenWindows: false
57 javascriptCanAccessClipboard: false
58 hyperlinkAuditingEnabled: false
59 fullScreenSupportEnabled: false
60 errorPageEnabled: false
61 //defaultTextEncoding: ???
62 autoLoadImages: false
63 autoLoadIconsForPage: false
64 accelerated2dCanvasEnabled: false
65 }
66 }
67 onContentChanged: {
68 htmlView.loadHtml(content, "file:///");
69 }
70}
diff --git a/components/mailviewer/contents/ui/MailDataModel.qml b/components/mailviewer/contents/ui/MailDataModel.qml
new file mode 100644
index 00000000..e0e65c49
--- /dev/null
+++ b/components/mailviewer/contents/ui/MailDataModel.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
20import QtQml.Models 2.2
21
22DelegateModel {
23 id: mailDataModel
24 property bool debug: true
25 delegate: Item {
26 id: partColumn
27 width: parent.width
28 height: childrenRect.height
29 Loader {
30 id: partLoader
31 anchors {
32 top: parent.top
33 left: parent.left
34 }
35 height: item? item.contentHeight : 0
36 width: parent.width
37 }
38 Component.onCompleted: {
39 switch (model.type) {
40 case "PlainTextContent":
41 case "Content":
42 partLoader.source = "TextContent.qml"
43 partLoader.item.debug = mailDataModel.debug
44 return;
45 case "HtmlContent":
46 partLoader.source = "HtmlContent.qml"
47 return;
48 case "Signature":
49 partLoader.source = "SignaturePart.qml"
50 partLoader.item.rootIndex = mailDataModel.modelIndex(index)
51 partLoader.item.debug = mailDataModel.debug
52 return;
53 case "Encryption":
54 partLoader.source = "EncryptionPart.qml"
55 partLoader.item.rootIndex = mailDataModel.modelIndex(index)
56 partLoader.item.debug = mailDataModel.debug
57 return;
58 }
59 if (model.hasModelChildren) {
60 partLoader.source = "MailPart.qml"
61 partLoader.item.rootIndex = mailDataModel.modelIndex(index)
62 partLoader.item.debug = mailDataModel.debug
63 }
64 }
65 }
66}
diff --git a/components/mailviewer/contents/ui/MailPart.qml b/components/mailviewer/contents/ui/MailPart.qml
new file mode 100644
index 00000000..30bf1ee0
--- /dev/null
+++ b/components/mailviewer/contents/ui/MailPart.qml
@@ -0,0 +1,47 @@
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: 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 }
33
34 ListView {
35 id: partListView
36 model: visualModel
37 anchors {
38 top: parent.top
39 left: parent.left
40 margins: 5
41 }
42 spacing: 5
43 height: contentHeight
44 width: parent.width - 10
45 interactive: false
46 }
47}
diff --git a/components/mailviewer/contents/ui/MailViewer.qml b/components/mailviewer/contents/ui/MailViewer.qml
new file mode 100644
index 00000000..0f7efca2
--- /dev/null
+++ b/components/mailviewer/contents/ui/MailViewer.qml
@@ -0,0 +1,46 @@
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: root
23 property alias rootIndex: visualModel.rootIndex
24 property bool debug: false
25 height: partListView.height
26
27 MailDataModel {
28 id: visualModel
29 debug: root.debug
30 model: messageParser.newTree
31 }
32
33 ListView {
34 id: partListView
35 model: visualModel
36 anchors {
37 top: parent.top
38 left: parent.left
39 margins: 5
40 }
41 spacing: 5
42 height: contentHeight
43 width: parent.width - 10
44 interactive: false
45 }
46}
diff --git a/components/mailviewer/contents/ui/PURPLE.png b/components/mailviewer/contents/ui/PURPLE.png
new file mode 100644
index 00000000..5ea1eda2
--- /dev/null
+++ b/components/mailviewer/contents/ui/PURPLE.png
Binary files differ
diff --git a/components/mailviewer/contents/ui/RED.png b/components/mailviewer/contents/ui/RED.png
new file mode 100644
index 00000000..5bb547e2
--- /dev/null
+++ b/components/mailviewer/contents/ui/RED.png
Binary files differ
diff --git a/components/mailviewer/contents/ui/SignaturePart.qml b/components/mailviewer/contents/ui/SignaturePart.qml
new file mode 100644
index 00000000..0a2fe525
--- /dev/null
+++ b/components/mailviewer/contents/ui/SignaturePart.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: 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: 5; top: 5; right: 6; bottom: 6 }
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 height: contentHeight
61 width: parent.width - 40
62
63 spacing: 20
64 interactive: false
65 }
66 }
67 }
68}
diff --git a/components/mailviewer/contents/ui/TextContent.qml b/components/mailviewer/contents/ui/TextContent.qml
new file mode 100644
index 00000000..d3ae80f9
--- /dev/null
+++ b/components/mailviewer/contents/ui/TextContent.qml
@@ -0,0 +1,61 @@
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.7
20import org.kde.kirigami 1.0 as Kirigami
21
22Item {
23 id: textItem
24
25 property bool debug: true
26
27 width: partColumn.width
28 height: textColumn.height
29
30 Column {
31 id: textColumn
32
33 anchors {
34 top: parent.top
35 left: parent.left
36 }
37
38 width: parent.width
39 spacing: 5
40
41 TextEdit {
42 width: parent.width
43
44 readOnly: true
45 selectByMouse: true
46
47 text: model.content
48 wrapMode: Text.WordWrap
49
50 color: model.embeded ? Kirigami.Theme.diabledTextColor : Kirigami.Theme.textColor
51 }
52
53 //BEGIN debug
54 Text {
55 width: parent.width
56 visible: textItem.debug
57 text: model.type
58 }
59 //END debug
60 }
61}
diff --git a/components/mailviewer/contents/ui/YELLOW.png b/components/mailviewer/contents/ui/YELLOW.png
new file mode 100644
index 00000000..db629e35
--- /dev/null
+++ b/components/mailviewer/contents/ui/YELLOW.png
Binary files differ
diff --git a/components/mailviewer/contents/ui/main.qml b/components/mailviewer/contents/ui/main.qml
new file mode 100644
index 00000000..e69dd5a2
--- /dev/null
+++ b/components/mailviewer/contents/ui/main.qml
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
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.7
20import QtQuick.Controls 2.0 as Controls2
21
22Controls2.ApplicationWindow {
23 id: app
24 height: 900
25 width: 1500
26
27 MailViewer {
28 visible: true
29 }
30}