From 74ef34dd42c2a780fbb7577a43e67f2b780d1b2c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 2 May 2017 16:01:15 +0200 Subject: Track the views and allow to go back to the view. ...also added the ComposerView that was forgotten --- components/kube/contents/ui/ComposerView.qml | 36 ++++++++++++++++++++++++++++ components/kube/contents/ui/Kube.qml | 21 +++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 components/kube/contents/ui/ComposerView.qml (limited to 'components') 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 @@ +/* + * Copyright (C) 2017 Michael Bohlender, + * Copyright (C) 2017 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +import QtQuick 2.7 +import org.kube.framework 1.0 as Kube + +Item { + id:root + signal done + + Kube.FocusComposer { + id: composer + anchors { + fill: parent + margins: Kube.Units.smallSpacing + } + onDone: root.done() + } +} 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 { Kube.Listener { filter: Kube.Messages.compose onMessageReceived: { - composer.open() + kubeViews.currentIndex = 2 } } @@ -159,7 +159,25 @@ Controls2.ApplicationWindow { } StackLayout { id: kubeViews + + property var stack: [0] + + function goToPreviousView() + { + //Pop off current view + stack.pop() + //Then go to the previous view + kubeViews.currentIndex = stack.pop() + } + currentIndex: 0 + onCurrentIndexChanged: { + if (stack.length > 100) { + //Cut off the first 50 once we grow to 100 (so we don't grow forever) + stack = stack.slice(50); + } + stack.push(currentIndex) + } anchors { top: mainContent.top bottom: mainContent.bottom @@ -173,6 +191,7 @@ Controls2.ApplicationWindow { } ComposerView { id: composerView + onDone: kubeViews.goToPreviousView() } } } -- cgit v1.2.3