summaryrefslogtreecommitdiffstats
path: root/components/package/contents/ui/MailViewer.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-09 15:13:00 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-09 15:14:19 +0100
commit2dac72ae43f627340694d89db68184cb07e68650 (patch)
tree5397a5b6216bd05f9f48a219f379d59d64c8bde4 /components/package/contents/ui/MailViewer.qml
parentda079fe211094621fbcb89614e58b84caa9a603b (diff)
downloadkube-2dac72ae43f627340694d89db68184cb07e68650.tar.gz
kube-2dac72ae43f627340694d89db68184cb07e68650.zip
Moved application to components
Diffstat (limited to 'components/package/contents/ui/MailViewer.qml')
-rw-r--r--components/package/contents/ui/MailViewer.qml43
1 files changed, 43 insertions, 0 deletions
diff --git a/components/package/contents/ui/MailViewer.qml b/components/package/contents/ui/MailViewer.qml
new file mode 100644
index 00000000..1d305297
--- /dev/null
+++ b/components/package/contents/ui/MailViewer.qml
@@ -0,0 +1,43 @@
1import QtQuick 2.4
2import QtQuick.Controls 1.3
3import QtQuick.Layouts 1.1
4import QtWebKit 3.0
5
6import org.kde.kube.mail 1.0 as Mail
7
8Item {
9 id: root
10 property variant message;
11 property string html;
12
13 WebView {
14 id: webview
15 anchors.fill: parent
16 onNavigationRequested: {
17 // detect URL scheme prefix, most likely an external link
18 var schemaRE = /^\w+:/;
19 if (schemaRE.test(request.url)) {
20 request.action = WebView.AcceptRequest;
21 } else {
22 request.action = WebView.IgnoreRequest;
23 // delegate request.url here
24 }
25 }
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 }
37
38 Mail.MessageParser {
39 id: messageParser
40 message: root.message
41 }
42 html: messageParser.html
43}