From 1974c19eadd497e355ac985a00d0571f3e6c7712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 11 Oct 2016 16:18:50 +0200 Subject: create model for new mailviewer --- components/mailviewer/qml/DummyApp.qml | 55 +++++++++++++++++++++ components/mailviewer/qml/HtmlPart.qml | 2 +- components/mailviewer/qml/MailPart.qml | 36 ++++++++------ components/mailviewer/qml/TextPart.qml | 4 +- components/mailviewer/qml/dummyapp.qml | 90 ---------------------------------- 5 files changed, 78 insertions(+), 109 deletions(-) create mode 100644 components/mailviewer/qml/DummyApp.qml delete mode 100644 components/mailviewer/qml/dummyapp.qml (limited to 'components/mailviewer') diff --git a/components/mailviewer/qml/DummyApp.qml b/components/mailviewer/qml/DummyApp.qml new file mode 100644 index 00000000..acb91ac1 --- /dev/null +++ b/components/mailviewer/qml/DummyApp.qml @@ -0,0 +1,55 @@ +/* + Copyright (C) 2016 Michael Bohlender, + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +import QtQuick 2.4 + +Item { +Column { + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: 20 + } + + spacing: 10 + width: parent.width + Repeater { + model: messageParser.newTree + + delegate: Column { + id: delegateRoot + + width: parent.width + + Loader { + id: loader + } + + Component.onCompleted: { + switch (model.type) { + case "AlternativePart": + case "SinglePart": + loader.source = "MailPart.qml"; + break; + } + } + } + } +} +} diff --git a/components/mailviewer/qml/HtmlPart.qml b/components/mailviewer/qml/HtmlPart.qml index f1add75c..f812ecb4 100644 --- a/components/mailviewer/qml/HtmlPart.qml +++ b/components/mailviewer/qml/HtmlPart.qml @@ -24,7 +24,7 @@ import QtWebEngine 1.2 Item { id: root - property string content: model.htmlContent + property string content: model.content property int contentHeight: helperView.contentHeight; //FIXME workaround until QtWebEngine 1.3 with contentsSize diff --git a/components/mailviewer/qml/MailPart.qml b/components/mailviewer/qml/MailPart.qml index 966337cd..d47b4c5f 100644 --- a/components/mailviewer/qml/MailPart.qml +++ b/components/mailviewer/qml/MailPart.qml @@ -21,24 +21,22 @@ import QtQuick 2.4 Item { id: root - height: partColumn.height + 40 + height: partColumn.height + 20 width: delegateRoot.width Column { id: partColumn - anchors { top: parent.top left: parent.left right: parent.right - margins: 20 + margins: 10 } - spacing: 10 + spacing: 5 Repeater { - model: content - + model: contents delegate: Column { id: delegateRoot @@ -49,23 +47,29 @@ Item { } Component.onCompleted: { - switch (model.type) { + case "AlternativePart": + case "SinglePart": + loader.source = "MailPart.qml"; + break; + + case "PlainTextContent": + case "Content": + loader.source = "TextPart.qml"; + break; + case "HtmlContent": + loader.source = "HtmlPart.qml"; + break; + + case "alternativeframe": + loader.source = "Frame.qml" + break; case "encrypted": loader.source = "EncryptedPart.qml"; break; case "embeded": loader.source = "EmbededPart.qml"; break; - case "frame": - loader.source = "Frame.qml" - break; - case "plaintext": - loader.source = "TextPart.qml"; - break; - case "html": - loader.source = "HtmlPart.qml"; - break; } } } diff --git a/components/mailviewer/qml/TextPart.qml b/components/mailviewer/qml/TextPart.qml index 5f183852..0267682f 100644 --- a/components/mailviewer/qml/TextPart.qml +++ b/components/mailviewer/qml/TextPart.qml @@ -21,8 +21,8 @@ import QtQuick 2.4 Text { width: delegateRoot.width - text: model.textContent + text: model.content wrapMode: Text.WordWrap - color: embeded ? "grey" : "black" + color: model.securityLevel //embeded ? "grey" : "black" } 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 @@ -/* - Copyright (C) 2016 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 2.4 - -Rectangle { - id: app - - width: 1200 - height: 700 - - Rectangle { - anchors.fill: parent - - color: "black" - - opacity: 0.8 - - } - - Rectangle { - - anchors.centerIn: parent - - height: mainColumn.height + 50 - width: parent.width * 0.9 - - Column { - id: mainColumn - - anchors.centerIn: parent - - width: parent.width - 50 - - spacing: 10 - - Repeater { - model: MailModel {} - - delegate: Column { - id: delegateRoot - - width: mainColumn.width - - Loader { - id: loader - } - - Component.onCompleted: { - switch (model.type) { - case "red": - loader.source = "Rect2.qml"; - break; - case "green": - loader.source = "Rect1.qml"; - break; - case "encrypted": - loader.source = "EncryptedPart.qml"; - break; - case "frame": - loader.source = "Frame.qml"; - break; - case "plaintext": - loader.source = "TextPart.qml"; - break; - case "html": - loader.source = "HtmlPart.qml"; - break; - } - } - } - } - } - } -} -- cgit v1.2.3