diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-28 18:09:48 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-28 18:09:48 +0100 |
commit | 31fc464ee7a2f6a34bbfec77a551721a6b334b5f (patch) | |
tree | cfd79edeb6eb1cc2636d0ef9af6f47fe82358f1f | |
parent | bd4caf4e8d3b525848e542f367c535c5b6a0a101 (diff) | |
download | kube-31fc464ee7a2f6a34bbfec77a551721a6b334b5f.tar.gz kube-31fc464ee7a2f6a34bbfec77a551721a6b334b5f.zip |
Removed the old mailviewer.
That way I also don't try to edit outdated invisible components to fix
bugs...
-rw-r--r-- | components/package/contents/ui/ContentView.qml | 60 | ||||
-rw-r--r-- | components/package/contents/ui/MailViewer.qml | 27 | ||||
-rw-r--r-- | components/package/contents/ui/MessagePartTree.qml | 89 | ||||
-rw-r--r-- | components/package/contents/ui/TextView.qml | 32 | ||||
-rw-r--r-- | components/package/contents/ui/WebView.qml | 55 |
5 files changed, 4 insertions, 259 deletions
diff --git a/components/package/contents/ui/ContentView.qml b/components/package/contents/ui/ContentView.qml deleted file mode 100644 index 099d5c5d..00000000 --- a/components/package/contents/ui/ContentView.qml +++ /dev/null | |||
@@ -1,60 +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 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Controls 1.3 | ||
21 | |||
22 | Item { | ||
23 | id: root | ||
24 | property int nestingLevel; | ||
25 | property bool isHtml; | ||
26 | property string content; | ||
27 | property string contentType; | ||
28 | property int contentWidth: contentLoader.item.contentWidth | ||
29 | property int contentHeight: contentLoader.item.contentHeight | ||
30 | Rectangle { | ||
31 | id: contentRect | ||
32 | |||
33 | //Only for development | ||
34 | // border.width: 1 | ||
35 | // border.color: "black" | ||
36 | // radius: 5 | ||
37 | // anchors.leftMargin: nestingLevel * 5 | ||
38 | anchors.fill: parent | ||
39 | |||
40 | Loader { | ||
41 | id: contentLoader | ||
42 | property string content: root.content | ||
43 | anchors.fill: parent | ||
44 | sourceComponent: isHtml ? htmlComponent : textComponent | ||
45 | } | ||
46 | |||
47 | Component { | ||
48 | id: textComponent | ||
49 | TextView { | ||
50 | content: root.content | ||
51 | } | ||
52 | } | ||
53 | Component { | ||
54 | id: htmlComponent | ||
55 | WebView { | ||
56 | content: root.content | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/components/package/contents/ui/MailViewer.qml b/components/package/contents/ui/MailViewer.qml index 150ee5aa..4ee170bd 100644 --- a/components/package/contents/ui/MailViewer.qml +++ b/components/package/contents/ui/MailViewer.qml | |||
@@ -27,40 +27,21 @@ Item { | |||
27 | id: root | 27 | id: root |
28 | property variant message; | 28 | property variant message; |
29 | property string html; | 29 | property string html; |
30 | property int desiredHeight: topPartLoader.height + newMailViewer.height + 20 | 30 | property int desiredHeight: mailViewer.height + 20 |
31 | property variant attachments | 31 | property variant attachments |
32 | 32 | ||
33 | clip: true | 33 | clip: true |
34 | 34 | ||
35 | MV.MailViewer { | 35 | MV.MailViewer { |
36 | id: newMailViewer | 36 | id: mailViewer |
37 | debug: false | 37 | debug: false |
38 | width: parent.width | 38 | width: parent.width |
39 | } | 39 | } |
40 | 40 | ||
41 | //BEGIN old mail viewer | ||
42 | |||
43 | MessagePartTree { | ||
44 | id: topPartLoader | ||
45 | anchors.top: newMailViewer.bottom | ||
46 | |||
47 | Text { | ||
48 | text: "old mailviewer" | ||
49 | color: "blue" | ||
50 | } | ||
51 | |||
52 | visible: false | ||
53 | // width: parent.width | ||
54 | height: topPartLoader.contentHeight | ||
55 | width: topPartLoader.contentWidth >= parent.width ? topPartLoader.contentWidth : parent.width | ||
56 | } | ||
57 | |||
58 | //END old mail viewer | ||
59 | |||
60 | Controls1.TreeView { | 41 | Controls1.TreeView { |
61 | id: mailStructure | 42 | id: mailStructure |
62 | anchors.top: messageParser.attachments.rowCount() > 0 ? attachments.bottom : newMailViewer.bottom | 43 | anchors.top: messageParser.attachments.rowCount() > 0 ? attachments.bottom : mailViewer.bottom |
63 | visible: newMailViewer.debug | 44 | visible: mailViewer.debug |
64 | width: parent.width | 45 | width: parent.width |
65 | height: 400 | 46 | height: 400 |
66 | Controls1.TableViewColumn { | 47 | Controls1.TableViewColumn { |
diff --git a/components/package/contents/ui/MessagePartTree.qml b/components/package/contents/ui/MessagePartTree.qml deleted file mode 100644 index a904f42c..00000000 --- a/components/package/contents/ui/MessagePartTree.qml +++ /dev/null | |||
@@ -1,89 +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 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Controls 1.3 | ||
21 | |||
22 | Item { | ||
23 | id: root | ||
24 | property alias rootIndex: visualModel.rootIndex | ||
25 | property int nestingLevel: 0 | ||
26 | property int contentHeight: messagePartRect.height | ||
27 | property int contentWidth: 0 | ||
28 | Rectangle { | ||
29 | id: messagePartRect | ||
30 | height: partListView.contentHeight | ||
31 | width: root.width | ||
32 | VisualDataModel { | ||
33 | id: visualModel | ||
34 | model: messageParser.partTree | ||
35 | delegate: Rectangle { | ||
36 | id: delegateRect | ||
37 | visible: !model.isHidden | ||
38 | width: childrenRect.width | ||
39 | height: childrenRect.height | ||
40 | // color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) | ||
41 | ContentView { | ||
42 | id: contentView | ||
43 | anchors.top: delegateRect.top | ||
44 | anchors.left: delegateRect.left | ||
45 | width: messagePartRect.width | ||
46 | height: contentHeight | ||
47 | content: model.text | ||
48 | isHtml: model.isHtml | ||
49 | visible: model.hasContent | ||
50 | onVisibleChanged: { | ||
51 | //Resize to 0 if it is not visible so the partLoader has the right offset | ||
52 | if (!visible) { | ||
53 | height = 0 | ||
54 | } | ||
55 | } | ||
56 | onContentWidthChanged: { | ||
57 | root.contentWidth = contentWidth > root.contentWidth ? contentWidth : root.contentWidth | ||
58 | } | ||
59 | contentType: model.type | ||
60 | } | ||
61 | Loader { | ||
62 | id: partLoader | ||
63 | anchors.top: contentView.bottom | ||
64 | anchors.left: contentView.left | ||
65 | visible: model.hasModelChildren | ||
66 | active: model.hasModelChildren | ||
67 | height: item ? item.contentHeight : 0 | ||
68 | width: messagePartRect.width | ||
69 | } | ||
70 | Component.onCompleted: { | ||
71 | if (model.hasModelChildren) { | ||
72 | partLoader.source = "MessagePartTree.qml" | ||
73 | partLoader.item.rootIndex = visualModel.modelIndex(index) | ||
74 | partLoader.item.nestingLevel = root.nestingLevel + 1 | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | |||
80 | ListView { | ||
81 | id: partListView | ||
82 | model: visualModel | ||
83 | anchors.left: parent.left | ||
84 | anchors.top: parent.top | ||
85 | anchors.right: parent.right | ||
86 | height: parent.height | ||
87 | } | ||
88 | } | ||
89 | } | ||
diff --git a/components/package/contents/ui/TextView.qml b/components/package/contents/ui/TextView.qml deleted file mode 100644 index 7fd1272f..00000000 --- a/components/package/contents/ui/TextView.qml +++ /dev/null | |||
@@ -1,32 +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 | |||
19 | import QtQuick 2.7 | ||
20 | |||
21 | Item { | ||
22 | id: root | ||
23 | property string content; | ||
24 | property int contentWidth: 0; | ||
25 | property int contentHeight: textView.contentHeight; | ||
26 | Text { | ||
27 | id: textView | ||
28 | wrapMode: Text.WordWrap | ||
29 | anchors.fill: parent | ||
30 | text: content | ||
31 | } | ||
32 | } | ||
diff --git a/components/package/contents/ui/WebView.qml b/components/package/contents/ui/WebView.qml deleted file mode 100644 index 509c9809..00000000 --- a/components/package/contents/ui/WebView.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 | |||
19 | import QtQuick 2.7 | ||
20 | import QtWebEngine 1.3 | ||
21 | |||
22 | Item { | ||
23 | id: root | ||
24 | property string content; | ||
25 | property int contentWidth: 0; | ||
26 | property int contentHeight: 0; | ||
27 | WebEngineView { | ||
28 | id: htmlView | ||
29 | anchors.fill: parent | ||
30 | onLoadingChanged: { | ||
31 | // console.debug("Status is ", loadRequest.status); | ||
32 | // console.debug("Url is ", loadRequest.url); | ||
33 | if (loadRequest.errorCode) { | ||
34 | console.warn("Error is ", loadRequest.errorString); | ||
35 | } | ||
36 | } | ||
37 | Component.onCompleted: { | ||
38 | loadHtml(content, "file:///") | ||
39 | } | ||
40 | onContentsSizeChanged: { | ||
41 | root.contentWidth = contentsSize.width | ||
42 | root.contentHeight = contentsSize.height | ||
43 | } | ||
44 | activeFocusOnPress: false | ||
45 | settings { | ||
46 | autoLoadImages: true | ||
47 | javascriptCanOpenWindows: false | ||
48 | javascriptEnabled: true | ||
49 | localStorageEnabled: false | ||
50 | } | ||
51 | } | ||
52 | onContentChanged: { | ||
53 | htmlView.loadHtml(content, "file:///"); | ||
54 | } | ||
55 | } | ||