19 import QtQuick.Controls.Suru 2.2
20 import Lomiri.Components 1.3
21 import
Dekko.Components 1.0
22 import
Dekko.Mail.API 1.0
23 import
Dekko.Mail.Stores.Composer 1.0
24 import
Dekko.Lomiri.Constants 1.0
25 import
Dekko.Lomiri.Components 1.0
31 property var attachments
32 property bool isReadOnly
33 property int maxHeight
34 property int attachmentDelegateHeight: units.gu(6)
35 readonly
property int expandedHeight: internalHeight > maxHeight ? maxHeight : internalHeight
36 readonly
property int internalHeight: header.height + attachmentList.contentHeight
37 readonly
property int collapsedHeight: attachmentPanel.visible ? header.height : 0
38 readonly
property bool expanded: state ===
"expanded"
39 color: Suru.backgroundColor
40 visible: attachments.count
44 acceptedButtons: Qt.LeftButton | Qt.RightButton
45 onClicked: mouse.accepted =
true
46 onWheel: wheel.accepted =
true
64 onClicked: d.isExpanded = !d.isExpanded
68 name: Icons.AttachmentIcon
74 verticalCenter: parent.verticalCenter
83 verticalCenter: parent.verticalCenter
85 text: qsTr(
"Attachments")
93 verticalCenter: parent.verticalCenter
96 aspect: LomiriShape.Flat
97 color: Suru.secondaryBackgroundColor
102 anchors.margins: units.gu(0.5)
103 anchors.centerIn: parent
105 text: attachments.count
115 verticalCenter: parent.verticalCenter
117 color: LomiriColors.ash
118 rotation: attachmentPanel.expanded ? 180 : 0
120 state: attachmentPanel.expanded ?
"rotated" :
"normal"
124 PropertyChanges { target: icon; rotation: 180 }
128 PropertyChanges { target: icon; rotation: 0 }
131 transitions: Transition {
133 duration: LomiriAnimation.FastDuration
134 direction: icon.state ===
"normal" ? RotationAnimation.Clockwise : RotationAnimation.Counterclockwise
145 bottom: parent.bottom
155 model: attachments ? attachments : 0
157 height: attachmentDelegateHeight
158 leftSideAction: isReadOnly ? 0 : ComposerStore.actions.deleteAttachment
165 property bool isExpanded:
false
169 LomiriNumberAnimation{}
172 state: d.isExpanded ?
"expanded" :
"collapsed"
177 target: attachmentPanel
178 height: collapsedHeight
184 target: attachmentPanel
185 height: expandedHeight