2
* Copyright (C) 2013-2014 Canonical Ltd
4
* This file is part of Ubuntu Calendar App
6
* Ubuntu Calendar App is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 3 as
8
* published by the Free Software Foundation.
10
* Ubuntu Calendar App is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import Ubuntu.Components 1.1
21
import "dateExt.js" as DateExt
22
import "ViewType.js" as ViewType
26
objectName: "weekViewPage"
28
property var dayStart: new Date();
29
property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek);
30
property bool isCurrentPage: false
32
signal dateSelected(var date);
34
Keys.forwardTo: [weekViewPath]
39
id: calendarTodayAction
40
objectName:"todaybutton"
41
iconName: "calendar-today"
42
text: i18n.tr("Today")
51
commonHeaderActions.newEventAction,
52
commonHeaderActions.showCalendarAction,
53
commonHeaderActions.reloadAction
58
objectName:"monthYearLabel"
60
text: i18n.tr(dayStart.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy")))
61
font.capitalization: Font.Capitalize
67
anchors.topMargin: units.gu(1)
72
objectName: "weekHeader"
73
type: ViewType.ViewTypeWeek
77
weekViewPage.dateSelected(date);
83
objectName: "weekViewPath"
86
height: weekViewPage.height - weekViewPath.y
88
//This is used to scroll all view together when currentItem scrolls
89
property var childContentY;
91
onNextItemHighlighted: {
93
weekHeader.incrementCurrentIndex()
96
onPreviousItemHighlighted: {
98
weekHeader.decrementCurrentIndex()
101
function nextWeek() {
102
dayStart = firstDay.addDays(7);
105
function previousWeek(){
106
dayStart = firstDay.addDays(-7);
109
delegate: TimeLineBaseComponent {
112
type: ViewType.ViewTypeWeek
115
height: parent.height
117
isActive: timeLineView.PathView.isCurrentItem
119
startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
123
onIsCurrentPageChanged:{
124
if(weekViewPage.isCurrentPage){
125
timeLineView.scrollToCurrentTime();
130
//get contentY value from PathView, if its not current Item
134
value: weekViewPath.childContentY;
135
when: !timeLineView.PathView.isCurrentItem
138
//set PathView's contentY property, if its current item
141
property: "childContentY"
143
when: timeLineView.PathView.isCurrentItem