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 /components | |
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
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/contents/ui/ComposerView.qml | 36 | ||||
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 21 |
2 files changed, 56 insertions, 1 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 | } |