diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-10 15:53:06 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-10 15:53:06 +0200 |
commit | df10583b42f49a58d27dd6dd322f22fd88ce1418 (patch) | |
tree | 34c2dc39c47b60ebc28130985ac976172da478ad /components | |
parent | 6e76e328b2adbc20bd2da6628a7f57aaa7afe5b1 (diff) | |
download | kube-df10583b42f49a58d27dd6dd322f22fd88ce1418.tar.gz kube-df10583b42f49a58d27dd6dd322f22fd88ce1418.zip |
Support for loading drafts
Diffstat (limited to 'components')
-rw-r--r-- | components/mail/contents/ui/main.qml | 29 | ||||
-rw-r--r-- | components/package/contents/ui/Composer.qml | 15 | ||||
-rw-r--r-- | components/package/contents/ui/FocusComposer.qml | 2 | ||||
-rw-r--r-- | components/package/contents/ui/MailListView.qml | 7 |
4 files changed, 50 insertions, 3 deletions
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 15a2b0b8..c2569cdc 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml | |||
@@ -38,7 +38,9 @@ ApplicationWindow { | |||
38 | KubeAction.Context { | 38 | KubeAction.Context { |
39 | id: maillistcontext | 39 | id: maillistcontext |
40 | property variant mail | 40 | property variant mail |
41 | property bool isDraft | ||
41 | mail: mailListView.currentMail | 42 | mail: mailListView.currentMail |
43 | isDraft: mailListView.isDraft | ||
42 | } | 44 | } |
43 | 45 | ||
44 | KubeAction.Context { | 46 | KubeAction.Context { |
@@ -54,6 +56,12 @@ ApplicationWindow { | |||
54 | } | 56 | } |
55 | 57 | ||
56 | KubeAction.Action { | 58 | KubeAction.Action { |
59 | id: editAction | ||
60 | actionId: "org.kde.kube.actions.edit" | ||
61 | context: maillistcontext | ||
62 | } | ||
63 | |||
64 | KubeAction.Action { | ||
57 | id: markAsReadAction | 65 | id: markAsReadAction |
58 | actionId: "org.kde.kube.actions.mark-as-read" | 66 | actionId: "org.kde.kube.actions.mark-as-read" |
59 | context: maillistcontext | 67 | context: maillistcontext |
@@ -180,6 +188,17 @@ ApplicationWindow { | |||
180 | } | 188 | } |
181 | } | 189 | } |
182 | 190 | ||
191 | KubeAction.ActionHandler { | ||
192 | actionId: "org.kde.kube.actions.edit" | ||
193 | function isReady(context) { | ||
194 | return context.mail && context.isDraft; | ||
195 | } | ||
196 | |||
197 | function handler(context) { | ||
198 | composerComponent.createObject(app, {"draftMessage": context.mail}) | ||
199 | } | ||
200 | } | ||
201 | |||
183 | ToolButton { | 202 | ToolButton { |
184 | id: newMailButton | 203 | id: newMailButton |
185 | 204 | ||
@@ -202,6 +221,16 @@ ApplicationWindow { | |||
202 | } | 221 | } |
203 | } | 222 | } |
204 | 223 | ||
224 | ToolButton { | ||
225 | Layout.fillHeight: true | ||
226 | iconName: "mail-message-edit" | ||
227 | text: "Edit" | ||
228 | enabled: editAction.ready | ||
229 | onClicked: { | ||
230 | editAction.execute() | ||
231 | } | ||
232 | } | ||
233 | |||
205 | Item { | 234 | Item { |
206 | Layout.fillWidth: true | 235 | Layout.fillWidth: true |
207 | } | 236 | } |
diff --git a/components/package/contents/ui/Composer.qml b/components/package/contents/ui/Composer.qml index 8c6f9c77..ed8fb2f2 100644 --- a/components/package/contents/ui/Composer.qml +++ b/components/package/contents/ui/Composer.qml | |||
@@ -26,6 +26,7 @@ import org.kube.framework.domain 1.0 as KubeFramework | |||
26 | Item { | 26 | Item { |
27 | id: root | 27 | id: root |
28 | property variant originalMessage | 28 | property variant originalMessage |
29 | property variant draftMessage | ||
29 | 30 | ||
30 | function send() { | 31 | function send() { |
31 | composer.send() | 32 | composer.send() |
@@ -40,17 +41,25 @@ Item { | |||
40 | } | 41 | } |
41 | 42 | ||
42 | KubeFramework.Retriever { | 43 | KubeFramework.Retriever { |
43 | id: retriever | 44 | id: originalMessageRetriever |
44 | propertyName: "mimeMessage" | 45 | propertyName: "mimeMessage" |
45 | model: KubeFramework.MailListModel { | 46 | model: KubeFramework.MailListModel { |
46 | id: mailListModel | ||
47 | mail: root.originalMessage | 47 | mail: root.originalMessage |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | KubeFramework.Retriever { | ||
52 | id: draftMessageRetriever | ||
53 | propertyName: "mimeMessage" | ||
54 | model: KubeFramework.MailListModel { | ||
55 | mail: root.draftMessage | ||
56 | } | ||
57 | } | ||
58 | |||
51 | KubeFramework.ComposerController { | 59 | KubeFramework.ComposerController { |
52 | id: composer | 60 | id: composer |
53 | originalMessage: retriever.value | 61 | originalMessage: originalMessageRetriever.value |
62 | draftMessage: draftMessageRetriever.value | ||
54 | } | 63 | } |
55 | 64 | ||
56 | ColumnLayout { | 65 | ColumnLayout { |
diff --git a/components/package/contents/ui/FocusComposer.qml b/components/package/contents/ui/FocusComposer.qml index 1cd3cb32..4e61b6c1 100644 --- a/components/package/contents/ui/FocusComposer.qml +++ b/components/package/contents/ui/FocusComposer.qml | |||
@@ -24,6 +24,7 @@ import org.kube.framework.theme 1.0 | |||
24 | Rectangle { | 24 | Rectangle { |
25 | id: root | 25 | id: root |
26 | property variant originalMessage | 26 | property variant originalMessage |
27 | property variant draftMessage | ||
27 | 28 | ||
28 | color: ColorPalette.border | 29 | color: ColorPalette.border |
29 | 30 | ||
@@ -62,6 +63,7 @@ Rectangle { | |||
62 | Layout.fillWidth: true | 63 | Layout.fillWidth: true |
63 | Layout.fillHeight: true | 64 | Layout.fillHeight: true |
64 | originalMessage: root.originalMessage | 65 | originalMessage: root.originalMessage |
66 | draftMessage: root.draftMessage | ||
65 | } | 67 | } |
66 | 68 | ||
67 | RowLayout { | 69 | RowLayout { |
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml index 12d6c705..9caaa9ce 100644 --- a/components/package/contents/ui/MailListView.qml +++ b/components/package/contents/ui/MailListView.qml | |||
@@ -29,6 +29,7 @@ Controls.ScrollView { | |||
29 | id: root | 29 | id: root |
30 | property variant parentFolder | 30 | property variant parentFolder |
31 | property variant currentMail | 31 | property variant currentMail |
32 | property bool isDraft : false | ||
32 | 33 | ||
33 | ListView { | 34 | ListView { |
34 | id: listView | 35 | id: listView |
@@ -69,6 +70,12 @@ Controls.ScrollView { | |||
69 | when: listView.currentIndex == index | 70 | when: listView.currentIndex == index |
70 | value: model.domainObject | 71 | value: model.domainObject |
71 | } | 72 | } |
73 | QtQml.Binding { | ||
74 | target: root | ||
75 | property: "isDraft" | ||
76 | when: listView.currentIndex == index | ||
77 | value: model.draft | ||
78 | } | ||
72 | 79 | ||
73 | RowLayout { | 80 | RowLayout { |
74 | 81 | ||