Merge lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
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
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.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
845. By Renato Araujo Oliveira Filho

Added debug messages to help debug application not updating

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:845
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/2/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/742/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/742
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/688
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/688
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/688
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/680/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/680/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/2/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:845
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/12/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/757/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/757
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/703
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/703
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/703
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/695/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/695/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-calendar-app-ci/12/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 flickable: eventList
6 }
7
8+ // make sure that the model is updated after create a new event if it is marked as auto-update false
9+ onEventSaved: eventListModel.updateIfNecessary()
10+ onEventDeleted: eventListModel.updateIfNecessary()
11+
12
13 // ListModel to hold all events for upcoming 7days.
14 EventListModel {
15
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 dayViewPath.scrollToBegginer()
21 }
22
23- onEventCreated: {
24+ onEventSaved: {
25 var scrollDate = new Date(event.startDateTime)
26 var needScroll = false
27 if ((currentDate.getFullYear() !== scrollDate.getFullYear()) ||
28@@ -182,6 +182,12 @@
29 timeLineView.scrollToTime(new Date());
30 }
31 }
32+ onEventSaved: {
33+ timeLineView.update()
34+ }
35+ onEventDeleted: {
36+ timeLineView.update()
37+ }
38 }
39
40 //get contentY value from PathView, if its not current Item
41
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 }
47
48 pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event": event, "model":model});
49- pageStack.currentPage.eventAdded.connect( function(event){
50+ pageStack.currentPage.eventSaved.connect( function(event){
51 pageStack.pop();
52 })
53 //When event deleted from the Edit mode
54
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 property var _priv: Binding {
60 target: eventModel
61 property: "autoUpdate"
62- value: !mainView.syncInProgress
63+ value: false
64+ when: mainView.syncInProgress
65 }
66
67 function addModelChangeListener(listener){
68@@ -169,6 +170,13 @@
69 return result
70 }
71
72+ function updateIfNecessary()
73+ {
74+ console.debug("UpdateIfNecessary:" + eventModel + " has autoUpdate?" + autoUpdate)
75+ if (!autoUpdate)
76+ update()
77+ }
78+
79 onStartPeriodChanged: {
80 isLoading = true
81 }
82
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 }
88
89 delegate: MonthWithEventsComponent {
90+ id: monthDelegate
91+
92 property var indexDate: firstDayOfAnchorDate.addMonths(monthViewPath.loopCurrentIndex + monthViewPath.indexType(index))
93
94 currentMonth: indexDate.getMonth()
95@@ -109,6 +111,17 @@
96 onDateSelected: {
97 monthViewPage.dateSelected(date);
98 }
99+
100+ // make sure that the model is updated after create a new event if it is marked as auto-update false
101+ Connections {
102+ target: monthViewPage
103+ onEventSaved: {
104+ monthDelegate.update()
105+ }
106+ onEventDeleted: {
107+ monthDelegate.update()
108+ }
109+ }
110 }
111 }
112 }
113
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 property alias autoUpdate: mainModel.autoUpdate
119 property var modelFilter: invalidFilter
120
121+ function refresh() {
122+ idleRefresh.reset()
123+ }
124+
125+ function update() {
126+ mainModel.updateIfNecessary()
127+ }
128+
129 onIsActiveChanged: {
130 if (isActive && (mainModel.filter === invalidFilter)) {
131- idleRefresh.reset()
132+ refresh();
133 }
134 }
135
136@@ -48,9 +56,7 @@
137 repeat: false
138 onTriggered: {
139 mainModel.filter = Qt.binding(function() { return root.modelFilter } )
140- if (!mainModel.autoUpdate) {
141- mainModel.update()
142- }
143+ mainModel.updateIfNecessary()
144 }
145 }
146
147
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 readonly property int millisecsInADay: 86400000
153 readonly property int millisecsInAnHour: 3600000
154
155- signal eventAdded(var event);
156+ signal eventSaved(var event);
157 signal eventDeleted(var event);
158 signal canceled()
159
160@@ -256,7 +256,10 @@
161 }
162
163 model.saveItem(event)
164- root.eventAdded(event);
165+ console.debug("Save item. Model is autoUpdate?" + model.autoUpdate)
166+ root.eventSaved(event);
167+ model.updateIfNecessary()
168+
169 if (pageStack)
170 pageStack.pop();
171 }
172@@ -343,6 +346,7 @@
173 var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteConfirmationDialog.qml"),root,{"event": event});
174 dialog.deleteEvent.connect( function(eventId){
175 model.removeItem(eventId);
176+ model.updateIfNecessary()
177 if (pageStack)
178 pageStack.pop();
179 root.eventDeleted(eventId);
180
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 property var _realPage: null
186
187 signal opened()
188- signal eventCreated(var event)
189+ signal eventSaved(var event)
190+ signal eventDeleted()
191
192 function updateNewEventInfo(date, allDay)
193 {
194@@ -103,9 +104,12 @@
195 visible: (bottomEdge.status !== BottomEdge.Hidden)
196 onCanceled: bottomEdge.collapse()
197 bottomEdgePageStack: bottomEdge.pageStack
198- onEventAdded: {
199+ onEventSaved: {
200 bottomEdge.collapse()
201- bottomEdge.eventCreated(event)
202+ bottomEdge.eventSaved(event)
203+ }
204+ onEventDeleted: {
205+ bottomEdge.evetDeleted()
206 }
207 }
208 }
209
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 readonly property int bottomEdgeHeight: bottomEdge.hint.height
215
216 signal bottomEdgeCommitStarted()
217- signal eventCreated(var event)
218+ signal eventSaved(var event)
219+ signal eventDeleted()
220
221 function bottomEdgeCommit(date, allDay)
222 {
223@@ -41,6 +42,7 @@
224
225 pageStack: root.pageStack
226 onOpened: root.bottomEdgeCommitStarted()
227- onEventCreated: root.eventCreated(event)
228+ onEventSaved: root.eventSaved(event)
229+ onEventDeleted: root.eventDeleted()
230 }
231 }
232
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 timeLineView.returnToBounds()
238 }
239
240+ function update()
241+ {
242+ console.debug("will update model if necessary.")
243+ mainModel.updateIfNecessary()
244+ }
245+
246 Connections{
247 target: keyboardEventProvider
248 onScrollUp:{
249@@ -335,6 +341,7 @@
250 var event = dropArea.modifyEventForDrag(drop);
251 delegate.waitForModelChange()
252 delegate.model.saveItem(event);
253+ delegate.model.updateIfNecessary()
254 }
255
256 onPositionChanged: {
257
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 weekViewPath.scrollToBegginer()
263 }
264
265- onEventCreated: {
266+ onEventSaved: {
267 var scrollDate = new Date(event.startDateTime)
268 var currentWeekNumber = currentDate.weekNumber(Qt.locale().firstDayOfWeek)
269 var eventWeekNumber = scrollDate.weekNumber(Qt.locale().firstDayOfWeek)
270@@ -237,6 +237,17 @@
271 }
272 }
273
274+ // make sure that the model is updated after create a new event if it is marked as auto-update false
275+ Connections {
276+ target: weekViewPage
277+ onEventSaved: {
278+ timeLineView.update()
279+ }
280+ onEventDeleted: {
281+ timeLineView.update()
282+ }
283+ }
284+
285 //get contentY value from PathView, if its not current Item
286 Binding{
287 target: timeLineView

Subscribers

People subscribed via source and target branches

to status/vote changes: