Merge lp:~verzegnassi-stefano/quick-memo/fix-1360869-1366076 into lp:quick-memo/trunk
- fix-1360869-1366076
- Merge into 0.3
Proposed by
Stefano Verzegnassi
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 39 | ||||||||||||||||
Proposed branch: | lp:~verzegnassi-stefano/quick-memo/fix-1360869-1366076 | ||||||||||||||||
Merge into: | lp:quick-memo/trunk | ||||||||||||||||
Diff against target: |
525 lines (+179/-204) 4 files modified
components/AddMemo.qml (+1/-4) components/MainPage.qml (+118/-119) components/MemoPage.qml (+17/-30) components/MultiSelectionHandler.qml (+43/-51) |
||||||||||||||||
To merge this branch: | bzr merge lp:~verzegnassi-stefano/quick-memo/fix-1360869-1366076 | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stefano Verzegnassi | Approve | ||
Review via email:
|
Commit message
Transition to new header API and minor UX fixes
Description of the change
PageHeadConfigu
Minor UX fixes (bottomEdge and Header behaviour). (#1366069 and #1366076)
Remove "Add image" menu option from MemoPage. (#1374148)
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stefano Verzegnassi (verzegnassi-stefano) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'components/AddMemo.qml' | |||
2 | --- components/AddMemo.qml 2014-08-29 03:30:43 +0000 | |||
3 | +++ components/AddMemo.qml 2014-09-27 18:44:34 +0000 | |||
4 | @@ -70,10 +70,7 @@ | |||
5 | 70 | onTriggered: colorDialog.show() | 70 | onTriggered: colorDialog.show() |
6 | 71 | } | 71 | } |
7 | 72 | 72 | ||
12 | 73 | tools: ToolbarItems { | 73 | head.actions: [colorToolAction, saveMemo] |
9 | 74 | ToolbarButton { action: colorToolAction } | ||
10 | 75 | ToolbarButton { action: saveMemo } | ||
11 | 76 | } | ||
13 | 77 | 74 | ||
14 | 78 | // Background | 75 | // Background |
15 | 79 | Rectangle { | 76 | Rectangle { |
16 | 80 | 77 | ||
17 | === modified file 'components/MainPage.qml' | |||
18 | --- components/MainPage.qml 2014-09-04 15:12:38 +0000 | |||
19 | +++ components/MainPage.qml 2014-09-27 18:44:34 +0000 | |||
20 | @@ -23,28 +23,9 @@ | |||
21 | 23 | PageWithBottomEdge { | 23 | PageWithBottomEdge { |
22 | 24 | id: mainPage | 24 | id: mainPage |
23 | 25 | title: i18n.tr("Overview") | 25 | title: i18n.tr("Overview") |
46 | 26 | flickable: useGridView ? null : viewLoader.item | 26 | flickable: mainPage.state === "multiSelection" ? null |
47 | 27 | 27 | : useGridView ? null | |
48 | 28 | // TODO: Switch to PageHeads. Do it also for MultiSelectionHandler | 28 | : viewLoader.item |
27 | 29 | |||
28 | 30 | Action { | ||
29 | 31 | id: openAbout | ||
30 | 32 | text: i18n.tr("About...") | ||
31 | 33 | iconName: "help" | ||
32 | 34 | onTriggered: pageStack.push(Qt.resolvedUrl("AboutPage.qml")) | ||
33 | 35 | } | ||
34 | 36 | |||
35 | 37 | Action { | ||
36 | 38 | id: switchView | ||
37 | 39 | text: useGridView ? i18n.tr("Switch to one-column list") : i18n.tr("Switch to grid") | ||
38 | 40 | iconName: useGridView ? "view-list-symbolic" : "view-grid-symbolic" | ||
39 | 41 | onTriggered: useGridView = !useGridView | ||
40 | 42 | } | ||
41 | 43 | |||
42 | 44 | tools: ToolbarItems { | ||
43 | 45 | ToolbarButton { action: openAbout } | ||
44 | 46 | ToolbarButton { action: switchView } | ||
45 | 47 | } | ||
49 | 48 | 29 | ||
50 | 49 | // Used for switching from HorizontalFlowListView to ListView, and vice versa. | 30 | // Used for switching from HorizontalFlowListView to ListView, and vice versa. |
51 | 50 | Loader { | 31 | Loader { |
52 | @@ -115,7 +96,7 @@ | |||
53 | 115 | width: (memoView.width * 0.5) - (memoView.spacing * 3) | 96 | width: (memoView.width * 0.5) - (memoView.spacing * 3) |
54 | 116 | 97 | ||
55 | 117 | onClicked: { | 98 | onClicked: { |
57 | 118 | if (multiSelection.active) { | 99 | if (mainPage.state === "multiSelection") { |
58 | 119 | selected = multiSelection.selectUnselectItem(model.index) | 100 | selected = multiSelection.selectUnselectItem(model.index) |
59 | 120 | } else { | 101 | } else { |
60 | 121 | /* Workaround: clear the pageStack before pushing memoPage. | 102 | /* Workaround: clear the pageStack before pushing memoPage. |
61 | @@ -130,14 +111,14 @@ | |||
62 | 130 | } | 111 | } |
63 | 131 | 112 | ||
64 | 132 | onPressAndHold: { | 113 | onPressAndHold: { |
67 | 133 | if (!multiSelection.active) { | 114 | if (mainPage.state !== "multiSelection") { |
68 | 134 | multiSelection.active = true | 115 | mainPage.state = "multiSelection" |
69 | 135 | selected = multiSelection.selectUnselectItem(model.index) | 116 | selected = multiSelection.selectUnselectItem(model.index) |
70 | 136 | } | 117 | } |
71 | 137 | } | 118 | } |
72 | 138 | Connections { | 119 | Connections { |
75 | 139 | target: multiSelection | 120 | target: mainPage |
76 | 140 | onActiveChanged: viewDelegate.selected = false | 121 | onStateChanged: if (mainPage.state !== "multiSelection") viewDelegate.selected = false |
77 | 141 | } | 122 | } |
78 | 142 | } | 123 | } |
79 | 143 | } | 124 | } |
80 | @@ -149,7 +130,13 @@ | |||
81 | 149 | 130 | ||
82 | 150 | ListView { | 131 | ListView { |
83 | 151 | id: memoView | 132 | id: memoView |
85 | 152 | anchors { fill: parent; margins: units.gu(2) } | 133 | anchors { |
86 | 134 | fill: parent | ||
87 | 135 | margins: units.gu(2) | ||
88 | 136 | // Fix wrong topMargin when switching to multiSelection state. | ||
89 | 137 | topMargin: (mainPage.state === "multiSelection") ? (units.gu(2) - mainPage.header.height) | ||
90 | 138 | : units.gu(2) | ||
91 | 139 | } | ||
92 | 153 | clip: false | 140 | clip: false |
93 | 154 | 141 | ||
94 | 155 | spacing: units.gu(1) | 142 | spacing: units.gu(1) |
95 | @@ -160,7 +147,7 @@ | |||
96 | 160 | width: memoView.width | 147 | width: memoView.width |
97 | 161 | 148 | ||
98 | 162 | onClicked: { | 149 | onClicked: { |
100 | 163 | if (multiSelection.active) { | 150 | if (mainPage.state === "multiSelection") { |
101 | 164 | selected = multiSelection.selectUnselectItem(model.index) | 151 | selected = multiSelection.selectUnselectItem(model.index) |
102 | 165 | } else { | 152 | } else { |
103 | 166 | /* Workaround: clear the pageStack before pushing memoPage. | 153 | /* Workaround: clear the pageStack before pushing memoPage. |
104 | @@ -175,21 +162,21 @@ | |||
105 | 175 | } | 162 | } |
106 | 176 | 163 | ||
107 | 177 | onPressAndHold: { | 164 | onPressAndHold: { |
110 | 178 | if (!multiSelection.active) { | 165 | if (mainPage.state !== "multiSelection") { |
111 | 179 | multiSelection.active = true | 166 | mainPage.state = "multiSelection" |
112 | 180 | selected = multiSelection.selectUnselectItem(model.index) | 167 | selected = multiSelection.selectUnselectItem(model.index) |
113 | 181 | } | 168 | } |
114 | 182 | } | 169 | } |
115 | 183 | Connections { | 170 | Connections { |
118 | 184 | target: multiSelection | 171 | target: mainPage |
119 | 185 | onActiveChanged: viewDelegate.selected = false | 172 | onStateChanged: if (mainPage.state !== "multiSelection") viewDelegate.selected = false |
120 | 186 | } | 173 | } |
121 | 187 | 174 | ||
122 | 188 | /* According to Qt-Project docs, "delegates are instantiated as needed and may be destroyed at any time". | 175 | /* According to Qt-Project docs, "delegates are instantiated as needed and may be destroyed at any time". |
123 | 189 | We need to restore 'selected' property when this happens. (this issue does not affect FlowListView, | 176 | We need to restore 'selected' property when this happens. (this issue does not affect FlowListView, |
124 | 190 | since Repeater does not destroy delegates). */ | 177 | since Repeater does not destroy delegates). */ |
125 | 191 | Component.onCompleted: { | 178 | Component.onCompleted: { |
127 | 192 | if (multiSelection.active) { | 179 | if (mainPage.state === "multiSelection") { |
128 | 193 | for (var i=0; i<multiSelection.indexes.length; i++) { | 180 | for (var i=0; i<multiSelection.indexes.length; i++) { |
129 | 194 | if (multiSelection.indexes[i] === index) { | 181 | if (multiSelection.indexes[i] === index) { |
130 | 195 | selected = true | 182 | selected = true |
131 | @@ -201,91 +188,101 @@ | |||
132 | 201 | } | 188 | } |
133 | 202 | } | 189 | } |
134 | 203 | 190 | ||
220 | 204 | // Used to manage multi-selection in ListViews | 191 | state: "default" |
221 | 205 | MultiSelectionHandler { | 192 | states: [ |
222 | 206 | id: multiSelection | 193 | PageHeadState { |
223 | 207 | 194 | name: "default" | |
224 | 208 | target: mainPage | 195 | head: mainPage.head |
225 | 209 | title: (multiSelection.count == 1) ? i18n.tr("%1 item selected").arg(multiSelection.count) | 196 | actions: [openAbout, switchView] |
226 | 210 | : i18n.tr("%1 items selected").arg(multiSelection.count) | 197 | }, |
227 | 211 | tools: ToolbarItems { | 198 | |
228 | 212 | back: ToolbarButton { | 199 | // Used to manage multi-selection in ListViews |
229 | 213 | action: Action { | 200 | MultiSelectionHandler { |
230 | 214 | text: i18n.tr("Cancel") | 201 | id: multiSelection |
231 | 215 | iconName: "back" | 202 | |
232 | 216 | onTriggered: multiSelection.active = false | 203 | name: "multiSelection" |
233 | 217 | } | 204 | targetPage: mainPage |
234 | 218 | } | 205 | |
235 | 219 | 206 | actions: [changeNoteColor, deleteMemo] | |
236 | 220 | ToolbarButton { | 207 | } |
237 | 221 | id: colorToolBtn | 208 | ] |
238 | 222 | action: Action { | 209 | |
239 | 223 | text: i18n.tr("Change note color") | 210 | // DEFAULT PAGEHEAD ACTIONS |
240 | 224 | iconSource: "../img/palette.svg" | 211 | Action { |
241 | 225 | onTriggered: PopupUtils.open(colorNotePopover, colorToolBtn) | 212 | id: openAbout |
242 | 226 | } | 213 | text: i18n.tr("About...") |
243 | 227 | } | 214 | iconName: "help" |
244 | 228 | 215 | onTriggered: pageStack.push(Qt.resolvedUrl("AboutPage.qml")) | |
245 | 229 | ToolbarButton { | 216 | } |
246 | 230 | action: Action { | 217 | |
247 | 231 | id: deleteMemo | 218 | Action { |
248 | 232 | text: i18n.tr("Delete note") | 219 | id: switchView |
249 | 233 | iconName: "delete" | 220 | text: useGridView ? i18n.tr("Switch to one-column list") : i18n.tr("Switch to grid") |
250 | 234 | onTriggered: { | 221 | iconName: useGridView ? "view-list-symbolic" : "view-grid-symbolic" |
251 | 235 | PopupUtils.open(deleteDialog) | 222 | onTriggered: useGridView = !useGridView |
252 | 236 | } | 223 | } |
253 | 237 | } | 224 | |
254 | 238 | } | 225 | // MULTISELECTIONHANDLER ACTIONS |
255 | 239 | } | 226 | Action { |
256 | 240 | 227 | id: changeNoteColor | |
257 | 241 | onIndexAdded: console.log("Added index:", index) | 228 | text: i18n.tr("Change note color") |
258 | 242 | onIndexRemoved: console.log("Index removed:", index) | 229 | iconSource: "../img/palette.svg" |
259 | 243 | 230 | onTriggered: PopupUtils.open(colorNotePopover) | |
260 | 244 | Component { | 231 | } |
261 | 245 | id: colorNotePopover | 232 | |
262 | 246 | 233 | Action { | |
263 | 247 | ColorDialog { | 234 | id: deleteMemo |
264 | 248 | id: colorDialog | 235 | text: i18n.tr("Delete note") |
265 | 249 | showTick: false | 236 | iconName: "delete" |
266 | 250 | // A color not listed in 'colors' property, just to avoid that oldColor and selectedColor result the same. | 237 | onTriggered: { |
267 | 251 | // TODO: If there's just a single element selected, we can import the right color of the memo. | 238 | PopupUtils.open(deleteDialog) |
268 | 252 | selectedColor: "#ababab" | 239 | } |
269 | 253 | 240 | } | |
270 | 254 | onColorPicked: { | 241 | |
271 | 255 | if (isChanged) { | 242 | Component { |
272 | 256 | for (var i=0; i<multiSelection.indexes.length; i++) { | 243 | id: colorNotePopover |
273 | 257 | notes.setNoteProperty(multiSelection.indexes[i], "color", selectedColor) | 244 | |
274 | 258 | } | 245 | ColorDialog { |
275 | 259 | } else { | 246 | id: colorDialog |
276 | 260 | console.log("Color not changed") | 247 | showTick: false |
277 | 261 | } | 248 | // A color not listed in 'colors' property, just to avoid that oldColor and selectedColor result the same. |
278 | 262 | 249 | // TODO: If there's just a single element selected, we can import the right color of the memo. | |
279 | 263 | multiSelection.active = false | 250 | selectedColor: "#ababab" |
280 | 264 | PopupUtils.close(colorDialog) | 251 | |
281 | 265 | } | 252 | onColorPicked: { |
282 | 266 | } | 253 | if (isChanged) { |
283 | 267 | } | 254 | for (var i=0; i<multiSelection.indexes.length; i++) { |
284 | 268 | 255 | notes.setNoteProperty(multiSelection.indexes[i], "color", selectedColor) | |
285 | 269 | Component { | 256 | } |
286 | 270 | id: deleteDialog | 257 | } else { |
287 | 271 | Dialog { | 258 | console.log("Color not changed") |
288 | 272 | id: deleteDialogue | 259 | } |
289 | 273 | title: i18n.tr("Delete note(s)") | 260 | |
290 | 274 | text: i18n.tr("Are you sure?") | 261 | mainPage.state = "default" |
291 | 275 | 262 | PopupUtils.close(colorDialog) | |
292 | 276 | Button { | 263 | } |
293 | 277 | text: i18n.tr("Cancel") | 264 | } |
294 | 278 | gradient: UbuntuColors.greyGradient | 265 | } |
295 | 279 | onClicked: PopupUtils.close(deleteDialogue) | 266 | |
296 | 280 | } | 267 | Component { |
297 | 281 | Button { | 268 | id: deleteDialog |
298 | 282 | text: i18n.tr("Delete") | 269 | Dialog { |
299 | 283 | color: UbuntuColors.orange | 270 | id: deleteDialogue |
300 | 284 | onClicked: { | 271 | title: i18n.tr("Delete note(s)") |
301 | 285 | notes.deleteNotes(multiSelection.indexes) | 272 | text: i18n.tr("Are you sure?") |
302 | 286 | multiSelection.active = false | 273 | |
303 | 287 | PopupUtils.close(deleteDialogue) | 274 | Button { |
304 | 288 | } | 275 | text: i18n.tr("Cancel") |
305 | 276 | gradient: UbuntuColors.greyGradient | ||
306 | 277 | onClicked: PopupUtils.close(deleteDialogue) | ||
307 | 278 | } | ||
308 | 279 | Button { | ||
309 | 280 | text: i18n.tr("Delete") | ||
310 | 281 | color: UbuntuColors.orange | ||
311 | 282 | onClicked: { | ||
312 | 283 | notes.deleteNotes(multiSelection.indexes) | ||
313 | 284 | mainPage.state = "default" | ||
314 | 285 | PopupUtils.close(deleteDialogue) | ||
315 | 289 | } | 286 | } |
316 | 290 | } | 287 | } |
317 | 291 | } | 288 | } |
318 | @@ -293,4 +290,6 @@ | |||
319 | 293 | 290 | ||
320 | 294 | bottomEdgeTitle: i18n.tr("New memo") | 291 | bottomEdgeTitle: i18n.tr("New memo") |
321 | 295 | bottomEdgePageComponent: AddMemo {} | 292 | bottomEdgePageComponent: AddMemo {} |
322 | 293 | // Disable bottomEdge when MultiSelectionHandler is active | ||
323 | 294 | bottomEdgeEnabled: mainPage.state !== "multiSelection" | ||
324 | 296 | } | 295 | } |
325 | 297 | 296 | ||
326 | === modified file 'components/MemoPage.qml' | |||
327 | --- components/MemoPage.qml 2014-08-29 03:30:43 +0000 | |||
328 | +++ components/MemoPage.qml 2014-09-27 18:44:34 +0000 | |||
329 | @@ -60,17 +60,10 @@ | |||
330 | 60 | } | 60 | } |
331 | 61 | 61 | ||
332 | 62 | Action { | 62 | Action { |
333 | 63 | id: addImage | ||
334 | 64 | text: i18n.tr("Add image") | ||
335 | 65 | iconName: "insert-image" | ||
336 | 66 | onTriggered: picsView.importImageFromContentHub() | ||
337 | 67 | } | ||
338 | 68 | |||
339 | 69 | Action { | ||
340 | 70 | id: colorToolAction | 63 | id: colorToolAction |
341 | 71 | text: i18n.tr("Change note color") | 64 | text: i18n.tr("Change note color") |
342 | 72 | iconSource: "../img/palette.svg" | 65 | iconSource: "../img/palette.svg" |
344 | 73 | onTriggered: PopupUtils.open(colorNotePopover, colorToolBtn) | 66 | onTriggered: PopupUtils.open(colorNotePopover) |
345 | 74 | } | 67 | } |
346 | 75 | Component { | 68 | Component { |
347 | 76 | id: colorNotePopover | 69 | id: colorNotePopover |
348 | @@ -89,32 +82,26 @@ | |||
349 | 89 | } | 82 | } |
350 | 90 | } | 83 | } |
351 | 91 | 84 | ||
367 | 92 | tools: ToolbarItems { | 85 | head.backAction: Action { |
368 | 93 | back: ToolbarButton { | 86 | iconName: "back" |
369 | 94 | action: Action { | 87 | onTriggered: { |
370 | 95 | iconName: "back" | 88 | // Check if a saveNote request was made. If so, stop the timer and save before exiting the page. |
371 | 96 | onTriggered: { | 89 | if (autoSaveTimer.running) { |
372 | 97 | // Check if a saveNote request was made. If so, stop the timer and save before exiting the page. | 90 | console.log("It's ok. Saving the note before closing the page...") |
373 | 98 | if (autoSaveTimer.running) { | 91 | autoSaveTimer.running = false |
374 | 99 | console.log("It's ok. Saving the note before closing the page...") | 92 | saveNote() |
375 | 100 | autoSaveTimer.running = false | 93 | } |
376 | 101 | saveNote() | 94 | |
377 | 102 | } | 95 | pageStack.pop() |
378 | 103 | 96 | ||
379 | 104 | pageStack.pop() | 97 | /* Workaround: see MainPage.qml, comment for mainView.delegate.onClicked(). |
365 | 105 | |||
366 | 106 | /* Workaround: see MainPage.qml, comment for mainView.delegate.onClicked(). | ||
380 | 107 | We simply re-push in the stack what we removed earlier.*/ | 98 | We simply re-push in the stack what we removed earlier.*/ |
384 | 108 | pageStack.push(mainPage) | 99 | pageStack.push(mainPage) |
382 | 109 | } | ||
383 | 110 | } | ||
385 | 111 | } | 100 | } |
386 | 112 | |||
387 | 113 | ToolbarButton { id: colorToolBtn; action: colorToolAction } | ||
388 | 114 | ToolbarButton { action: addImage } | ||
389 | 115 | ToolbarButton { action: deleteMemo } | ||
390 | 116 | } | 101 | } |
391 | 117 | 102 | ||
392 | 103 | head.actions: [colorToolAction, deleteMemo] | ||
393 | 104 | |||
394 | 118 | // Background | 105 | // Background |
395 | 119 | Rectangle { | 106 | Rectangle { |
396 | 120 | id: bg | 107 | id: bg |
397 | 121 | 108 | ||
398 | === modified file 'components/MultiSelectionHandler.qml' | |||
399 | --- components/MultiSelectionHandler.qml 2014-08-31 22:11:24 +0000 | |||
400 | +++ components/MultiSelectionHandler.qml 2014-09-27 18:44:34 +0000 | |||
401 | @@ -18,58 +18,55 @@ | |||
402 | 18 | import QtQuick 2.0 | 18 | import QtQuick 2.0 |
403 | 19 | import Ubuntu.Components 1.1 | 19 | import Ubuntu.Components 1.1 |
404 | 20 | 20 | ||
406 | 21 | Item { | 21 | PageHeadState { |
407 | 22 | id: rootItem | 22 | id: rootItem |
408 | 23 | 23 | ||
409 | 24 | property bool active: false | ||
410 | 25 | |||
411 | 26 | property Page target | ||
412 | 27 | property ToolbarItems tools | ||
413 | 28 | property string title | 24 | property string title |
414 | 29 | 25 | ||
415 | 30 | property var indexes: [] | 26 | property var indexes: [] |
416 | 31 | property int count: rootItem.indexes.length | 27 | property int count: rootItem.indexes.length |
458 | 32 | 28 | property Page targetPage | |
459 | 33 | QtObject { | 29 | |
460 | 34 | id: d | 30 | head: targetPage.head |
461 | 35 | property ToolbarItems tools | 31 | |
462 | 36 | property string title | 32 | backAction: Action { |
463 | 37 | } | 33 | text: i18n.tr("Cancel") |
464 | 38 | 34 | iconName: "back" | |
465 | 39 | // Provide a visual feedback when active | 35 | onTriggered: targetPage.state = "default" |
466 | 40 | Rectangle { | 36 | } |
467 | 41 | id: headerBg | 37 | |
468 | 42 | parent: target.header | 38 | contents: Item { |
469 | 43 | z: -10 | 39 | anchors.fill: parent |
470 | 44 | 40 | ||
471 | 45 | width: target.width | 41 | Connections { |
472 | 46 | height: target.header.height | 42 | target: targetPage |
473 | 47 | color: "#19B6EE" // Cyan | 43 | onStateChanged: { |
474 | 48 | visible: rootItem.active | 44 | if (targetPage.state !== "multiSelection") { |
475 | 49 | } | 45 | // Clean the model |
476 | 50 | 46 | rootItem.indexes = [] | |
477 | 51 | onActiveChanged: { | 47 | } |
478 | 52 | if(active) { | 48 | } |
479 | 53 | // Copy current toolbar and title | 49 | } |
480 | 54 | d.tools = target.tools | 50 | |
481 | 55 | d.title = target.title | 51 | Label { |
482 | 56 | 52 | fontSize: "x-large" | |
483 | 57 | // Show new header | 53 | text: (rootItem.count == 0) ? i18n.tr("No item selected") |
484 | 58 | target.tools = rootItem.tools | 54 | : (rootItem.count == 1) ? i18n.tr("%1 item selected").arg(rootItem.count) |
485 | 59 | target.title = rootItem.title | 55 | : i18n.tr("%1 items selected").arg(rootItem.count) |
486 | 60 | 56 | anchors.verticalCenter: parent.verticalCenter | |
487 | 61 | } else { | 57 | } |
488 | 62 | target.tools = d.tools | 58 | |
489 | 63 | target.title = d.title | 59 | // Provide a visual feedback when active |
490 | 64 | 60 | Rectangle { | |
491 | 65 | // Clean the model | 61 | id: headerBg |
492 | 66 | rootItem.indexes = [] | 62 | parent: targetPage.header |
493 | 67 | } | 63 | z: -10 |
494 | 68 | } | 64 | |
495 | 69 | 65 | width: targetPage.width | |
496 | 70 | Connections { | 66 | height: targetPage.header.height |
497 | 71 | target: rootItem.target | 67 | color: "#19B6EE" // Cyan |
498 | 72 | onActiveChanged: rootItem.active = false | 68 | visible: mainPage.state == "multiSelection" |
499 | 69 | } | ||
500 | 73 | } | 70 | } |
501 | 74 | 71 | ||
502 | 75 | signal indexAdded(var index) | 72 | signal indexAdded(var index) |
503 | @@ -84,8 +81,6 @@ | |||
504 | 84 | 81 | ||
505 | 85 | // Update count and header | 82 | // Update count and header |
506 | 86 | rootItem.count = rootItem.indexes.length | 83 | rootItem.count = rootItem.indexes.length |
507 | 87 | target.tools = rootItem.tools | ||
508 | 88 | target.title = rootItem.title | ||
509 | 89 | 84 | ||
510 | 90 | // Return false if the index is removed. | 85 | // Return false if the index is removed. |
511 | 91 | rootItem.indexRemoved(index) | 86 | rootItem.indexRemoved(index) |
512 | @@ -98,13 +93,10 @@ | |||
513 | 98 | 93 | ||
514 | 99 | // Update count | 94 | // Update count |
515 | 100 | rootItem.count = rootItem.indexes.length | 95 | rootItem.count = rootItem.indexes.length |
516 | 101 | target.tools = rootItem.tools | ||
517 | 102 | target.title = rootItem.title | ||
518 | 103 | 96 | ||
519 | 104 | // Sort indexes, so they're processed ascending if requested. This simplify the code of the functions that use this array. | 97 | // Sort indexes, so they're processed ascending if requested. This simplify the code of the functions that use this array. |
520 | 105 | indexes.sort(function(a,b) {return a-b}) | 98 | indexes.sort(function(a,b) {return a-b}) |
521 | 106 | 99 | ||
522 | 107 | |||
523 | 108 | // Return true if the index is added | 100 | // Return true if the index is added |
524 | 109 | rootItem.indexAdded(index) | 101 | rootItem.indexAdded(index) |
525 | 110 | return true | 102 | return true |