diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/contents/ui/AddresseeListEditor.qml | 15 | ||||
-rw-r--r-- | components/kube/contents/ui/ComposerView.qml | 51 |
2 files changed, 31 insertions, 35 deletions
diff --git a/components/kube/contents/ui/AddresseeListEditor.qml b/components/kube/contents/ui/AddresseeListEditor.qml index c6149d13..8f9862e7 100644 --- a/components/kube/contents/ui/AddresseeListEditor.qml +++ b/components/kube/contents/ui/AddresseeListEditor.qml | |||
@@ -26,11 +26,9 @@ import org.kube.framework 1.0 as Kube | |||
26 | 26 | ||
27 | FocusScope { | 27 | FocusScope { |
28 | id: root | 28 | id: root |
29 | property variant controller | ||
29 | property variant completer | 30 | property variant completer |
30 | property alias model: listView.model | 31 | property bool encrypt: false |
31 | |||
32 | signal added(string text) | ||
33 | signal removed(string text) | ||
34 | 32 | ||
35 | implicitHeight: listView.height + lineEdit.height | 33 | implicitHeight: listView.height + lineEdit.height |
36 | height: implicitHeight | 34 | height: implicitHeight |
@@ -48,6 +46,7 @@ FocusScope { | |||
48 | } | 46 | } |
49 | height: contentHeight | 47 | height: contentHeight |
50 | spacing: Kube.Units.smallSpacing | 48 | spacing: Kube.Units.smallSpacing |
49 | model: controller.model | ||
51 | delegate: Rectangle { | 50 | delegate: Rectangle { |
52 | height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 2 //smallSpacing for padding | 51 | height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 2 //smallSpacing for padding |
53 | width: parent.width | 52 | width: parent.width |
@@ -66,7 +65,7 @@ FocusScope { | |||
66 | anchors { | 65 | anchors { |
67 | top: parent.top | 66 | top: parent.top |
68 | } | 67 | } |
69 | text: model.addresseeName | 68 | text: model.name |
70 | elide: Text.ElideRight | 69 | elide: Text.ElideRight |
71 | } | 70 | } |
72 | Kube.Icon { | 71 | Kube.Icon { |
@@ -75,7 +74,7 @@ FocusScope { | |||
75 | } | 74 | } |
76 | height: Kube.Units.gridUnit | 75 | height: Kube.Units.gridUnit |
77 | width: height | 76 | width: height |
78 | visible: model.keyFound || model.keyMissing | 77 | visible: root.encrypt |
79 | iconName: model.keyFound ? Kube.Icons.secure: Kube.Icons.insecure | 78 | iconName: model.keyFound ? Kube.Icons.secure: Kube.Icons.insecure |
80 | } | 79 | } |
81 | } | 80 | } |
@@ -88,7 +87,7 @@ FocusScope { | |||
88 | } | 87 | } |
89 | height: Kube.Units.gridUnit | 88 | height: Kube.Units.gridUnit |
90 | width: height | 89 | width: height |
91 | onClicked: root.removed(model.addresseeName) | 90 | onClicked: root.controller.remove(model.id) |
92 | padding: 0 | 91 | padding: 0 |
93 | iconName: Kube.Icons.remove | 92 | iconName: Kube.Icons.remove |
94 | } | 93 | } |
@@ -123,7 +122,7 @@ FocusScope { | |||
123 | model: root.completer.model | 122 | model: root.completer.model |
124 | onSearchTermChanged: root.completer.searchString = searchTerm | 123 | onSearchTermChanged: root.completer.searchString = searchTerm |
125 | onAccepted: { | 124 | onAccepted: { |
126 | root.added(text); | 125 | root.controller.add({name: text}); |
127 | clear() | 126 | clear() |
128 | visible = false | 127 | visible = false |
129 | button.forceActiveFocus() | 128 | button.forceActiveFocus() |
diff --git a/components/kube/contents/ui/ComposerView.qml b/components/kube/contents/ui/ComposerView.qml index 0b81ab2a..2e0267d5 100644 --- a/components/kube/contents/ui/ComposerView.qml +++ b/components/kube/contents/ui/ComposerView.qml | |||
@@ -34,10 +34,6 @@ Kube.View { | |||
34 | property variant message: {} | 34 | property variant message: {} |
35 | property variant recipients: [] | 35 | property variant recipients: [] |
36 | 36 | ||
37 | //actions | ||
38 | property variant sendAction: composerController.sendAction | ||
39 | property variant saveAsDraftAction: composerController.saveAsDraftAction | ||
40 | |||
41 | resources: [ | 37 | resources: [ |
42 | Kube.ComposerController { | 38 | Kube.ComposerController { |
43 | id: composerController | 39 | id: composerController |
@@ -45,6 +41,11 @@ Kube.View { | |||
45 | sign: signCheckbox.checked | 41 | sign: signCheckbox.checked |
46 | encrypt: encryptCheckbox.checked | 42 | encrypt: encryptCheckbox.checked |
47 | onDone: Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) | 43 | onDone: Kube.Fabric.postMessage(Kube.Messages.componentDone, {}) |
44 | |||
45 | property bool foundAllKeys: to.foundAllKeys && cc.foundAllKeys && bcc.foundAllKeys | ||
46 | |||
47 | sendAction.enabled: composerController.accountId && composerController.subject && (!composerController.encrypt || composerController.foundAllKeys) && (!composerController.sign && !composerController.encrypt || composerController.foundPersonalKeys) | ||
48 | saveAsDraftAction.enabled: composerController.accountId | ||
48 | } | 49 | } |
49 | ] | 50 | ] |
50 | 51 | ||
@@ -67,7 +68,7 @@ Kube.View { | |||
67 | composerController.clear() | 68 | composerController.clear() |
68 | if (root.recipients) { | 69 | if (root.recipients) { |
69 | for (var i = 0; i < root.recipients.length; ++i) { | 70 | for (var i = 0; i < root.recipients.length; ++i) { |
70 | composerController.addTo(root.recipients[i]) | 71 | composerController.to.add({name: root.recipients[i]}) |
71 | } | 72 | } |
72 | } | 73 | } |
73 | subject.forceActiveFocus() | 74 | subject.forceActiveFocus() |
@@ -265,13 +266,13 @@ Kube.View { | |||
265 | clip: true | 266 | clip: true |
266 | 267 | ||
267 | Repeater { | 268 | Repeater { |
268 | model: composerController.attachmentModel | 269 | model: composerController.attachments.model |
269 | delegate: Kube.AttachmentDelegate { | 270 | delegate: Kube.AttachmentDelegate { |
270 | name: model.filename | 271 | name: model.filename |
271 | icon: model.iconName | 272 | icon: model.iconname |
272 | clip: true | 273 | clip: true |
273 | actionIcon: Kube.Icons.remove | 274 | actionIcon: Kube.Icons.remove |
274 | onExecute: composerController.removeAttachment(model.url) | 275 | onExecute: composerController.attachments.remove(model.id) |
275 | } | 276 | } |
276 | } | 277 | } |
277 | } | 278 | } |
@@ -338,7 +339,7 @@ Kube.View { | |||
338 | title: "Choose a file to attach" | 339 | title: "Choose a file to attach" |
339 | selectFolder: false | 340 | selectFolder: false |
340 | onAccepted: { | 341 | onAccepted: { |
341 | composerController.addAttachment(fileDialog.fileUrl) | 342 | composerController.attachments.add({url: fileDialog.fileUrl}) |
342 | } | 343 | } |
343 | } | 344 | } |
344 | } | 345 | } |
@@ -400,15 +401,13 @@ Kube.View { | |||
400 | } | 401 | } |
401 | 402 | ||
402 | AddresseeListEditor { | 403 | AddresseeListEditor { |
403 | id: to | 404 | Layout.preferredHeight: implicitHeight |
404 | Layout.preferredHeight: to.implicitHeight | ||
405 | Layout.fillWidth: true | 405 | Layout.fillWidth: true |
406 | focus: true | 406 | focus: true |
407 | activeFocusOnTab: true | 407 | activeFocusOnTab: true |
408 | encrypt: composerController.encrypt | ||
409 | controller: composerController.to | ||
408 | completer: composerController.recipientCompleter | 410 | completer: composerController.recipientCompleter |
409 | model: composerController.toModel | ||
410 | onAdded: composerController.addTo(text) | ||
411 | onRemoved: composerController.removeTo(text) | ||
412 | } | 411 | } |
413 | 412 | ||
414 | Kube.Label { | 413 | Kube.Label { |
@@ -419,10 +418,9 @@ Kube.View { | |||
419 | Layout.preferredHeight: cc.implicitHeight | 418 | Layout.preferredHeight: cc.implicitHeight |
420 | Layout.fillWidth: true | 419 | Layout.fillWidth: true |
421 | activeFocusOnTab: true | 420 | activeFocusOnTab: true |
421 | encrypt: composerController.encrypt | ||
422 | controller: composerController.cc | ||
422 | completer: composerController.recipientCompleter | 423 | completer: composerController.recipientCompleter |
423 | model: composerController.ccModel | ||
424 | onAdded: composerController.addCc(text) | ||
425 | onRemoved: composerController.removeCc(text) | ||
426 | } | 424 | } |
427 | 425 | ||
428 | Kube.Label { | 426 | Kube.Label { |
@@ -433,10 +431,9 @@ Kube.View { | |||
433 | Layout.preferredHeight: bcc.implicitHeight | 431 | Layout.preferredHeight: bcc.implicitHeight |
434 | Layout.fillWidth: true | 432 | Layout.fillWidth: true |
435 | activeFocusOnTab: true | 433 | activeFocusOnTab: true |
434 | encrypt: composerController.encrypt | ||
435 | controller: composerController.bcc | ||
436 | completer: composerController.recipientCompleter | 436 | completer: composerController.recipientCompleter |
437 | model: composerController.bccModel | ||
438 | onAdded: composerController.addBcc(text) | ||
439 | onRemoved: composerController.removeBcc(text) | ||
440 | } | 437 | } |
441 | Item { | 438 | Item { |
442 | width: parent.width | 439 | width: parent.width |
@@ -445,7 +442,7 @@ Kube.View { | |||
445 | } | 442 | } |
446 | 443 | ||
447 | RowLayout { | 444 | RowLayout { |
448 | enabled: composerController.encryptionAvailable | 445 | enabled: composerController.foundPersonalKeys |
449 | Kube.CheckBox { | 446 | Kube.CheckBox { |
450 | id: encryptCheckbox | 447 | id: encryptCheckbox |
451 | checked: composerController.encrypt | 448 | checked: composerController.encrypt |
@@ -456,7 +453,7 @@ Kube.View { | |||
456 | } | 453 | } |
457 | 454 | ||
458 | RowLayout { | 455 | RowLayout { |
459 | enabled: composerController.encryptionAvailable | 456 | enabled: composerController.foundPersonalKeys |
460 | Kube.CheckBox { | 457 | Kube.CheckBox { |
461 | id: signCheckbox | 458 | id: signCheckbox |
462 | checked: composerController.sign | 459 | checked: composerController.sign |
@@ -466,7 +463,7 @@ Kube.View { | |||
466 | } | 463 | } |
467 | } | 464 | } |
468 | Kube.Label { | 465 | Kube.Label { |
469 | visible: !composerController.encryptionAvailable | 466 | visible: !composerController.foundPersonalKeys |
470 | Layout.maximumWidth: parent.width | 467 | Layout.maximumWidth: parent.width |
471 | text: qsTr("Encryption is not available because your personal key has not been found.") | 468 | text: qsTr("Encryption is not available because your personal key has not been found.") |
472 | wrapMode: Text.Wrap | 469 | wrapMode: Text.Wrap |
@@ -487,9 +484,9 @@ Kube.View { | |||
487 | id: saveDraftButton | 484 | id: saveDraftButton |
488 | 485 | ||
489 | text: qsTr("Save as Draft") | 486 | text: qsTr("Save as Draft") |
490 | //TODO enabled: saveAsDraftAction.enabled | 487 | enabled: composerController.saveAsDraftAction.enabled |
491 | onClicked: { | 488 | onClicked: { |
492 | saveAsDraftAction.execute() | 489 | composerController.saveAsDraftAction.execute() |
493 | } | 490 | } |
494 | } | 491 | } |
495 | } | 492 | } |
@@ -522,9 +519,9 @@ Kube.View { | |||
522 | width: parent.width | 519 | width: parent.width |
523 | 520 | ||
524 | text: qsTr("Send") | 521 | text: qsTr("Send") |
525 | enabled: sendAction.enabled | 522 | enabled: composerController.sendAction.enabled |
526 | onClicked: { | 523 | onClicked: { |
527 | sendAction.execute() | 524 | composerController.sendAction.execute() |
528 | } | 525 | } |
529 | } | 526 | } |
530 | } | 527 | } |