From 9d3af72bbbdddae93133d7d7f73b8704613a06ca Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Sat, 7 Jan 2017 12:20:23 +0100 Subject: rework header so we show the sunject --- components/package/contents/ui/SingleMailView.qml | 213 ++++++++-------------- 1 file changed, 73 insertions(+), 140 deletions(-) (limited to 'components/package/contents') diff --git a/components/package/contents/ui/SingleMailView.qml b/components/package/contents/ui/SingleMailView.qml index 41c75224..632c8271 100644 --- a/components/package/contents/ui/SingleMailView.qml +++ b/components/package/contents/ui/SingleMailView.qml @@ -32,76 +32,10 @@ Item { property variant mail; - Rectangle { - id: subjectBar - - anchors { - top: parent.top - left: parent.left - right: parent.right - } - - height: Kirigami.Units.gridUnit * 2 - - color: Kirigami.Theme.backgroundColor - - Kirigami.Heading { - - anchors { - left: parent.left - leftMargin: Kirigami.Units.largeSpacing - verticalCenter: parent.verticalCenter - } - - width: parent.width - Kirigami.Units.gridUnit * 5 - - text: "Some subject" - color: Kirigami.Theme.textColor - level: 4 - font.italic: true - - } - - //TODO Make it clickable - Text { - - anchors { - right: parent.right - rightMargin: Kirigami.Units.gridUnit * 0.2 - bottom: parent.bottom - bottomMargin: Kirigami.Units.gridUnit * 0.2 + 1 - } - - //make it blue and lightgrey - text: "Plaintext / HTML" - color: Kirigami.Theme.textColor - font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.7 - - MouseArea { - anchors.fill: parent - - onClicked: { - parent.text == "Plaintext / HTML" ? parent.text = "Plaintext / HTML" : parent.text = "Plaintext / HTML" - } - } - } - - Rectangle { - - anchors.bottom: parent.bottom - - height: 1 - width: parent.width - - color: Kirigami.Theme.highlightColor - } - } - - ListView { id: listView anchors { - top: subjectBar.bottom + top: parent.top left: parent.left right: parent.right bottom: parent.bottom @@ -161,110 +95,107 @@ Item { margins: Kirigami.Units.largeSpacing } - height: from.height + to.height + Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing + height: headerContent.height + Kirigami.Units.smallSpacing - Avatar { - id: avatar + Text { + id: date_label anchors { + right: seperator.right top: parent.top - topMargin: Kirigami.Units.smallSpacing } - height: Kirigami.Units.gridUnit * 2.5 - width: height + text: Qt.formatDateTime(model.date, "dd MMM yyyy hh:mm") - name: model.senderName + font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.7 + color: Kirigami.Theme.textColor + opacity: 0.75 } - Row{ - id: from + Column { + id: headerContent anchors { - top: avatar.top - left: avatar.right - leftMargin: Kirigami.Units.smallSpacing * 2 - topMargin: Kirigami.Units.smallSpacing + //left: to_l.right + horizontalCenter: parent.horizontalCenter } - width: parent.width - avatar.width - Kirigami.Units.largeSpacing * 2 + //spacing: Kirigami.Units.smallSpacing - spacing: Kirigami.Units.smallSpacing - clip: true + width: parent.width - Text { - id: senderName + Row{ + id: from - text: model.senderName + width: parent.width - font.weight: Font.DemiBold - color: Kirigami.Theme.textColor - opacity: 0.75 - } + spacing: Kirigami.Units.smallSpacing + clip: true - Text { + Text { + id: senderName - width: parent.width - senderName.width - Kirigami.Units.smallSpacing + text: model.senderName - text: model.sender + font.weight: Font.DemiBold + color: Kirigami.Theme.textColor + opacity: 0.75 + } - color: Kirigami.Theme.textColor - opacity: 0.75 + Text { - elide: Text.ElideRight - } - } + text: model.sender - Text { - id: to_label + width: parent.width - senderName.width - date_label.width - Kirigami.Units.largeSpacing - anchors { - top: from.bottom - left: avatar.right - leftMargin: Kirigami.Units.smallSpacing * 2 - topMargin: Kirigami.Units.smallSpacing * 0.5 - } + color: Kirigami.Theme.textColor + opacity: 0.75 - text: "to:" + clip: true + } + } - color: Kirigami.Theme.textColor - opacity: 0.75 - } + Text { + text: model.subject - Text { - id: to + color: Kirigami.Theme.textColor + opacity: 0.75 - anchors { - top: to_label.top - left: to_label.right - leftMargin: Kirigami.Units.smallSpacing + font.italic: true } - width: parent.width - avatar.width - to_label.width - Kirigami.Units.largeSpacing * 2 - - text: model.to + " " + model.cc + " " + model.bcc + Text { + id: to - maximumLineCount: 3 - wrapMode: Text.WrapAnywhere - elide: Text.ElideRight + anchors { + top: to_label.top + left: to_label.right + leftMargin: Kirigami.Units.smallSpacing + } - color: Kirigami.Theme.textColor - opacity: 0.75 - clip: true - } + text:"to: "+ model.to + " " + model.cc + " " + model.bcc - Text { + color: Kirigami.Theme.textColor + opacity: 0.75 + } + } + Rectangle { anchors { + bottom: seperator.top right: seperator.right - top: parent.top } - text: Qt.formatDateTime(model.date, "dd MMM yyyy hh:mm") + height: Kirigami.Units.gridUnit + width: height - font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.7 - color: Kirigami.Theme.textColor - opacity: 0.75 + color: Kirigami.Theme.backgroundColor + + Controls1.ToolButton { + anchors.fill: parent + + iconName: "go-down" + } } Rectangle { @@ -308,14 +239,14 @@ Item { anchors { top: header.bottom topMargin: Kirigami.Units.smallSpacing - horizontalCenter: parent.horizontalCenter + right: header.right } - width: parent.width - Kirigami.Units.gridUnit * 2 - height: Kirigami.Units.gridUnit * 2 + width: header.width - Kirigami.Units.largeSpacing layoutDirection: Qt.RightToLeft spacing: Kirigami.Units.smallSpacing + clip: true Repeater { model: body.attachments @@ -324,6 +255,8 @@ Item { name: model.name icon: "mail-attachment" + clip: true + //TODO size encrypted signed type } } @@ -334,11 +267,11 @@ Item { anchors { top: header.bottom - left: parent.left - right: parent.right - leftMargin: avatar.height + Kirigami.Units.gridUnit - rightMargin: avatar.height + Kirigami.Units.gridUnit - topMargin: avatar.height + left: header.left + right: header.right + leftMargin: Kirigami.Units.largeSpacing + rightMargin: Kirigami.Units.largeSpacing + topMargin: Math.max(attachments.height, Kirigami.Units.largeSpacing) } width: header.width - Kirigami.Units.largeSpacing * 2 -- cgit v1.2.3