diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-22 23:18:27 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-22 23:18:27 -0600 |
commit | 4cdb4c0bef0a52a9c3ae4b472d95fcba8197aa9c (patch) | |
tree | 0c0854a66d0ac165624de5abc56dd673614e6cd7 | |
parent | cfc09ac5f51837e231e79670dd46dc2f09a520b9 (diff) | |
download | kube-4cdb4c0bef0a52a9c3ae4b472d95fcba8197aa9c.tar.gz kube-4cdb4c0bef0a52a9c3ae4b472d95fcba8197aa9c.zip |
functions for pushing and replacing views
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index 5e4238bb..5a3d21df 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml | |||
@@ -215,31 +215,41 @@ Controls2.ApplicationWindow { | |||
215 | onMessageReceived: kubeViews.pop(Controls2.StackView.Immediate) | 215 | onMessageReceived: kubeViews.pop(Controls2.StackView.Immediate) |
216 | } | 216 | } |
217 | 217 | ||
218 | ///Replace the current view (we can't go back to the old view, and we destroy the old view) | ||
219 | function replaceView(view) { | ||
220 | if (currentItem != view) { | ||
221 | kubeViews.replace(null, view, {}, Controls2.StackView.Immediate) | ||
222 | } | ||
223 | } | ||
224 | |||
225 | ///Push a new view on the stack (the old view remains, and we can go back once done) | ||
226 | function pushView(view, properties) { | ||
227 | kubeViews.push(view, properties, Controls2.StackView.Immediate) | ||
228 | } | ||
229 | |||
218 | //TODO replacing here while a composer is open is destructive | 230 | //TODO replacing here while a composer is open is destructive |
219 | function setPeopleView() { | 231 | function setPeopleView() { |
220 | if (currentItem != peopleView) { | 232 | replaceView(peopleView) |
221 | kubeViews.replace(null, peopleView, Controls2.StackView.Immediate) | ||
222 | } | ||
223 | } | 233 | } |
234 | |||
224 | function setMailView() { | 235 | function setMailView() { |
225 | if (currentItem != mailView) { | 236 | replaceView(mailView) |
226 | kubeViews.replace(null, mailView, Controls2.StackView.Immediate) | ||
227 | } | ||
228 | } | 237 | } |
238 | |||
229 | function setAccountsView() { | 239 | function setAccountsView() { |
230 | kubeViews.push(accountsView, {}, Controls2.StackView.Immediate) | 240 | pushView(accountsView, {}) |
231 | } | 241 | } |
242 | |||
232 | function setLogView() { | 243 | function setLogView() { |
233 | if (currentItem != logView) { | 244 | replaceView(logView) |
234 | kubeViews.replace(null, logView, Controls2.StackView.Immediate) | ||
235 | } | ||
236 | } | 245 | } |
237 | 246 | ||
238 | function openComposer(newMessage, recipients) { | 247 | function openComposer(newMessage, recipients) { |
239 | kubeViews.push(composerView, {newMessage: newMessage, recipients: recipients}, Controls2.StackView.Immediate) | 248 | pushView(composerView, {newMessage: newMessage, recipients: recipients}) |
240 | } | 249 | } |
250 | |||
241 | function openComposerWithMail(mail, openAsDraft) { | 251 | function openComposerWithMail(mail, openAsDraft) { |
242 | kubeViews.push(composerView, {message: mail, loadAsDraft: openAsDraft}, Controls2.StackView.Immediate) | 252 | pushView(composerView, {message: mail, loadAsDraft: openAsDraft}) |
243 | } | 253 | } |
244 | 254 | ||
245 | onCurrentItemChanged: { | 255 | onCurrentItemChanged: { |