@@ -505,25 +505,38 @@ Item {
505505 id: calendarMenu
506506
507507 Menus.CalendarMenu {
508+ id: calendarItem
508509 objectName: "calendarMenu"
509510 focus: true
510511
511512 property QtObject menuData: null
512513 property var menuModel: menuFactory.menuModel
513514 property var actionState: menuData && menuData.actionState || null
514− property int calendarDay: getExtendedProperty(actionState, "calendar-day", 0) * 1000
515+ property real calendarDay: getExtendedProperty(actionState, "calendar-day", 0)
515516 property int menuIndex: -1
516517
517518 showWeekNumbers: getExtendedProperty(actionState, "show-week-numbers", false)
518519 eventDays: getExtendedProperty(actionState, "appointment-days", [])
519520
520− Binding on currentDate {
521− when: calendarDay > 0
522− value: new Date(calendarDay)
521+ onCalendarDayChanged: {
522+ if (calendarDay > 0) {
523+ // This would trigger a selectionDateChanged signal, thus
524+ // we've to avoid that the subsequent model activation
525+ // would cause an infinite loop
526+ modelUpdateConnections.enabled = false
527+ currentDate = new Date(calendarDay * 1000)
528+ modelUpdateConnections.enabled = true
529+ }
523530 }
524531
525− onSelectedDateChanged: {
526− menuModel.activate(menuIndex, selectedDate.getTime() / 1000 | 0)
532+ Connections {
533+ id: modelUpdateConnections
534+ property bool enabled: true
535+ target: (enabled && calendarItem.visible) ? calendarItem : null
536+
537+ onSelectedDateChanged: {
538+ menuModel.activate(menuIndex, selectedDate.getTime() / 1000 | 0)
539+ }
527540 }
528541 }
529542 }