From acf2a53fea8fdbe366627e45fffe87434e3c2e7e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 24 May 2017 12:59:23 +0200 Subject: Attachment open and download buttons We'll need proper icons though. --- framework/qml/AttachmentDelegate.qml | 33 ++++++++++++++++++++++----------- framework/qml/MailViewer.qml | 10 +++++----- 2 files changed, 27 insertions(+), 16 deletions(-) (limited to 'framework/qml') diff --git a/framework/qml/AttachmentDelegate.qml b/framework/qml/AttachmentDelegate.qml index 994afd8c..081baf5d 100644 --- a/framework/qml/AttachmentDelegate.qml +++ b/framework/qml/AttachmentDelegate.qml @@ -17,8 +17,6 @@ */ import QtQuick 2.7 -import QtQuick.Layouts 1.1 -import org.kde.kirigami 1.0 as Kirigami import org.kube.framework 1.0 as Kube Item { @@ -26,9 +24,11 @@ Item { property string name property string icon + signal open; + signal download; - width: content.width + Kirigami.Units.gridUnit / 2 - height: content.height + Kirigami.Units.gridUnit / 2 + width: content.width + Kube.Units.gridUnit / 2 + height: content.height + Kube.Units.gridUnit / 2 Rectangle { anchors.fill: parent @@ -37,26 +37,25 @@ Item { color: Kube.Colors.disabledTextColor } - RowLayout { + Row { id: content anchors.centerIn: parent - spacing: Kirigami.Units.smallSpacing + spacing: Kube.Units.smallSpacing Rectangle { id: mimetype - height: Kirigami.Units.gridUnit - width: Kirigami.Units.gridUnit + height: Kube.Units.gridUnit + width: Kube.Units.gridUnit color: Kube.Colors.backgroundColor - Kirigami.Icon { + Kube.Icon { height: parent.height width: height - - source: root.icon + iconName: root.icon } } @@ -64,5 +63,17 @@ Item { text: root.name color: Kube.Colors.backgroundColor } + Kube.IconButton { + height: parent.height + width: height + iconName: Kube.Icons.goDown + onClicked: root.download() + } + Kube.IconButton { + height: parent.height + width: height + iconName: Kube.Icons.edit + onClicked: root.open() + } } } diff --git a/framework/qml/MailViewer.qml b/framework/qml/MailViewer.qml index d2c0a3be..14c4bc8a 100644 --- a/framework/qml/MailViewer.qml +++ b/framework/qml/MailViewer.qml @@ -286,11 +286,11 @@ Rectangle { icon: model.iconName clip: true - - //TODO size encrypted signed type - MouseArea { - anchors.fill: parent - onClicked: messageParser.attachments.saveAttachmentToDisk(messageParser.attachments.index(index, 0)) + onDownload: { + messageParser.attachments.saveAttachmentToDisk(messageParser.attachments.index(index, 0)) + } + onOpen: { + messageParser.attachments.openAttachment(messageParser.attachments.index(index, 0)) } } } -- cgit v1.2.3