diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 12:00:31 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 13:09:00 +0200 |
commit | 966d85717c115cc03f2d1b0f41a24fd363726027 (patch) | |
tree | fa9e0f2c1cf65fbaa444988e2c26ec9b455fab90 /framework/qml/ConversationView.qml | |
parent | 5d529c9252c386abaa76ec1a981ff99f50ce3dc0 (diff) | |
download | kube-966d85717c115cc03f2d1b0f41a24fd363726027.tar.gz kube-966d85717c115cc03f2d1b0f41a24fd363726027.zip |
All of the MailViewer in one place
Diffstat (limited to 'framework/qml/ConversationView.qml')
-rw-r--r-- | framework/qml/ConversationView.qml | 342 |
1 files changed, 13 insertions, 329 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index 5850d2c7..f59704d0 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml | |||
@@ -207,339 +207,23 @@ Rectangle { | |||
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | Rectangle { | 210 | MailViewer { |
211 | id: sheet | 211 | id: sheet |
212 | anchors.centerIn: parent | 212 | anchors.centerIn: parent |
213 | implicitHeight: header.height + attachments.height + body.height + incompleteBody.height + footer.height + Kube.Units.largeSpacing | ||
214 | width: parent.width - Kube.Units.gridUnit * 2 | 213 | width: parent.width - Kube.Units.gridUnit * 2 |
215 | 214 | ||
216 | //Overlay for non-active mails | 215 | message: model.mimeMessage |
217 | Rectangle { | 216 | subject: model.subject |
218 | anchors.fill: parent | 217 | sender: model.sender |
219 | visible: !wrapper.isCurrent | 218 | senderName: model.senderName |
220 | color: "lightGrey" | 219 | to: model.to |
221 | z: 1 | 220 | cc: model.cc |
222 | opacity: 0.2 | 221 | bcc: model.bcc |
223 | } | 222 | date: model.date |
224 | 223 | trash: model.trash | |
225 | color: Kube.Colors.viewBackgroundColor | 224 | draft: model.draft |
226 | 225 | sent: model.sent | |
227 | //BEGIN header | 226 | incomplete: model.incomplete |
228 | Item { | ||
229 | id: header | ||
230 | |||
231 | anchors { | ||
232 | top: parent.top | ||
233 | left: parent.left | ||
234 | right: parent.right | ||
235 | margins: Kube.Units.largeSpacing | ||
236 | } | ||
237 | |||
238 | height: headerContent.height + Kube.Units.smallSpacing | ||
239 | |||
240 | states: [ | ||
241 | State { | ||
242 | name: "small" | ||
243 | PropertyChanges { target: subject; wrapMode: Text.NoWrap} | ||
244 | PropertyChanges { target: recipients; visible: true} | ||
245 | PropertyChanges { target: to; visible: false} | ||
246 | PropertyChanges { target: cc; visible: false} | ||
247 | PropertyChanges { target: bcc; visible: false} | ||
248 | }, | ||
249 | State { | ||
250 | name: "details" | ||
251 | PropertyChanges { target: subject; wrapMode: Text.WrapAnywhere} | ||
252 | PropertyChanges { target: recipients; visible: false} | ||
253 | PropertyChanges { target: to; visible: true} | ||
254 | PropertyChanges { target: cc; visible: true} | ||
255 | PropertyChanges { target: bcc; visible: true} | ||
256 | } | ||
257 | ] | ||
258 | |||
259 | state: "small" | ||
260 | |||
261 | Kube.Label { | ||
262 | id: date_label | ||
263 | |||
264 | anchors { | ||
265 | right: seperator.right | ||
266 | top: parent.top | ||
267 | } | ||
268 | |||
269 | text: Qt.formatDateTime(model.date, "dd MMM yyyy hh:mm") | ||
270 | |||
271 | font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.7 | ||
272 | opacity: 0.75 | ||
273 | } | ||
274 | |||
275 | Column { | ||
276 | id: headerContent | ||
277 | |||
278 | anchors { | ||
279 | //left: to_l.right | ||
280 | horizontalCenter: parent.horizontalCenter | ||
281 | } | ||
282 | |||
283 | //spacing: Kube.Units.smallSpacing | ||
284 | |||
285 | width: parent.width | ||
286 | |||
287 | Row{ | ||
288 | id: from | ||
289 | |||
290 | width: parent.width | ||
291 | |||
292 | spacing: Kube.Units.smallSpacing | ||
293 | clip: true | ||
294 | |||
295 | Kube.Label { | ||
296 | id: senderName | ||
297 | |||
298 | text: model.senderName | ||
299 | font.weight: Font.DemiBold | ||
300 | opacity: 0.75 | ||
301 | } | ||
302 | |||
303 | Kube.Label { | ||
304 | width: parent.width - senderName.width - date_label.width - Kube.Units.largeSpacing | ||
305 | |||
306 | |||
307 | text: model.sender | ||
308 | elide: Text.ElideRight | ||
309 | opacity: 0.75 | ||
310 | clip: true | ||
311 | } | ||
312 | } | ||
313 | |||
314 | Kube.Label { | ||
315 | id: subject | ||
316 | |||
317 | width: to.width | ||
318 | |||
319 | text: model.subject | ||
320 | elide: Text.ElideRight | ||
321 | opacity: 0.75 | ||
322 | font.italic: true | ||
323 | states: [ | ||
324 | State { | ||
325 | name: "trash"; when: model.trash | ||
326 | PropertyChanges { target: subject; text: "Trash: " + model.subject } | ||
327 | }, | ||
328 | State { | ||
329 | name: "draft"; when: model.draft | ||
330 | PropertyChanges { target: subject; text: "Draft: " + model.subject } | ||
331 | }, | ||
332 | State { | ||
333 | name: "sent"; when: model.sent | ||
334 | PropertyChanges { target: subject; text: "Sent: " + model.subject } | ||
335 | } | ||
336 | ] | ||
337 | } | ||
338 | |||
339 | Kube.Label { | ||
340 | id: recipients | ||
341 | |||
342 | width: parent.width - goDown.width - Kube.Units.smallSpacing | ||
343 | |||
344 | text:"to: "+ model.to + " " + model.cc + " " + model.bcc | ||
345 | elide: Text.ElideRight | ||
346 | opacity: 0.75 | ||
347 | } | ||
348 | |||
349 | Kube.Label { | ||
350 | id: to | ||
351 | |||
352 | width: parent.width - goDown.width - Kube.Units.smallSpacing | ||
353 | |||
354 | text:"to: " + model.to | ||
355 | wrapMode: Text.WordWrap | ||
356 | opacity: 0.75 | ||
357 | } | ||
358 | |||
359 | Kube.Label { | ||
360 | id: cc | ||
361 | |||
362 | width: parent.width - goDown.width - Kube.Units.smallSpacing | ||
363 | |||
364 | text:"cc: " + model.cc | ||
365 | wrapMode: Text.WordWrap | ||
366 | opacity: 0.75 | ||
367 | } | ||
368 | |||
369 | Kube.Label { | ||
370 | id: bcc | ||
371 | |||
372 | width: parent.width - goDown.width - Kube.Units.smallSpacing | ||
373 | |||
374 | text:"bcc: " + model.bcc | ||
375 | wrapMode: Text.WordWrap | ||
376 | opacity: 0.75 | ||
377 | } | ||
378 | |||
379 | } | ||
380 | |||
381 | Rectangle { | ||
382 | id: goDown | ||
383 | |||
384 | anchors { | ||
385 | bottom: seperator.top | ||
386 | right: seperator.right | ||
387 | } | ||
388 | |||
389 | height: Kube.Units.gridUnit | ||
390 | width: height | ||
391 | |||
392 | color: Kube.Colors.backgroundColor | ||
393 | |||
394 | Controls1.ToolButton { | ||
395 | anchors.fill: parent | ||
396 | |||
397 | iconName: header.state === "details" ? Kube.Icons.goUp : Kube.Icons.goDown | ||
398 | |||
399 | onClicked: { | ||
400 | header.state === "details" ? header.state = "small" : header.state = "details" | ||
401 | } | ||
402 | } | ||
403 | } | ||
404 | |||
405 | Rectangle { | ||
406 | id: seperator | ||
407 | |||
408 | anchors { | ||
409 | left: parent.left | ||
410 | right: parent.right | ||
411 | bottom: parent.bottom | ||
412 | } | ||
413 | |||
414 | height: 1 | ||
415 | |||
416 | color: Kube.Colors.textColor | ||
417 | opacity: 0.5 | ||
418 | } | ||
419 | } | ||
420 | //END header | ||
421 | |||
422 | Flow { | ||
423 | id: attachments | ||
424 | |||
425 | anchors { | ||
426 | top: header.bottom | ||
427 | topMargin: Kube.Units.smallSpacing | ||
428 | right: header.right | ||
429 | } | ||
430 | |||
431 | width: header.width - Kube.Units.largeSpacing | ||
432 | |||
433 | layoutDirection: Qt.RightToLeft | ||
434 | spacing: Kube.Units.smallSpacing | ||
435 | clip: true | ||
436 | |||
437 | Repeater { | ||
438 | model: body.attachments | ||
439 | |||
440 | delegate: AttachmentDelegate { | ||
441 | name: model.name | ||
442 | icon: "mail-attachment" | ||
443 | |||
444 | clip: true | ||
445 | |||
446 | //TODO size encrypted signed type | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | |||
451 | MailViewer { | ||
452 | id: body | ||
453 | |||
454 | anchors { | ||
455 | top: header.bottom | ||
456 | left: header.left | ||
457 | right: header.right | ||
458 | leftMargin: Kube.Units.largeSpacing | ||
459 | rightMargin: Kube.Units.largeSpacing | ||
460 | topMargin: Math.max(attachments.height, Kube.Units.largeSpacing) | ||
461 | } | ||
462 | |||
463 | width: header.width - Kube.Units.largeSpacing * 2 | ||
464 | height: desiredHeight | ||
465 | |||
466 | message: model.mimeMessage | ||
467 | visible: !model.incomplete | ||
468 | } | ||
469 | |||
470 | Kube.Label { | ||
471 | id: incompleteBody | ||
472 | anchors { | ||
473 | top: header.bottom | ||
474 | left: header.left | ||
475 | right: header.right | ||
476 | leftMargin: Kube.Units.largeSpacing | ||
477 | rightMargin: Kube.Units.largeSpacing | ||
478 | topMargin: Math.max(attachments.height, Kube.Units.largeSpacing) | ||
479 | } | ||
480 | visible: model.incomplete | ||
481 | text: "Incomplete body..." | ||
482 | color: Kube.Colors.textColor | ||
483 | enabled: false | ||
484 | states: [ | ||
485 | State { | ||
486 | name: "inprogress"; when: model.status == Kube.MailListModel.InProgressStatus | ||
487 | PropertyChanges { target: incompleteBody; text: "Downloading message..." } | ||
488 | }, | ||
489 | State { | ||
490 | name: "error"; when: model.status == Kube.MailListModel.ErrorStatus | ||
491 | PropertyChanges { target: incompleteBody; text: "Failed to download message..." } | ||
492 | } | ||
493 | ] | ||
494 | } | ||
495 | Item { | ||
496 | id: footer | ||
497 | |||
498 | anchors.bottom: parent.bottom | ||
499 | |||
500 | height: Kube.Units.gridUnit * 2 | ||
501 | width: parent.width | ||
502 | |||
503 | Kube.Label { | ||
504 | anchors{ | ||
505 | verticalCenter: parent.verticalCenter | ||
506 | left: parent.left | ||
507 | leftMargin: Kube.Units.largeSpacing | ||
508 | } | ||
509 | |||
510 | text: model.trash ? qsTr("Delete Mail") : qsTr("Move to trash") | ||
511 | opacity: 0.5 | ||
512 | MouseArea { | ||
513 | anchors.fill: parent | ||
514 | enabled: parent.enabled | ||
515 | onClicked: { | ||
516 | if (model.trash) { | ||
517 | Kube.Fabric.postMessage(Kube.Messages.remove, {"mail": model.mail}) | ||
518 | } else { | ||
519 | Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) | ||
520 | } | ||
521 | } | ||
522 | } | ||
523 | } | ||
524 | |||
525 | Controls1.ToolButton { | ||
526 | visible: !model.trash | ||
527 | anchors{ | ||
528 | verticalCenter: parent.verticalCenter | ||
529 | right: parent.right | ||
530 | rightMargin: Kube.Units.largeSpacing | ||
531 | } | ||
532 | |||
533 | iconName: model.draft ? Kube.Icons.edit : Kube.Icons.replyToSender | ||
534 | onClicked: { | ||
535 | if (model.draft) { | ||
536 | Kube.Fabric.postMessage(Kube.Messages.edit, {"mail": model.mail, "isDraft": model.draft}) | ||
537 | } else { | ||
538 | Kube.Fabric.postMessage(Kube.Messages.reply, {"mail": model.mail, "isDraft": model.draft}) | ||
539 | } | ||
540 | } | ||
541 | } | ||
542 | } | ||
543 | } | 227 | } |
544 | } | 228 | } |
545 | } | 229 | } |