ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #09564
[Merge] lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save into lp:ubuntu-calendar-app
Renato Araujo Oliveira Filho has proposed merging lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save into lp:ubuntu-calendar-app.
Requested reviews:
Ubuntu Calendar Developers (ubuntu-calendar-dev)
For more details, see:
https://code.launchpad.net/~renatofilho/ubuntu-calendar-app/fix-model-update-after-save/+merge/297101
--
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save into lp:ubuntu-calendar-app.
=== modified file 'AgendaView.qml'
--- AgendaView.qml 2016-03-21 14:40:17 +0000
+++ AgendaView.qml 2016-06-10 18:58:14 +0000
@@ -55,6 +55,10 @@
flickable: eventList
}
+ // make sure that the model is updated after create a new event if it is marked as auto-update false
+ onEventSaved: eventListModel.updateIfNecessary()
+ onEventDeleted: eventListModel.updateIfNecessary()
+
// ListModel to hold all events for upcoming 7days.
EventListModel {
=== modified file 'DayView.qml'
--- DayView.qml 2016-03-17 01:51:25 +0000
+++ DayView.qml 2016-06-10 18:58:14 +0000
@@ -48,7 +48,7 @@
dayViewPath.scrollToBegginer()
}
- onEventCreated: {
+ onEventSaved: {
var scrollDate = new Date(event.startDateTime)
var needScroll = false
if ((currentDate.getFullYear() !== scrollDate.getFullYear()) ||
@@ -182,6 +182,12 @@
timeLineView.scrollToTime(new Date());
}
}
+ onEventSaved: {
+ timeLineView.update()
+ }
+ onEventDeleted: {
+ timeLineView.update()
+ }
}
//get contentY value from PathView, if its not current Item
=== modified file 'EventDetails.qml'
--- EventDetails.qml 2016-04-15 17:54:16 +0000
+++ EventDetails.qml 2016-06-10 18:58:14 +0000
@@ -242,7 +242,7 @@
}
pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event": event, "model":model});
- pageStack.currentPage.eventAdded.connect( function(event){
+ pageStack.currentPage.eventSaved.connect( function(event){
pageStack.pop();
})
//When event deleted from the Edit mode
=== modified file 'EventListModel.qml'
--- EventListModel.qml 2016-05-02 14:28:38 +0000
+++ EventListModel.qml 2016-06-10 18:58:14 +0000
@@ -169,6 +169,13 @@
return result
}
+ function updateIfNecessary()
+ {
+ console.debug("UpdateIfNecessary:" + eventModel)
+ if (!autoUpdate)
+ update()
+ }
+
onStartPeriodChanged: {
isLoading = true
}
=== modified file 'MonthView.qml'
--- MonthView.qml 2016-04-28 13:44:33 +0000
+++ MonthView.qml 2016-06-10 18:58:14 +0000
@@ -91,6 +91,8 @@
}
delegate: MonthWithEventsComponent {
+ id: monthDelegate
+
property var indexDate: firstDayOfAnchorDate.addMonths(monthViewPath.loopCurrentIndex + monthViewPath.indexType(index))
currentMonth: indexDate.getMonth()
@@ -109,6 +111,17 @@
onDateSelected: {
monthViewPage.dateSelected(date);
}
+
+ // make sure that the model is updated after create a new event if it is marked as auto-update false
+ Connections {
+ target: monthViewPage
+ onEventSaved: {
+ monthDelegate.update()
+ }
+ onEventDeleted: {
+ monthDelegate.update()
+ }
+ }
}
}
}
=== modified file 'MonthWithEventsComponent.qml'
--- MonthWithEventsComponent.qml 2016-04-28 17:23:21 +0000
+++ MonthWithEventsComponent.qml 2016-06-10 18:58:14 +0000
@@ -29,9 +29,17 @@
property alias autoUpdate: mainModel.autoUpdate
property var modelFilter: invalidFilter
+ function refresh() {
+ idleRefresh.reset()
+ }
+
+ function update() {
+ mainModel.updateIfNecessary()
+ }
+
onIsActiveChanged: {
if (isActive && (mainModel.filter === invalidFilter)) {
- idleRefresh.reset()
+ refresh();
}
}
@@ -48,9 +56,7 @@
repeat: false
onTriggered: {
mainModel.filter = Qt.binding(function() { return root.modelFilter } )
- if (!mainModel.autoUpdate) {
- mainModel.update()
- }
+ mainModel.updateIfNecessary()
}
}
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2016-04-06 18:46:29 +0000
+++ NewEvent.qml 2016-06-10 18:58:14 +0000
@@ -52,7 +52,7 @@
readonly property int millisecsInADay: 86400000
readonly property int millisecsInAnHour: 3600000
- signal eventAdded(var event);
+ signal eventSaved(var event);
signal eventDeleted(var event);
signal canceled()
@@ -256,7 +256,9 @@
}
model.saveItem(event)
- root.eventAdded(event);
+ root.eventSaved(event);
+ model.updateIfNecessary()
+
if (pageStack)
pageStack.pop();
}
@@ -343,6 +345,7 @@
var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteConfirmationDialog.qml"),root,{"event": event});
dialog.deleteEvent.connect( function(eventId){
model.removeItem(eventId);
+ model.updateIfNecessary()
if (pageStack)
pageStack.pop();
root.eventDeleted(eventId);
=== modified file 'NewEventBottomEdge.qml'
--- NewEventBottomEdge.qml 2016-04-13 21:23:25 +0000
+++ NewEventBottomEdge.qml 2016-06-10 18:58:14 +0000
@@ -35,7 +35,8 @@
property var _realPage: null
signal opened()
- signal eventCreated(var event)
+ signal eventSaved(var event)
+ signal eventDeleted()
function updateNewEventInfo(date, allDay)
{
@@ -103,9 +104,12 @@
visible: (bottomEdge.status !== BottomEdge.Hidden)
onCanceled: bottomEdge.collapse()
bottomEdgePageStack: bottomEdge.pageStack
- onEventAdded: {
+ onEventSaved: {
bottomEdge.collapse()
- bottomEdge.eventCreated(event)
+ bottomEdge.eventSaved(event)
+ }
+ onEventDeleted: {
+ bottomEdge.evetDeleted()
}
}
}
=== modified file 'PageWithBottomEdge.qml'
--- PageWithBottomEdge.qml 2016-03-18 00:33:43 +0000
+++ PageWithBottomEdge.qml 2016-06-10 18:58:14 +0000
@@ -28,7 +28,8 @@
readonly property int bottomEdgeHeight: bottomEdge.hint.height
signal bottomEdgeCommitStarted()
- signal eventCreated(var event)
+ signal eventSaved(var event)
+ signal eventDeleted()
function bottomEdgeCommit(date, allDay)
{
@@ -41,6 +42,7 @@
pageStack: root.pageStack
onOpened: root.bottomEdgeCommitStarted()
- onEventCreated: root.eventCreated(event)
+ onEventSaved: root.eventSaved(event)
+ onEventDeleted: root.eventDeleted()
}
}
=== modified file 'TimeLineBaseComponent.qml'
--- TimeLineBaseComponent.qml 2016-05-02 14:28:38 +0000
+++ TimeLineBaseComponent.qml 2016-06-10 18:58:14 +0000
@@ -132,6 +132,11 @@
timeLineView.returnToBounds()
}
+ function update()
+ {
+ mainModel.updateIfNecessary()
+ }
+
Connections{
target: keyboardEventProvider
onScrollUp:{
@@ -335,6 +340,7 @@
var event = dropArea.modifyEventForDrag(drop);
delegate.waitForModelChange()
delegate.model.saveItem(event);
+ delegate.model.updateIfNecessary()
}
onPositionChanged: {
=== modified file 'WeekView.qml'
--- WeekView.qml 2016-04-29 19:23:50 +0000
+++ WeekView.qml 2016-06-10 18:58:14 +0000
@@ -64,7 +64,7 @@
weekViewPath.scrollToBegginer()
}
- onEventCreated: {
+ onEventSaved: {
var scrollDate = new Date(event.startDateTime)
var currentWeekNumber = currentDate.weekNumber(Qt.locale().firstDayOfWeek)
var eventWeekNumber = scrollDate.weekNumber(Qt.locale().firstDayOfWeek)
@@ -237,6 +237,17 @@
}
}
+ // make sure that the model is updated after create a new event if it is marked as auto-update false
+ Connections {
+ target: weekViewPage
+ onEventSaved: {
+ timeLineView.update()
+ }
+ onEventDeleted: {
+ timeLineView.update()
+ }
+ }
+
//get contentY value from PathView, if its not current Item
Binding{
target: timeLineView
Follow ups