From f3fe0d6d2c52604bf0dc077676f84f5bc87e600b Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Wed, 7 Dec 2016 22:25:36 +0100 Subject: display attchments as flow --- .../package/contents/ui/AttachmentDelegate.qml | 5 ++- components/package/contents/ui/MailViewer.qml | 47 ++-------------------- components/package/contents/ui/SingleMailView.qml | 30 +++++++++++++- 3 files changed, 35 insertions(+), 47 deletions(-) (limited to 'components/package/contents') diff --git a/components/package/contents/ui/AttachmentDelegate.qml b/components/package/contents/ui/AttachmentDelegate.qml index 91e07d49..ffacb46c 100644 --- a/components/package/contents/ui/AttachmentDelegate.qml +++ b/components/package/contents/ui/AttachmentDelegate.qml @@ -21,6 +21,7 @@ import QtQuick.Layouts 1.1 import org.kde.kirigami 1.0 as Kirigami Item { + id: root property string name property string icon @@ -54,12 +55,12 @@ Item { height: parent.height width: height - source: "text-csv" + source: root.icon } } Text { - text: "some attachment.csv" + text: root.name color: Kirigami.Theme.textColor } } diff --git a/components/package/contents/ui/MailViewer.qml b/components/package/contents/ui/MailViewer.qml index 28414cac..f5e10c84 100644 --- a/components/package/contents/ui/MailViewer.qml +++ b/components/package/contents/ui/MailViewer.qml @@ -27,7 +27,8 @@ Item { id: root property variant message; property string html; - property int desiredHeight: topPartLoader.height + newMailViewer.height + attachments.height + 20 + property int desiredHeight: topPartLoader.height + newMailViewer.height + 20 + property variant attachments clip: true @@ -56,48 +57,6 @@ Item { //END old mail viewer - Controls1.TreeView { - id: attachments - anchors { - top: newMailViewer.bottom - topMargin: 20 - } - //visible: messageParser.attachments.rowCount() > 0 - width: parent.width - height: 200 - Controls1.TableViewColumn { - role: "name" - title: "Filename" - width: 300 - } - Controls1.TableViewColumn { - role: "type" - title: "Type" - width: 60 - } - Controls1.TableViewColumn { - role: "icon" - title: "Icon" - width: 60 - } - Controls1.TableViewColumn { - role: "size" - title: "Size" - width: 60 - } - Controls1.TableViewColumn { - role: "encrypted" - title: "Encrypted" - width: 60 - } - Controls1.TableViewColumn { - role: "signed" - title: "Signed" - width: 60 - } - model: messageParser.attachments - } - Controls1.TreeView { id: mailStructure anchors.top: messageParser.attachments.rowCount() > 0 ? attachments.bottom : newMailViewer.bottom @@ -131,6 +90,6 @@ Item { id: messageParser message: root.message } + attachments: messageParser.attachments html: messageParser.html - } diff --git a/components/package/contents/ui/SingleMailView.qml b/components/package/contents/ui/SingleMailView.qml index 76f0ef2e..732bec3b 100644 --- a/components/package/contents/ui/SingleMailView.qml +++ b/components/package/contents/ui/SingleMailView.qml @@ -72,7 +72,6 @@ Rectangle { } Rectangle { - anchors.bottom: parent.bottom height: 1 @@ -124,6 +123,8 @@ Rectangle { implicitHeight: header.height + body.height + (Kirigami.Units.gridUnit * 2.5) * 2 + footer.height width: parent.width - Kirigami.Units.gridUnit * 4 + color: Kirigami.Theme.viewBackgroundColor + //TODO bookmark /* ToolButton { @@ -255,6 +256,33 @@ Rectangle { } //END header + Flow { + id: attachments + + anchors { + top: header.bottom + topMargin: Kirigami.Units.smallSpacing + horizontalCenter: parent.horizontalCenter + } + + width: parent.width - Kirigami.Units.gridUnit * 2 + height: Kirigami.Units.gridUnit * 2 + + layoutDirection: Qt.RightToLeft + spacing: Kirigami.Units.smallSpacing + + Repeater { + model: body.attachments + + delegate: AttachmentDelegate { + name: model.name + icon: "mail-attachment" + + //TODO size encrypted signed type + } + } + } + MailViewer { id: body -- cgit v1.2.3