~renatofilho/ubuntu-calendar-app/optimize

« back to all changes in this revision

Viewing changes to WeekView.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2016-02-25 18:56:52 UTC
  • Revision ID: renato.filho@canonical.com-20160225185652-jpxz0athht8svtom
Keep dates in sync btw panels.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    objectName: "weekViewPage"
27
27
 
28
28
    property var anchorDate: new Date();
29
 
    readonly property var currentDate: weekViewPath.currentItem.item.currentDate
 
29
    readonly property var currentDate: weekViewPath.currentItem.item.startDay
30
30
    readonly property var firstDayOfWeek: anchorDate.weekStart(Qt.locale().firstDayOfWeek);
31
31
    property bool isCurrentPage: false
32
32
    property var selectedDay;
50
50
        }
51
51
    }
52
52
 
 
53
    onAnchorDateChanged: {
 
54
        weekViewPath.scrollToBegginer()
 
55
        idleScroll.restart()
 
56
    }
 
57
 
53
58
    Timer {
54
59
        id: idleScroll
55
60
 
112
117
                TimeLineBaseComponent {
113
118
                    id: timeLineView
114
119
 
115
 
                    property var currentDate: new Date(startDay.getFullYear(),
116
 
                                                       startDay.getMonth(),
117
 
                                                       startDay.getDate(),
118
 
                                                       currentHour, 0, 0).addDays(currentDayOfWeek)
119
 
 
 
120
                    startDay: firstDayOfWeek.addDays((weekViewPath.loopCurrentIndex + weekViewPath.indexType(index)) * 7)
120
121
                    anchors.fill: parent
121
122
                    type: ViewType.ViewTypeWeek
122
 
                    startDay: firstDayOfWeek.addDays((weekViewPath.loopCurrentIndex + weekViewPath.indexType(index)) * 7)
123
123
                    isCurrentItem: parent.PathView.isCurrentItem
124
124
                    isActive: !weekViewPath.moving && !weekViewPath.flicking
125
125
                    keyboardEventProvider: weekViewPath
150
150
                    Connections{
151
151
                        target: calendarTodayAction
152
152
                        onTriggered:{
153
 
                            if( isActive )
 
153
                            if (isActive)
154
154
                                timeLineView.scrollTocurrentDate();
155
155
                            }
156
156
                    }