Dekko
Loading...
Searching...
No Matches
ComposePanelPopup.qml
1/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18import QtQuick 2.4
19import QtQuick.Controls.Suru 2.2
20import Lomiri.Components 1.3
21import Lomiri.Components.Popups 1.3
22import Dekko.Components 1.0
23import QuickFlux 1.0
24import Dekko.Mail.API 1.0
25import Dekko.Mail.Stores.Composer 1.0
26import Dekko.Lomiri.Components 1.0
27import Dekko.Lomiri.Constants 1.0
29PopupBase {
30 id: base
31
32 readonly property int maxHeight: units.gu(70)
33 readonly property int maxWidth: units.gu(100)
34
35 Rectangle {
36 anchors.fill: parent
37 color: Suru.secondaryForegroundColor
38 opacity: 0.6
39 }
40
41 LomiriShape {
42 readonly property bool shouldCenter: height === base.maxHeight
43 readonly property bool addTopMargin: height > units.gu(40)
44 aspect: LomiriShape.DropShadow
45 width: Math.min((parent.width / 3)*2, base.maxWidth)
46 height: Math.min((parent.height / 5)*4, base.maxHeight)
47 anchors {
48 horizontalCenter: parent.horizontalCenter
49 top: shouldCenter ? undefined : parent.top
50 topMargin: shouldCenter ? undefined : (addTopMargin ? units.gu(6) : Style.defaultSpacing)
51 verticalCenter: shouldCenter ? parent.verticalCenter : undefined
52 }
53 color: Suru.secondaryBackgroundColor
54 clip: true
55
56 StretchColumn {
57 anchors.fill: parent
58 Item {
59 anchors {
60 top: parent.top
61 right: parent.right
62 left: parent.left
63 }
64 height: units.gu(6)
65 implicitHeight: height
66
67 StretchRow {
68 anchors.fill: parent
69 anchors.leftMargin: units.gu(1)
70 anchors.rightMargin: units.gu(1)
71 spacing: units.gu(1)
72 TitledHeaderButton {
73 height: units.gu(5)
74 anchors.verticalCenter: parent.verticalCenter
75 action: ComposerStore.actions.discardMessageAction
76 }
77 TitledHeaderButton {
78 height: units.gu(5)
79 anchors.verticalCenter: parent.verticalCenter
80 action: ComposerStore.actions.saveDraftAction
81 }
82
83 TitledHeaderButton {
84 height: units.gu(5)
85 anchors.verticalCenter: parent.verticalCenter
86 action: ComposerStore.actions.attachmentsAction
87 }
88
89 TitledHeaderButton {
90 height: units.gu(5)
91 anchors.verticalCenter: parent.verticalCenter
92 action: Action {
93 text: qsTr("Contacts")
94 iconName: "contact"
95 onTriggered: PopupUtils.open(Qt.resolvedUrl("./ComposerOverflowMenu.qml"), base)
96 }
97 }
98
99 Stretcher {}
100
102 height: units.gu(5)
103 anchors.verticalCenter: parent.verticalCenter
104 action: ComposerStore.actions.sendAction
105 }
106 }
107
108 Line {
109 anchors {
110 bottom: parent.bottom
111 right: parent.right
112 left: parent.left
113 }
114 }
115 }
116
117 Stretcher {
118 id: content
119 Rectangle {
120 anchors.fill: parent
121 color: Suru.backgroundColor
122 }
123 StretchRow {
124 anchors.fill: parent
125 spacing: 0
126
127 Stretcher {
128 implicitHeight: parent.height
129 MessageComposer {
130 anchors.fill: parent
131 }
132 }
133 ComposeSidePanel {}
134 }
135 }
136
137 Item {
138 id: statusBar
139 height: units.gu(3)
140 width: parent.width
141 implicitWidth: width
142 implicitHeight: height
143 Label {
144 anchors {
145 left: parent.left
146 leftMargin: Style.defaultSpacing
147 verticalCenter: parent.verticalCenter
148 }
149 fontSize: "small"
150 text: "TODO: background status' like \"Saving draft....\""
151 }
152 }
153 }
154 }
155 AppListener {
156 enabled: composer.isLargeFF
157 filter: ViewKeys.closeComposer
158 onDispatched: {
159 PopupUtils.close(base)
160 }
161 }
162}
163