~pkunal-parmar/ubuntu-calendar-app/ICalImport

« back to all changes in this revision

Viewing changes to WeekView.qml

  • Committer: Kunal Parmar
  • Date: 2014-10-20 15:24:00 UTC
  • mto: This revision was merged to the branch mainline in revision 510.
  • Revision ID: pkunal.parmar@gmail.com-20141020152400-qmnaosfevqpior9h
removed commented out code

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
            calendarTodayAction,
51
51
            commonHeaderActions.newEventAction,
52
52
            commonHeaderActions.showCalendarAction,
53
 
            commonHeaderActions.reloadAction,
54
 
            commonHeaderActions.syncCalendarAction
 
53
            commonHeaderActions.reloadAction
55
54
        ]
56
55
 
57
56
        contents: Label {
63
62
        }
64
63
    }
65
64
 
66
 
    PathViewBase{
67
 
        id: weekViewPath
68
 
        objectName: "weekviewpathbase"
69
 
 
 
65
    Column {
70
66
        anchors.fill: parent
71
 
 
72
 
        //This is used to scroll all view together when currentItem scrolls
73
 
        property var childContentY;
74
 
 
75
 
        onNextItemHighlighted: {
76
 
            nextWeek();
77
 
        }
78
 
 
79
 
        onPreviousItemHighlighted: {
80
 
            previousWeek();
81
 
        }
82
 
 
83
 
        function nextWeek() {
84
 
            dayStart = firstDay.addDays(7);
85
 
        }
86
 
 
87
 
        function previousWeek(){
88
 
            dayStart = firstDay.addDays(-7);
89
 
        }
90
 
 
91
 
        delegate: Loader {
92
 
            id: timelineLoader
 
67
        anchors.topMargin: units.gu(1)
 
68
        spacing: units.gu(1)
 
69
 
 
70
        TimeLineHeader{
 
71
            id: weekHeader
 
72
            objectName: "weekHeader"
 
73
            type: ViewType.ViewTypeWeek
 
74
            date: firstDay
 
75
 
 
76
            onDateSelected: {
 
77
                weekViewPage.dateSelected(date);
 
78
            }
 
79
        }
 
80
 
 
81
        PathViewBase{
 
82
            id: weekViewPath
 
83
            objectName: "weekViewPath"
 
84
 
93
85
            width: parent.width
94
 
            height: parent.height
95
 
            asynchronous: !weekViewPath.isCurrentItem
96
 
            sourceComponent: delegateComponent
97
 
 
98
 
            Component{
99
 
                id: delegateComponent
100
 
 
101
 
                TimeLineBaseComponent {
102
 
                    id: timeLineView
103
 
 
104
 
                    type: ViewType.ViewTypeWeek
105
 
                    anchors.fill: parent
106
 
                    isActive: parent.PathView.isCurrentItem
107
 
                    startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
108
 
                    keyboardEventProvider: weekViewPath
109
 
 
110
 
                    Component.onCompleted: {
 
86
            height: weekViewPage.height - weekViewPath.y
 
87
 
 
88
            //This is used to scroll all view together when currentItem scrolls
 
89
            property var childContentY;
 
90
 
 
91
            onNextItemHighlighted: {
 
92
                nextWeek();
 
93
                weekHeader.incrementCurrentIndex()
 
94
            }
 
95
 
 
96
            onPreviousItemHighlighted: {
 
97
                previousWeek();
 
98
                weekHeader.decrementCurrentIndex()
 
99
            }
 
100
 
 
101
            function nextWeek() {
 
102
                dayStart = firstDay.addDays(7);
 
103
            }
 
104
 
 
105
            function previousWeek(){
 
106
                dayStart = firstDay.addDays(-7);
 
107
            }
 
108
 
 
109
            delegate: TimeLineBaseComponent {
 
110
                id: timeLineView
 
111
 
 
112
                type: ViewType.ViewTypeWeek
 
113
 
 
114
                width: parent.width
 
115
                height: parent.height
 
116
 
 
117
                isActive: timeLineView.PathView.isCurrentItem
 
118
 
 
119
                startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
 
120
 
 
121
                Connections{
 
122
                    target: weekViewPage
 
123
                    onIsCurrentPageChanged:{
111
124
                        if(weekViewPage.isCurrentPage){
112
125
                            timeLineView.scrollToCurrentTime();
113
 
                            timeLineView.scrollTocurrentDate();
114
 
                        }
115
 
                    }
116
 
 
117
 
                    onIsActiveChanged: {
118
 
                        timeLineView.scrollTocurrentDate();
119
 
                    }
120
 
 
121
 
                    onDateSelected: {
122
 
                        weekViewPage.dateSelected(date);
123
 
                    }
124
 
 
125
 
                    Connections{
126
 
                        target: calendarTodayAction
127
 
                        onTriggered:{
128
 
                            if( isActive )
129
 
                                timeLineView.scrollTocurrentDate();
130
 
                        }
131
 
                    }
132
 
 
133
 
                    Connections{
134
 
                        target: weekViewPage
135
 
                        onIsCurrentPageChanged:{
136
 
                            if(weekViewPage.isCurrentPage){
137
 
                                timeLineView.scrollToCurrentTime();
138
 
                                timeLineView.scrollTocurrentDate();
139
 
                            }
140
 
                        }
141
 
                    }
142
 
 
143
 
                    //get contentY value from PathView, if its not current Item
144
 
                    Binding{
145
 
                        target: timeLineView
146
 
                        property: "contentY"
147
 
                        value: weekViewPath.childContentY;
148
 
                        when: !parent.PathView.isCurrentItem
149
 
                    }
150
 
 
151
 
                    //set PathView's contentY property, if its current item
152
 
                    Binding{
153
 
                        target: weekViewPath
154
 
                        property: "childContentY"
155
 
                        value: contentY
156
 
                        when: parent.PathView.isCurrentItem
157
 
                    }
 
126
                        }
 
127
                    }
 
128
                }
 
129
 
 
130
                //get contentY value from PathView, if its not current Item
 
131
                Binding{
 
132
                    target: timeLineView
 
133
                    property: "contentY"
 
134
                    value: weekViewPath.childContentY;
 
135
                    when: !timeLineView.PathView.isCurrentItem
 
136
                }
 
137
 
 
138
                //set PathView's contentY property, if its current item
 
139
                Binding{
 
140
                    target: weekViewPath
 
141
                    property: "childContentY"
 
142
                    value: contentY
 
143
                    when: timeLineView.PathView.isCurrentItem
158
144
                }
159
145
            }
160
146
        }