summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/kube/contents/ui/Kube.qml57
-rw-r--r--framework/qml/FocusComposer.qml15
2 files changed, 26 insertions, 46 deletions
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml
index 54b18b7e..72e74d71 100644
--- a/components/kube/contents/ui/Kube.qml
+++ b/components/kube/contents/ui/Kube.qml
@@ -63,9 +63,7 @@ Controls2.ApplicationWindow {
63 63
64 Kube.Listener { 64 Kube.Listener {
65 filter: Kube.Messages.compose 65 filter: Kube.Messages.compose
66 onMessageReceived: { 66 onMessageReceived: kubeViews.openComposer()
67 kubeViews.currentIndex = 2
68 }
69 } 67 }
70 68
71 //BEGIN Shortcuts 69 //BEGIN Shortcuts
@@ -127,18 +125,12 @@ Controls2.ApplicationWindow {
127 125
128 Kube.IconButton { 126 Kube.IconButton {
129 iconName: Kube.Icons.mail_inverted 127 iconName: Kube.Icons.mail_inverted
130 128 onClicked: kubeViews.setMailView()
131 onClicked: {
132 kubeViews.currentIndex = 0
133 }
134 } 129 }
135 130
136 Kube.IconButton { 131 Kube.IconButton {
137 iconName: Kube.Icons.user_inverted 132 iconName: Kube.Icons.user_inverted
138 133 onClicked: kubeViews.setPeopleView()
139 onClicked: {
140 kubeViews.currentIndex = 1
141 }
142 } 134 }
143 } 135 }
144 Column { 136 Column {
@@ -157,41 +149,42 @@ Controls2.ApplicationWindow {
157 Kube.AccountSwitcher {} 149 Kube.AccountSwitcher {}
158 } 150 }
159 } 151 }
160 StackLayout { 152 StackView {
161 id: kubeViews 153 id: kubeViews
162 154
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
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 }
181 anchors { 155 anchors {
182 top: mainContent.top 156 top: mainContent.top
183 bottom: mainContent.bottom 157 bottom: mainContent.bottom
184 } 158 }
185 Layout.fillWidth: true 159 Layout.fillWidth: true
160 initialItem: mailView
161
162 function setPeopleView() {
163 //TODO replacing here while a composer is open is destructive
164 kubeViews.push({item: peopleView, replace: true, immediate: true})
165 }
166 function setMailView() {
167 //TODO replacing here while a composer is open is destructive
168 kubeViews.push({item: mailView, replace: true, immediate: true})
169 }
170 function openComposer() {
171 kubeViews.push({item: composerView, immediate: true})
172 }
173
174
175 //Not components so we maintain state
186 MailView { 176 MailView {
187 id: mailView 177 id: mailView
188 } 178 }
189 PeopleView { 179 PeopleView {
190 id: peopleView 180 id: peopleView
191 } 181 }
192 ComposerView { 182 //A component so it's always destroyed when we're done
183 Component {
193 id: composerView 184 id: composerView
194 onDone: kubeViews.goToPreviousView() 185 ComposerView {
186 onDone: kubeViews.pop({immediate: true})
187 }
195 } 188 }
196 } 189 }
197 } 190 }
diff --git a/framework/qml/FocusComposer.qml b/framework/qml/FocusComposer.qml
index 2848711b..5179cc66 100644
--- a/framework/qml/FocusComposer.qml
+++ b/framework/qml/FocusComposer.qml
@@ -31,26 +31,13 @@ Item {
31 //Controller 31 //Controller
32 Kube.ComposerController { 32 Kube.ComposerController {
33 id: composerController 33 id: composerController
34 onDone: { 34 onDone: root.done()
35 clear();
36 root.done()
37 }
38 } 35 }
39 36
40 //actions 37 //actions
41 property variant sendAction: composerController.sendAction 38 property variant sendAction: composerController.sendAction
42 property variant saveAsDraftAction: composerController.saveAsDraftAction 39 property variant saveAsDraftAction: composerController.saveAsDraftAction
43 40
44 onDone: {
45 console.warn("focus composer done")
46 composerController.clear()
47 to.text = ""
48 cc.visible = false
49 cc.text = ""
50 bcc.visible = false
51 bcc.text = ""
52 }
53
54 //BEGIN functions 41 //BEGIN functions
55 function loadMessage(message, loadAsDraft) { 42 function loadMessage(message, loadAsDraft) {
56 composerController.loadMessage(message, loadAsDraft) 43 composerController.loadMessage(message, loadAsDraft)