Merge lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save into lp:ubuntu-calendar-app
- fix-model-update-after-save
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Bill Filler |
Approved revision: | 845 |
Merged at revision: | 857 |
Proposed branch: | lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
287 lines (+80/-15) 11 files modified
AgendaView.qml (+4/-0) DayView.qml (+7/-1) EventDetails.qml (+1/-1) EventListModel.qml (+9/-1) MonthView.qml (+13/-0) MonthWithEventsComponent.qml (+10/-4) NewEvent.qml (+6/-2) NewEventBottomEdge.qml (+7/-3) PageWithBottomEdge.qml (+4/-2) TimeLineBaseComponent.qml (+7/-0) WeekView.qml (+12/-1) |
To merge this branch: | bzr merge lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
system-apps-ci-bot | continuous-integration | Needs Fixing | |
Jenkins Bot | continuous-integration | Approve | |
Ubuntu Calendar Developers | Pending | ||
Review via email: mp+297101@code.launchpad.net |
Commit message
If syncing, manually update the model during event create/delete to make sure that the view get updated.
Description of the change
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
- 845. By Renato Araujo Oliveira Filho
-
Added debug messages to help debug application not updating
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:845
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:845
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:845
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'AgendaView.qml' | |||
2 | --- AgendaView.qml 2016-03-21 14:40:17 +0000 | |||
3 | +++ AgendaView.qml 2016-06-10 21:17:55 +0000 | |||
4 | @@ -55,6 +55,10 @@ | |||
5 | 55 | flickable: eventList | 55 | flickable: eventList |
6 | 56 | } | 56 | } |
7 | 57 | 57 | ||
8 | 58 | // make sure that the model is updated after create a new event if it is marked as auto-update false | ||
9 | 59 | onEventSaved: eventListModel.updateIfNecessary() | ||
10 | 60 | onEventDeleted: eventListModel.updateIfNecessary() | ||
11 | 61 | |||
12 | 58 | 62 | ||
13 | 59 | // ListModel to hold all events for upcoming 7days. | 63 | // ListModel to hold all events for upcoming 7days. |
14 | 60 | EventListModel { | 64 | EventListModel { |
15 | 61 | 65 | ||
16 | === modified file 'DayView.qml' | |||
17 | --- DayView.qml 2016-03-17 01:51:25 +0000 | |||
18 | +++ DayView.qml 2016-06-10 21:17:55 +0000 | |||
19 | @@ -48,7 +48,7 @@ | |||
20 | 48 | dayViewPath.scrollToBegginer() | 48 | dayViewPath.scrollToBegginer() |
21 | 49 | } | 49 | } |
22 | 50 | 50 | ||
24 | 51 | onEventCreated: { | 51 | onEventSaved: { |
25 | 52 | var scrollDate = new Date(event.startDateTime) | 52 | var scrollDate = new Date(event.startDateTime) |
26 | 53 | var needScroll = false | 53 | var needScroll = false |
27 | 54 | if ((currentDate.getFullYear() !== scrollDate.getFullYear()) || | 54 | if ((currentDate.getFullYear() !== scrollDate.getFullYear()) || |
28 | @@ -182,6 +182,12 @@ | |||
29 | 182 | timeLineView.scrollToTime(new Date()); | 182 | timeLineView.scrollToTime(new Date()); |
30 | 183 | } | 183 | } |
31 | 184 | } | 184 | } |
32 | 185 | onEventSaved: { | ||
33 | 186 | timeLineView.update() | ||
34 | 187 | } | ||
35 | 188 | onEventDeleted: { | ||
36 | 189 | timeLineView.update() | ||
37 | 190 | } | ||
38 | 185 | } | 191 | } |
39 | 186 | 192 | ||
40 | 187 | //get contentY value from PathView, if its not current Item | 193 | //get contentY value from PathView, if its not current Item |
41 | 188 | 194 | ||
42 | === modified file 'EventDetails.qml' | |||
43 | --- EventDetails.qml 2016-04-15 17:54:16 +0000 | |||
44 | +++ EventDetails.qml 2016-06-10 21:17:55 +0000 | |||
45 | @@ -242,7 +242,7 @@ | |||
46 | 242 | } | 242 | } |
47 | 243 | 243 | ||
48 | 244 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event": event, "model":model}); | 244 | pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event": event, "model":model}); |
50 | 245 | pageStack.currentPage.eventAdded.connect( function(event){ | 245 | pageStack.currentPage.eventSaved.connect( function(event){ |
51 | 246 | pageStack.pop(); | 246 | pageStack.pop(); |
52 | 247 | }) | 247 | }) |
53 | 248 | //When event deleted from the Edit mode | 248 | //When event deleted from the Edit mode |
54 | 249 | 249 | ||
55 | === modified file 'EventListModel.qml' | |||
56 | --- EventListModel.qml 2016-05-02 14:28:38 +0000 | |||
57 | +++ EventListModel.qml 2016-06-10 21:17:55 +0000 | |||
58 | @@ -30,7 +30,8 @@ | |||
59 | 30 | property var _priv: Binding { | 30 | property var _priv: Binding { |
60 | 31 | target: eventModel | 31 | target: eventModel |
61 | 32 | property: "autoUpdate" | 32 | property: "autoUpdate" |
63 | 33 | value: !mainView.syncInProgress | 33 | value: false |
64 | 34 | when: mainView.syncInProgress | ||
65 | 34 | } | 35 | } |
66 | 35 | 36 | ||
67 | 36 | function addModelChangeListener(listener){ | 37 | function addModelChangeListener(listener){ |
68 | @@ -169,6 +170,13 @@ | |||
69 | 169 | return result | 170 | return result |
70 | 170 | } | 171 | } |
71 | 171 | 172 | ||
72 | 173 | function updateIfNecessary() | ||
73 | 174 | { | ||
74 | 175 | console.debug("UpdateIfNecessary:" + eventModel + " has autoUpdate?" + autoUpdate) | ||
75 | 176 | if (!autoUpdate) | ||
76 | 177 | update() | ||
77 | 178 | } | ||
78 | 179 | |||
79 | 172 | onStartPeriodChanged: { | 180 | onStartPeriodChanged: { |
80 | 173 | isLoading = true | 181 | isLoading = true |
81 | 174 | } | 182 | } |
82 | 175 | 183 | ||
83 | === modified file 'MonthView.qml' | |||
84 | --- MonthView.qml 2016-04-28 13:44:33 +0000 | |||
85 | +++ MonthView.qml 2016-06-10 21:17:55 +0000 | |||
86 | @@ -91,6 +91,8 @@ | |||
87 | 91 | } | 91 | } |
88 | 92 | 92 | ||
89 | 93 | delegate: MonthWithEventsComponent { | 93 | delegate: MonthWithEventsComponent { |
90 | 94 | id: monthDelegate | ||
91 | 95 | |||
92 | 94 | property var indexDate: firstDayOfAnchorDate.addMonths(monthViewPath.loopCurrentIndex + monthViewPath.indexType(index)) | 96 | property var indexDate: firstDayOfAnchorDate.addMonths(monthViewPath.loopCurrentIndex + monthViewPath.indexType(index)) |
93 | 95 | 97 | ||
94 | 96 | currentMonth: indexDate.getMonth() | 98 | currentMonth: indexDate.getMonth() |
95 | @@ -109,6 +111,17 @@ | |||
96 | 109 | onDateSelected: { | 111 | onDateSelected: { |
97 | 110 | monthViewPage.dateSelected(date); | 112 | monthViewPage.dateSelected(date); |
98 | 111 | } | 113 | } |
99 | 114 | |||
100 | 115 | // make sure that the model is updated after create a new event if it is marked as auto-update false | ||
101 | 116 | Connections { | ||
102 | 117 | target: monthViewPage | ||
103 | 118 | onEventSaved: { | ||
104 | 119 | monthDelegate.update() | ||
105 | 120 | } | ||
106 | 121 | onEventDeleted: { | ||
107 | 122 | monthDelegate.update() | ||
108 | 123 | } | ||
109 | 124 | } | ||
110 | 112 | } | 125 | } |
111 | 113 | } | 126 | } |
112 | 114 | } | 127 | } |
113 | 115 | 128 | ||
114 | === modified file 'MonthWithEventsComponent.qml' | |||
115 | --- MonthWithEventsComponent.qml 2016-04-28 17:23:21 +0000 | |||
116 | +++ MonthWithEventsComponent.qml 2016-06-10 21:17:55 +0000 | |||
117 | @@ -29,9 +29,17 @@ | |||
118 | 29 | property alias autoUpdate: mainModel.autoUpdate | 29 | property alias autoUpdate: mainModel.autoUpdate |
119 | 30 | property var modelFilter: invalidFilter | 30 | property var modelFilter: invalidFilter |
120 | 31 | 31 | ||
121 | 32 | function refresh() { | ||
122 | 33 | idleRefresh.reset() | ||
123 | 34 | } | ||
124 | 35 | |||
125 | 36 | function update() { | ||
126 | 37 | mainModel.updateIfNecessary() | ||
127 | 38 | } | ||
128 | 39 | |||
129 | 32 | onIsActiveChanged: { | 40 | onIsActiveChanged: { |
130 | 33 | if (isActive && (mainModel.filter === invalidFilter)) { | 41 | if (isActive && (mainModel.filter === invalidFilter)) { |
132 | 34 | idleRefresh.reset() | 42 | refresh(); |
133 | 35 | } | 43 | } |
134 | 36 | } | 44 | } |
135 | 37 | 45 | ||
136 | @@ -48,9 +56,7 @@ | |||
137 | 48 | repeat: false | 56 | repeat: false |
138 | 49 | onTriggered: { | 57 | onTriggered: { |
139 | 50 | mainModel.filter = Qt.binding(function() { return root.modelFilter } ) | 58 | mainModel.filter = Qt.binding(function() { return root.modelFilter } ) |
143 | 51 | if (!mainModel.autoUpdate) { | 59 | mainModel.updateIfNecessary() |
141 | 52 | mainModel.update() | ||
142 | 53 | } | ||
144 | 54 | } | 60 | } |
145 | 55 | } | 61 | } |
146 | 56 | 62 | ||
147 | 57 | 63 | ||
148 | === modified file 'NewEvent.qml' | |||
149 | --- NewEvent.qml 2016-04-06 18:46:29 +0000 | |||
150 | +++ NewEvent.qml 2016-06-10 21:17:55 +0000 | |||
151 | @@ -52,7 +52,7 @@ | |||
152 | 52 | readonly property int millisecsInADay: 86400000 | 52 | readonly property int millisecsInADay: 86400000 |
153 | 53 | readonly property int millisecsInAnHour: 3600000 | 53 | readonly property int millisecsInAnHour: 3600000 |
154 | 54 | 54 | ||
156 | 55 | signal eventAdded(var event); | 55 | signal eventSaved(var event); |
157 | 56 | signal eventDeleted(var event); | 56 | signal eventDeleted(var event); |
158 | 57 | signal canceled() | 57 | signal canceled() |
159 | 58 | 58 | ||
160 | @@ -256,7 +256,10 @@ | |||
161 | 256 | } | 256 | } |
162 | 257 | 257 | ||
163 | 258 | model.saveItem(event) | 258 | model.saveItem(event) |
165 | 259 | root.eventAdded(event); | 259 | console.debug("Save item. Model is autoUpdate?" + model.autoUpdate) |
166 | 260 | root.eventSaved(event); | ||
167 | 261 | model.updateIfNecessary() | ||
168 | 262 | |||
169 | 260 | if (pageStack) | 263 | if (pageStack) |
170 | 261 | pageStack.pop(); | 264 | pageStack.pop(); |
171 | 262 | } | 265 | } |
172 | @@ -343,6 +346,7 @@ | |||
173 | 343 | var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteConfirmationDialog.qml"),root,{"event": event}); | 346 | var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteConfirmationDialog.qml"),root,{"event": event}); |
174 | 344 | dialog.deleteEvent.connect( function(eventId){ | 347 | dialog.deleteEvent.connect( function(eventId){ |
175 | 345 | model.removeItem(eventId); | 348 | model.removeItem(eventId); |
176 | 349 | model.updateIfNecessary() | ||
177 | 346 | if (pageStack) | 350 | if (pageStack) |
178 | 347 | pageStack.pop(); | 351 | pageStack.pop(); |
179 | 348 | root.eventDeleted(eventId); | 352 | root.eventDeleted(eventId); |
180 | 349 | 353 | ||
181 | === modified file 'NewEventBottomEdge.qml' | |||
182 | --- NewEventBottomEdge.qml 2016-04-13 21:23:25 +0000 | |||
183 | +++ NewEventBottomEdge.qml 2016-06-10 21:17:55 +0000 | |||
184 | @@ -35,7 +35,8 @@ | |||
185 | 35 | property var _realPage: null | 35 | property var _realPage: null |
186 | 36 | 36 | ||
187 | 37 | signal opened() | 37 | signal opened() |
189 | 38 | signal eventCreated(var event) | 38 | signal eventSaved(var event) |
190 | 39 | signal eventDeleted() | ||
191 | 39 | 40 | ||
192 | 40 | function updateNewEventInfo(date, allDay) | 41 | function updateNewEventInfo(date, allDay) |
193 | 41 | { | 42 | { |
194 | @@ -103,9 +104,12 @@ | |||
195 | 103 | visible: (bottomEdge.status !== BottomEdge.Hidden) | 104 | visible: (bottomEdge.status !== BottomEdge.Hidden) |
196 | 104 | onCanceled: bottomEdge.collapse() | 105 | onCanceled: bottomEdge.collapse() |
197 | 105 | bottomEdgePageStack: bottomEdge.pageStack | 106 | bottomEdgePageStack: bottomEdge.pageStack |
199 | 106 | onEventAdded: { | 107 | onEventSaved: { |
200 | 107 | bottomEdge.collapse() | 108 | bottomEdge.collapse() |
202 | 108 | bottomEdge.eventCreated(event) | 109 | bottomEdge.eventSaved(event) |
203 | 110 | } | ||
204 | 111 | onEventDeleted: { | ||
205 | 112 | bottomEdge.evetDeleted() | ||
206 | 109 | } | 113 | } |
207 | 110 | } | 114 | } |
208 | 111 | } | 115 | } |
209 | 112 | 116 | ||
210 | === modified file 'PageWithBottomEdge.qml' | |||
211 | --- PageWithBottomEdge.qml 2016-03-18 00:33:43 +0000 | |||
212 | +++ PageWithBottomEdge.qml 2016-06-10 21:17:55 +0000 | |||
213 | @@ -28,7 +28,8 @@ | |||
214 | 28 | readonly property int bottomEdgeHeight: bottomEdge.hint.height | 28 | readonly property int bottomEdgeHeight: bottomEdge.hint.height |
215 | 29 | 29 | ||
216 | 30 | signal bottomEdgeCommitStarted() | 30 | signal bottomEdgeCommitStarted() |
218 | 31 | signal eventCreated(var event) | 31 | signal eventSaved(var event) |
219 | 32 | signal eventDeleted() | ||
220 | 32 | 33 | ||
221 | 33 | function bottomEdgeCommit(date, allDay) | 34 | function bottomEdgeCommit(date, allDay) |
222 | 34 | { | 35 | { |
223 | @@ -41,6 +42,7 @@ | |||
224 | 41 | 42 | ||
225 | 42 | pageStack: root.pageStack | 43 | pageStack: root.pageStack |
226 | 43 | onOpened: root.bottomEdgeCommitStarted() | 44 | onOpened: root.bottomEdgeCommitStarted() |
228 | 44 | onEventCreated: root.eventCreated(event) | 45 | onEventSaved: root.eventSaved(event) |
229 | 46 | onEventDeleted: root.eventDeleted() | ||
230 | 45 | } | 47 | } |
231 | 46 | } | 48 | } |
232 | 47 | 49 | ||
233 | === modified file 'TimeLineBaseComponent.qml' | |||
234 | --- TimeLineBaseComponent.qml 2016-05-02 14:28:38 +0000 | |||
235 | +++ TimeLineBaseComponent.qml 2016-06-10 21:17:55 +0000 | |||
236 | @@ -132,6 +132,12 @@ | |||
237 | 132 | timeLineView.returnToBounds() | 132 | timeLineView.returnToBounds() |
238 | 133 | } | 133 | } |
239 | 134 | 134 | ||
240 | 135 | function update() | ||
241 | 136 | { | ||
242 | 137 | console.debug("will update model if necessary.") | ||
243 | 138 | mainModel.updateIfNecessary() | ||
244 | 139 | } | ||
245 | 140 | |||
246 | 135 | Connections{ | 141 | Connections{ |
247 | 136 | target: keyboardEventProvider | 142 | target: keyboardEventProvider |
248 | 137 | onScrollUp:{ | 143 | onScrollUp:{ |
249 | @@ -335,6 +341,7 @@ | |||
250 | 335 | var event = dropArea.modifyEventForDrag(drop); | 341 | var event = dropArea.modifyEventForDrag(drop); |
251 | 336 | delegate.waitForModelChange() | 342 | delegate.waitForModelChange() |
252 | 337 | delegate.model.saveItem(event); | 343 | delegate.model.saveItem(event); |
253 | 344 | delegate.model.updateIfNecessary() | ||
254 | 338 | } | 345 | } |
255 | 339 | 346 | ||
256 | 340 | onPositionChanged: { | 347 | onPositionChanged: { |
257 | 341 | 348 | ||
258 | === modified file 'WeekView.qml' | |||
259 | --- WeekView.qml 2016-04-29 19:23:50 +0000 | |||
260 | +++ WeekView.qml 2016-06-10 21:17:55 +0000 | |||
261 | @@ -64,7 +64,7 @@ | |||
262 | 64 | weekViewPath.scrollToBegginer() | 64 | weekViewPath.scrollToBegginer() |
263 | 65 | } | 65 | } |
264 | 66 | 66 | ||
266 | 67 | onEventCreated: { | 67 | onEventSaved: { |
267 | 68 | var scrollDate = new Date(event.startDateTime) | 68 | var scrollDate = new Date(event.startDateTime) |
268 | 69 | var currentWeekNumber = currentDate.weekNumber(Qt.locale().firstDayOfWeek) | 69 | var currentWeekNumber = currentDate.weekNumber(Qt.locale().firstDayOfWeek) |
269 | 70 | var eventWeekNumber = scrollDate.weekNumber(Qt.locale().firstDayOfWeek) | 70 | var eventWeekNumber = scrollDate.weekNumber(Qt.locale().firstDayOfWeek) |
270 | @@ -237,6 +237,17 @@ | |||
271 | 237 | } | 237 | } |
272 | 238 | } | 238 | } |
273 | 239 | 239 | ||
274 | 240 | // make sure that the model is updated after create a new event if it is marked as auto-update false | ||
275 | 241 | Connections { | ||
276 | 242 | target: weekViewPage | ||
277 | 243 | onEventSaved: { | ||
278 | 244 | timeLineView.update() | ||
279 | 245 | } | ||
280 | 246 | onEventDeleted: { | ||
281 | 247 | timeLineView.update() | ||
282 | 248 | } | ||
283 | 249 | } | ||
284 | 250 | |||
285 | 240 | //get contentY value from PathView, if its not current Item | 251 | //get contentY value from PathView, if its not current Item |
286 | 241 | Binding{ | 252 | Binding{ |
287 | 242 | target: timeLineView | 253 | target: timeLineView |
PASSED: Continuous integration, rev:844 /core-apps- jenkins. ubuntu. com/job/ calendar- app-ci/ 853/ /core-apps- jenkins. ubuntu. com/job/ generic- update- mp/917/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /core-apps- jenkins. ubuntu. com/job/ calendar- app-ci/ 853/rebuild
https:/