diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-06-08 14:09:45 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-06-08 15:32:06 +0200 |
commit | c070e4527728ae9dd90131c98164587a88a93ca4 (patch) | |
tree | bbacd7c02bd132119881f9f8d2fd6a94ad0ef94f | |
parent | d97715f71c04c22a8803472dd48a9e9ef2a1f53b (diff) | |
download | kube-c070e4527728ae9dd90131c98164587a88a93ca4.tar.gz kube-c070e4527728ae9dd90131c98164587a88a93ca4.zip |
Fixed the ghost icon issue and moved to Controls2.StackView
The icon stemmed from the people-view toolbar.
I suppose because the item was not properly hidden but still existing.
-rw-r--r-- | components/kube/contents/ui/Kube.qml | 54 | ||||
-rw-r--r-- | framework/qml/People.qml | 23 |
2 files changed, 47 insertions, 30 deletions
diff --git a/components/kube/contents/ui/Kube.qml b/components/kube/contents/ui/Kube.qml index 54a81112..92f12f6c 100644 --- a/components/kube/contents/ui/Kube.qml +++ b/components/kube/contents/ui/Kube.qml | |||
@@ -159,7 +159,7 @@ Controls2.ApplicationWindow { | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | } | 161 | } |
162 | StackView { | 162 | Controls2.StackView { |
163 | id: kubeViews | 163 | id: kubeViews |
164 | 164 | ||
165 | anchors { | 165 | anchors { |
@@ -174,38 +174,52 @@ Controls2.ApplicationWindow { | |||
174 | onMessageReceived: kubeViews.pop({immediate: true}) | 174 | onMessageReceived: kubeViews.pop({immediate: true}) |
175 | } | 175 | } |
176 | 176 | ||
177 | //TODO replacing here while a composer is open is destructive | ||
177 | function setPeopleView() { | 178 | function setPeopleView() { |
178 | //TODO replacing here while a composer is open is destructive | 179 | if (currentItem != peopleView) { |
179 | kubeViews.push({item: peopleView, replace: true, immediate: true}) | 180 | kubeViews.replace(null, peopleView, Controls2.StackView.Immediate) |
181 | } | ||
180 | } | 182 | } |
181 | function setMailView() { | 183 | function setMailView() { |
182 | //TODO replacing here while a composer is open is destructive | 184 | if (currentItem != mailView) { |
183 | kubeViews.push({item: mailView, replace: true, immediate: true}) | 185 | kubeViews.replace(null, mailView, Controls2.StackView.Immediate) |
186 | } | ||
184 | } | 187 | } |
185 | function setAccountsView() { | 188 | function setAccountsView() { |
186 | kubeViews.push({item: accountsView, replace: true, immediate: true}) | 189 | if (currentItem != accountsView) { |
190 | kubeViews.replace(null, accountsView, Controls2.StackView.Immediate) | ||
191 | } | ||
187 | } | 192 | } |
188 | function setLogView() { | 193 | function setLogView() { |
189 | kubeViews.push({item: logView, replace: true, immediate: true}) | 194 | if (currentItem != logView) { |
195 | kubeViews.replace(null, logView, Controls2.StackView.Immediate) | ||
196 | } | ||
190 | } | 197 | } |
191 | 198 | ||
192 | function openComposer(newMessage) { | 199 | function openComposer(newMessage) { |
193 | kubeViews.push({item: composerView, immediate: true, properties: {newMessage: newMessage}}) | 200 | kubeViews.push(composerView, {newMessage: newMessage}, Controls2.StackView.Immediate) |
194 | } | 201 | } |
195 | function openComposerWithMail(mail, openAsDraft) { | 202 | function openComposerWithMail(mail, openAsDraft) { |
196 | kubeViews.push({item: composerView, immediate: true, properties: {message: mail, loadAsDraft: openAsDraft}}) | 203 | kubeViews.push(composerView, {message: mail, loadAsDraft: openAsDraft}, Controls2.StackView.Immediate) |
197 | } | ||
198 | //Not components so we maintain state | ||
199 | MailView { | ||
200 | id: mailView | ||
201 | } | ||
202 | PeopleView { | ||
203 | id: peopleView | ||
204 | } | ||
205 | //Not a component because otherwise we can't log stuff | ||
206 | LogView { | ||
207 | id: logView | ||
208 | } | 204 | } |
205 | |||
206 | //These items are not visible until pushed onto the stack, so we keep them in resources instead of items | ||
207 | resources: [ | ||
208 | //Not components so we maintain state | ||
209 | MailView { | ||
210 | id: mailView | ||
211 | anchors.fill: parent | ||
212 | }, | ||
213 | PeopleView { | ||
214 | id: peopleView | ||
215 | anchors.fill: parent | ||
216 | }, | ||
217 | //Not a component because otherwise we can't log stuff | ||
218 | LogView { | ||
219 | id: logView | ||
220 | anchors.fill: parent | ||
221 | } | ||
222 | ] | ||
209 | //A component so it's always destroyed when we're done | 223 | //A component so it's always destroyed when we're done |
210 | Component { | 224 | Component { |
211 | id: composerView | 225 | id: composerView |
diff --git a/framework/qml/People.qml b/framework/qml/People.qml index 58aa340c..fc41ceaf 100644 --- a/framework/qml/People.qml +++ b/framework/qml/People.qml | |||
@@ -44,33 +44,36 @@ Item { | |||
44 | 44 | ||
45 | Item { | 45 | Item { |
46 | id: toolbar | 46 | id: toolbar |
47 | anchors { | ||
48 | top: parent.top | ||
49 | horizontalCenter: parent.horizontalCenter | ||
50 | } | ||
47 | 51 | ||
48 | height: searchBar.height + Kube.Units.smallSpacing | 52 | height: searchBar.height + Kube.Units.smallSpacing |
49 | width: parent.width | 53 | width: parent.width |
50 | 54 | ||
51 | Controls.ToolButton { | 55 | Kube.IconButton { |
56 | anchors { | ||
57 | top: parent.top | ||
58 | left: parent.left | ||
59 | leftMargin: Kube.Units.smallSpacing | ||
60 | } | ||
61 | visible: stack.depth > 1 | ||
52 | iconName: Kube.Icons.goBack | 62 | iconName: Kube.Icons.goBack |
53 | |||
54 | onClicked: stack.pop() | 63 | onClicked: stack.pop() |
55 | |||
56 | visible: stack. depth > 1 | ||
57 | } | 64 | } |
58 | |||
59 | Kube.TextField { | 65 | Kube.TextField { |
60 | id: searchBar | 66 | id: searchBar |
61 | |||
62 | anchors.horizontalCenter: parent.horizontalCenter | 67 | anchors.horizontalCenter: parent.horizontalCenter |
63 | width: parent.width * 0.5 | 68 | width: parent.width * 0.5 |
64 | |||
65 | placeholderText: "Search..." | 69 | placeholderText: "Search..." |
66 | } | 70 | } |
67 | 71 | Kube.IconButton { | |
68 | Controls.ToolButton { | ||
69 | anchors { | 72 | anchors { |
73 | top: parent.top | ||
70 | right: parent.right | 74 | right: parent.right |
71 | rightMargin: Kube.Units.smallSpacing | 75 | rightMargin: Kube.Units.smallSpacing |
72 | } | 76 | } |
73 | |||
74 | iconName: Kube.Icons.addNew | 77 | iconName: Kube.Icons.addNew |
75 | } | 78 | } |
76 | } | 79 | } |