diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-02 16:01:15 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-02 16:01:15 +0200 |
commit | 74ef34dd42c2a780fbb7577a43e67f2b780d1b2c (patch) | |
tree | 294bb28ca182a541aeb0038e813649c188ebf673 | |
parent | d2b8c06df6d860a529bb37f5e6f4516d31f86fc2 (diff) | |
download | kube-74ef34dd42c2a780fbb7577a43e67f2b780d1b2c.tar.gz kube-74ef34dd42c2a780fbb7577a43e67f2b780d1b2c.zip |
Track the views and allow to go back to the view.
...also added the ComposerView that was forgotten
-rw-r--r-- | components/kube/contents/ui/ComposerView.qml | 36 | ||||
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 21 | ||||
-rw-r--r-- | framework/qml/FocusComposer.qml | 24 |
3 files changed, 69 insertions, 12 deletions
diff --git a/components/kube/contents/ui/ComposerView.qml b/components/kube/contents/ui/ComposerView.qml new file mode 100644 index 00000000..12b78544 --- /dev/null +++ b/components/kube/contents/ui/ComposerView.qml | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
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 along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | |||
21 | import QtQuick 2.7 | ||
22 | import org.kube.framework 1.0 as Kube | ||
23 | |||
24 | Item { | ||
25 | id:root | ||
26 | signal done | ||
27 | |||
28 | Kube.FocusComposer { | ||
29 | id: composer | ||
30 | anchors { | ||
31 | fill: parent | ||
32 | margins: Kube.Units.smallSpacing | ||
33 | } | ||
34 | onDone: root.done() | ||
35 | } | ||
36 | } | ||
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index 2d2ff4f5..54b18b7e 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml | |||
@@ -64,7 +64,7 @@ Controls2.ApplicationWindow { | |||
64 | Kube.Listener { | 64 | Kube.Listener { |
65 | filter: Kube.Messages.compose | 65 | filter: Kube.Messages.compose |
66 | onMessageReceived: { | 66 | onMessageReceived: { |
67 | composer.open() | 67 | kubeViews.currentIndex = 2 |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
@@ -159,7 +159,25 @@ Controls2.ApplicationWindow { | |||
159 | } | 159 | } |
160 | StackLayout { | 160 | StackLayout { |
161 | id: kubeViews | 161 | id: kubeViews |
162 | |||
163 | property var stack: [0] | ||
164 | |||
165 | function goToPreviousView() | ||
166 | { | ||
167 | //Pop off current view | ||
168 | stack.pop() | ||
169 | //Then go to the previous view | ||
170 | kubeViews.currentIndex = stack.pop() | ||
171 | } | ||
172 | |||
162 | currentIndex: 0 | 173 | currentIndex: 0 |
174 | onCurrentIndexChanged: { | ||
175 | if (stack.length > 100) { | ||
176 | //Cut off the first 50 once we grow to 100 (so we don't grow forever) | ||
177 | stack = stack.slice(50); | ||
178 | } | ||
179 | stack.push(currentIndex) | ||
180 | } | ||
163 | anchors { | 181 | anchors { |
164 | top: mainContent.top | 182 | top: mainContent.top |
165 | bottom: mainContent.bottom | 183 | bottom: mainContent.bottom |
@@ -173,6 +191,7 @@ Controls2.ApplicationWindow { | |||
173 | } | 191 | } |
174 | ComposerView { | 192 | ComposerView { |
175 | id: composerView | 193 | id: composerView |
194 | onDone: kubeViews.goToPreviousView() | ||
176 | } | 195 | } |
177 | } | 196 | } |
178 | } | 197 | } |
diff --git a/framework/qml/FocusComposer.qml b/framework/qml/FocusComposer.qml index a3bad1c9..2848711b 100644 --- a/framework/qml/FocusComposer.qml +++ b/framework/qml/FocusComposer.qml | |||
@@ -26,11 +26,14 @@ import org.kube.framework 1.0 as Kube | |||
26 | Item { | 26 | Item { |
27 | id: root | 27 | id: root |
28 | 28 | ||
29 | signal done | ||
30 | |||
29 | //Controller | 31 | //Controller |
30 | Kube.ComposerController { | 32 | Kube.ComposerController { |
31 | id: composerController | 33 | id: composerController |
32 | onDone: { | 34 | onDone: { |
33 | clear(); | 35 | clear(); |
36 | root.done() | ||
34 | } | 37 | } |
35 | } | 38 | } |
36 | 39 | ||
@@ -38,15 +41,15 @@ Item { | |||
38 | property variant sendAction: composerController.sendAction | 41 | property variant sendAction: composerController.sendAction |
39 | property variant saveAsDraftAction: composerController.saveAsDraftAction | 42 | property variant saveAsDraftAction: composerController.saveAsDraftAction |
40 | 43 | ||
41 | //FIXME | 44 | onDone: { |
42 | // onClosed: { | 45 | console.warn("focus composer done") |
43 | // composerController.clear() | 46 | composerController.clear() |
44 | // to.text = "" | 47 | to.text = "" |
45 | // cc.visible = false | 48 | cc.visible = false |
46 | // cc.text = "" | 49 | cc.text = "" |
47 | // bcc.visible = false | 50 | bcc.visible = false |
48 | // bcc.text = "" | 51 | bcc.text = "" |
49 | // } | 52 | } |
50 | 53 | ||
51 | //BEGIN functions | 54 | //BEGIN functions |
52 | function loadMessage(message, loadAsDraft) { | 55 | function loadMessage(message, loadAsDraft) { |
@@ -222,8 +225,7 @@ Item { | |||
222 | text: "Discard" | 225 | text: "Discard" |
223 | 226 | ||
224 | onClicked: { | 227 | onClicked: { |
225 | //FIXME | 228 | root.done() |
226 | // root.close() | ||
227 | } | 229 | } |
228 | } | 230 | } |
229 | 231 | ||