diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-04-07 12:09:39 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-04-07 12:15:33 +0200 |
commit | 5880ba07757f85c41474d3eb6473facdcb468482 (patch) | |
tree | 6d162874246c29d4234f628efd3a80efd8510b6a /components/package/contents/ui/MailViewer.qml | |
parent | 5f2a3aa64cedc7f5517a1047dd699a286faf1898 (diff) | |
download | kube-5880ba07757f85c41474d3eb6473facdcb468482.tar.gz kube-5880ba07757f85c41474d3eb6473facdcb468482.zip |
Replace the HTML view by a tree of QML views.
This allows us to do all the visual hints for the mail parts in qml,
instead of HTML.
Diffstat (limited to 'components/package/contents/ui/MailViewer.qml')
-rw-r--r-- | components/package/contents/ui/MailViewer.qml | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/components/package/contents/ui/MailViewer.qml b/components/package/contents/ui/MailViewer.qml index 771c6fa0..c51e2666 100644 --- a/components/package/contents/ui/MailViewer.qml +++ b/components/package/contents/ui/MailViewer.qml | |||
@@ -1,7 +1,6 @@ | |||
1 | import QtQuick 2.4 | 1 | import QtQuick 2.4 |
2 | import QtQuick.Controls 1.3 | 2 | import QtQuick.Controls 1.3 |
3 | import QtQuick.Layouts 1.1 | 3 | import QtQuick.Layouts 1.1 |
4 | import QtWebKit 3.0 | ||
5 | 4 | ||
6 | import org.kube.framework.domain 1.0 as KubeFramework | 5 | import org.kube.framework.domain 1.0 as KubeFramework |
7 | 6 | ||
@@ -10,29 +9,18 @@ Item { | |||
10 | property variant message; | 9 | property variant message; |
11 | property string html; | 10 | property string html; |
12 | 11 | ||
13 | WebView { | 12 | Rectangle { |
14 | id: webview | 13 | id: rootRectangle |
15 | anchors.fill: parent | 14 | anchors.fill: parent |
16 | onNavigationRequested: { | 15 | ScrollView { |
17 | // detect URL scheme prefix, most likely an external link | 16 | id: scrollView |
18 | var schemaRE = /^\w+:/; | 17 | anchors.fill: parent |
19 | if (schemaRE.test(request.url)) { | 18 | MessagePartTree { |
20 | request.action = WebView.AcceptRequest; | 19 | id: topPartLoader |
21 | } else { | 20 | width: rootRectangle.width |
22 | request.action = WebView.IgnoreRequest; | 21 | height: topPartLoader.desiredHeight |
23 | // delegate request.url here | ||
24 | } | 22 | } |
25 | } | 23 | } |
26 | onLoadingChanged: { | ||
27 | console.warn("Error is ", loadRequest.errorString); | ||
28 | console.warn("Status is ", loadRequest.status); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | onHtmlChanged: { | ||
33 | // console.warn("HTML is ", html); | ||
34 | // The file:/// argument is necessary so local icons are found | ||
35 | webview.loadHtml(html, "file:///"); | ||
36 | } | 24 | } |
37 | 25 | ||
38 | KubeFramework.MessageParser { | 26 | KubeFramework.MessageParser { |