From fb12fcddb68e96580028072daa595d82fb3dd0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Wed, 12 Oct 2016 14:23:20 +0200 Subject: get the correct size for NewMailViewer in qml --- components/CMakeLists.txt | 2 +- components/mailviewer/qml/MailViewer.qml | 60 +++++++++++++++++++++++++++ components/mailviewer/qml/qmldir | 3 ++ components/package/contents/ui/MailViewer.qml | 10 ++--- 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 components/mailviewer/qml/MailViewer.qml create mode 100644 components/mailviewer/qml/qmldir (limited to 'components') diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 66e27822..30a9d09c 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -24,7 +24,7 @@ find_package(KF5 REQUIRED COMPONENTS Package) install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/components) install(DIRECTORY package/contents/ui/ DESTINATION ${QML_INSTALL_DIR}/org/kube/components) -install(DIRECTORY mailviewer/qml/ DESTINATION ${QML_INSTALL_DIR}/org/kube/components) +install(DIRECTORY mailviewer/qml/ DESTINATION ${QML_INSTALL_DIR}/org/kube/mailviewer) include(${CMAKE_SOURCE_DIR}/KF5KirigamiMacros.cmake) kirigami_package_breeze_icons(ICONS applications-graphics view-list-icons folder-sync view-list-details configure document-edit dialog-cancel document-decrypt mail-reply-sender bookmarks folder) diff --git a/components/mailviewer/qml/MailViewer.qml b/components/mailviewer/qml/MailViewer.qml new file mode 100644 index 00000000..f5714e25 --- /dev/null +++ b/components/mailviewer/qml/MailViewer.qml @@ -0,0 +1,60 @@ +/* + 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 { + id: mailviewer + height: mainColumn.height + 50 + width: parent.width * 0.9 + + Column { + id: mainColumn + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: 20 + } + spacing: 10 + width: parent.width - 50 + + Repeater { + model: messageParser.newTree + + delegate: Column { + id: delegateRoot + + width: mainColumn.width + + Loader { + id: loader + } + + Component.onCompleted: { + switch (model.type) { + case "AlternativePart": + case "SinglePart": + loader.source = "MailPart.qml"; + break; + } + } + } + } + } +} diff --git a/components/mailviewer/qml/qmldir b/components/mailviewer/qml/qmldir new file mode 100644 index 00000000..0d87b779 --- /dev/null +++ b/components/mailviewer/qml/qmldir @@ -0,0 +1,3 @@ +module org.kube.mailviewer + +MailViewer 1.0 MailViewer.qml diff --git a/components/package/contents/ui/MailViewer.qml b/components/package/contents/ui/MailViewer.qml index 347f30de..02d84728 100644 --- a/components/package/contents/ui/MailViewer.qml +++ b/components/package/contents/ui/MailViewer.qml @@ -22,13 +22,14 @@ import QtQuick.Controls 1.4 import QtQuick.Layouts 1.1 import org.kube.framework.domain 1.0 as KubeFramework +import org.kube.mailviewer 1.0 as MV Item { id: root property variant message; property string html; property bool enablePartTreeView : true; - property int desiredHeight: enablePartTreeView ? topPartLoader.height + dummyApp.height + mailStructure.height + 50 : topPartLoader.height + dummyApp.height + 50; + property int desiredHeight: enablePartTreeView ? topPartLoader.height + newMailViewer.height + mailStructure.height + 50 : topPartLoader.height + newMailViewer.height + 50; Rectangle { id: rootRectangle @@ -40,14 +41,13 @@ Item { anchors.margins: 0 verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff Column { - spacing:2 + spacing: 2 Text { text: "New Mailviewer:" color: "blue" } - DummyApp { - id: dummyApp - height: 800 + MV.MailViewer { + id: newMailViewer width: rootRectangle.width } Text { -- cgit v1.2.3