Dekko
Loading...
Searching...
No Matches
CleanMessagePage.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 Lomiri.Components 1.3
20import QtWebEngine 1.5
21import Dekko.Mail 1.0
22import Dekko.Components 1.0
23import Dekko.Lomiri.Components 1.0
24import "../../webview"
25import Dekko.Lomiri.Constants 1.0
26
27DekkoPage {
28
29 pageHeader.title: qsTr("Message")
30 pageHeader.backAction: Action {
31 id: back
32 iconName: "back"
33 onTriggered: internalStack.pop()
34 }
35 pageHeader.state: "custom"
36 // only show the divider when the oxide moves the envelope header
37 // when scrolling. We want it to look seemless in it's original position
38 pageHeader.showDivider: h.y !== 0
39 pageHeader.customComponent: Component {
40 id: headerComponent
41 Item {
42 anchors.fill: parent
43 anchors {
44 topMargin: units.gu(1)
45 }
46
47
48 Item {
49 height: parent.height
50 anchors {
51 left: parent.left
52 right: parent.right
53 }
54 Row {
55 height: parent.height
56 anchors {
57 left: parent.left
58 right: starIcon.left
59 }
60 spacing: dekko.isSmallFF ? 0 : Style.smallSpacing
61
62 AbstractButton {
63 id: backBtn
64 height: parent.height
65 width: dekko.isSmallFF ? Style.largeSpacing : 0
66 Icon {
67 height: Style.defaultSpacing
68 width: Style.defaultSpacing
69 visible: dekko.isSmallFF
70 name: "back"
71 anchors {
72 horizontalCenter: parent.horizontalCenter
73 top: parent.top
74 topMargin: units.gu(1.5)
75 }
76 }
77 onClicked: internalStack.pop()
78 }
79
80 AbstractButton {
81 height: parent.height
82 width: units.gu(4)
84 height: Style.defaultIconSize
85 width: Style.defaultIconSize
86 name: Icons.MailReadIcon
87 anchors {
88 horizontalCenter: parent.horizontalCenter
89 top: parent.top
90 topMargin: units.gu(1.2)
91 }
92 }
93 }
94
95 AbstractButton {
96 height: parent.height
97 width: units.gu(4)
99 height: Style.defaultIconSize
100 width: Style.defaultIconSize
101 name: Icons.ViewListSymbolic
102 anchors {
103 horizontalCenter: parent.horizontalCenter
104 top: parent.top
105 topMargin: units.gu(1.2)
106 }
107 }
108 }
109 AbstractButton {
110 height: parent.height
111 width: units.gu(4)
113 height: Style.defaultIconSize
114 width: Style.defaultIconSize
115 name: Icons.JunkIcon
116 color: message.isJunk ? LomiriColors.red : LomiriColors.ash
117 anchors {
118 horizontalCenter: parent.horizontalCenter
119 top: parent.top
120 topMargin: units.gu(1.2)
121 }
122 }
123 }
124 }
125
126 AbstractButton {
127 id: starIcon
128 height: parent.height
129 width: units.gu(4)
130 anchors {
131 horizontalCenter: parent.horizontalCenter
132 }
134 height: Style.defaultIconSize
135 width: Style.defaultIconSize
136 name: message && message.isImportant ? Icons.StarredIcon : Icons.UnStarredIcon
137 color: message && message.isImportant ? "#f0e442" : "#888888"
138 anchors {
139 horizontalCenter: parent.horizontalCenter
140 top: parent.top
141 topMargin: units.gu(1.2)
142 }
143 }
144 onClicked: Client.markMessageImportant(message.messageId, !message.isImportant)
145 }
146
147 Row {
148 height: parent.height
149 anchors {
150 left: starIcon.right
151 right: parent.right
152 }
153 layoutDirection: Qt.RightToLeft
154 spacing: dekko.isSmallFF ? 0 : Style.smallSpacing
155
156 AbstractButton {
157 id: delBtn
158 height: parent.height
159 width: units.gu(4)
161 height: Style.defaultIconSize
162 width: Style.defaultIconSize
163 name: Icons.ContextMenuIcon
164 anchors {
165 horizontalCenter: parent.horizontalCenter
166 top: parent.top
167 topMargin: units.gu(1.2)
168 }
169 }
170 }
171
172 AbstractButton {
173 height: parent.height
174 width: units.gu(4)
176 height: Style.defaultIconSize
177 width: Style.defaultIconSize
178 name: Icons.MailForwardIcon
179 anchors {
180 horizontalCenter: parent.horizontalCenter
181 top: parent.top
182 topMargin: units.gu(1.2)
183 }
184 }
185 }
186 AbstractButton {
187 height: parent.height
188 width: units.gu(4)
190 height: Style.defaultIconSize
191 width: Style.defaultIconSize
192 name: Icons.MailReplyAllIcon
193 anchors {
194 horizontalCenter: parent.horizontalCenter
195 top: parent.top
196 topMargin: units.gu(1.2)
197 }
198 }
199 }
200 AbstractButton {
201 height: parent.height
202 width: units.gu(4)
204 height: Style.defaultIconSize
205 width: Style.defaultIconSize
206 name: Icons.MailReplyIcon
207 anchors {
208 horizontalCenter: parent.horizontalCenter
209 top: parent.top
210 topMargin: units.gu(1.2)
211 }
212 }
213 }
214 }
215 }
216 }
217 }
218
219 property alias msgId: message.messageId
220 Message {
221 id: message
222 onBodyChanged: {
223 console.log("MainPartUrl: ", body)
224 webview.setCidQuery(message.messageId)
225 webview.setBodyUrl(body)
226 }
227 }
228
229 Item {
230 clip: true
231 anchors {
232 left: parent.left
233 right: parent.right
234 top: pageHeader.bottom
235 bottom: parent.bottom
236 }
237 DekkoWebView {
238 id: webview
239 anchors {
240 fill: parent
241 leftMargin: !dekko.isSmallFF ? units.gu(1) : 0
242 }
243
244 url: "about:blank"
245 locationBarController.mode: 0 // ModeAuto
246 locationBarController.height: h.height
247 }
249 id: h
250 msg: message
251 width: parent.width
252 y: webview ? webview.locationBarController.offset : 0
253 }
254 }
255}
256