400.1.1
by mihirsoni-123
Added copyright header comments in all the pages |
1 |
/*
|
400.1.2
by mihirsoni-123
updated copyright year |
2 |
* Copyright (C) 2013-2014 Canonical Ltd
|
400.1.1
by mihirsoni-123
Added copyright header comments in all the pages |
3 |
*
|
4 |
* This file is part of Ubuntu Calendar App
|
|
5 |
*
|
|
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.
|
|
9 |
*
|
|
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.
|
|
14 |
*
|
|
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/>.
|
|
17 |
*/
|
|
455.4.1
by Nekhelesh Ramananthan
Improved week view |
18 |
|
19 |
import QtQuick 2.3 |
|
422.5.1
by Akiva Avraham
Upgraded component library imports |
20 |
import Ubuntu.Components 1.1 |
69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
21 |
import "dateExt.js" as DateExt |
191.4.1
by Kunal Parmar
Applying changes |
22 |
import "ViewType.js" as ViewType |
69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
23 |
|
235.1.1
by Kunal Parmar
View to PAge |
24 |
Page{ |
338.1.4
by Nicholas Skaggs
standardize object names, tweak setups |
25 |
id: weekViewPage
|
338.1.6
by nskaggs
fix objectnames, add object passing |
26 |
objectName: "weekViewPage" |
27 |
||
114.2.1
by Kunal Parmar
dayview weekview transition added |
28 |
property var dayStart: new Date(); |
166.1.14
by nskaggs
remove extra debugging info, and sort which fails when months overlap |
29 |
property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
216.1.2
by Kunal Parmar
Refactoring |
30 |
property bool isCurrentPage: false |
31 |
||
221.2.1
by Jason Gerlowski
Clicking on a day in 'Week' tab brings up that day in 'Day' tab |
32 |
signal dateSelected(var date); |
33 |
||
183.1.1
by Kunal Parmar
Key Navigation implemented |
34 |
Keys.forwardTo: [weekViewPath] |
35 |
||
212.4.18
by Kunal Parmar
error resolved |
36 |
flickable: null |
455.4.2
by Nekhelesh Ramananthan
Merged trunk |
37 |
|
455.3.1
by Mihir Soni
Removed duplicate header section from views and added common header |
38 |
Action { |
455.4.1
by Nekhelesh Ramananthan
Improved week view |
39 |
id: calendarTodayAction
|
40 |
objectName:"todaybutton" |
|
41 |
iconName: "calendar-today" |
|
42 |
text: i18n.tr("Today") |
|
43 |
onTriggered: { |
|
455.4.2
by Nekhelesh Ramananthan
Merged trunk |
44 |
dayStart = new Date() |
455.4.1
by Nekhelesh Ramananthan
Improved week view |
45 |
}
|
46 |
}
|
|
47 |
||
48 |
head { |
|
49 |
actions: [ |
|
50 |
calendarTodayAction, |
|
51 |
commonHeaderActions.newEventAction, |
|
52 |
commonHeaderActions.showCalendarAction, |
|
53 |
commonHeaderActions.reloadAction |
|
54 |
]
|
|
55 |
||
56 |
contents: Label { |
|
57 |
id:monthYear
|
|
58 |
objectName:"monthYearLabel" |
|
59 |
fontSize: "x-large" |
|
60 |
text: i18n.tr(dayStart.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))) |
|
61 |
}
|
|
62 |
}
|
|
212.4.18
by Kunal Parmar
error resolved |
63 |
|
235.1.1
by Kunal Parmar
View to PAge |
64 |
Column { |
65 |
anchors.fill: parent |
|
455.4.1
by Nekhelesh Ramananthan
Improved week view |
66 |
anchors.topMargin: units.gu(1) |
235.1.1
by Kunal Parmar
View to PAge |
67 |
spacing: units.gu(1) |
68 |
||
69 |
TimeLineHeader{ |
|
70 |
id: weekHeader
|
|
71 |
objectName: "weekHeader" |
|
212.1.2
by nskaggs
revert to 211 |
72 |
type: ViewType.ViewTypeWeek |
235.1.1
by Kunal Parmar
View to PAge |
73 |
date: firstDay |
74 |
||
75 |
onDateSelected: { |
|
338.1.4
by Nicholas Skaggs
standardize object names, tweak setups |
76 |
weekViewPage.dateSelected(date); |
235.1.1
by Kunal Parmar
View to PAge |
77 |
}
|
78 |
}
|
|
79 |
||
80 |
PathViewBase{ |
|
81 |
id: weekViewPath
|
|
338.1.4
by Nicholas Skaggs
standardize object names, tweak setups |
82 |
objectName: "weekViewPath" |
96.2.1
by Kunal Parmar
initial version |
83 |
|
96.2.2
by Kunal Parmar
final weekview and dayview |
84 |
width: parent.width |
338.1.4
by Nicholas Skaggs
standardize object names, tweak setups |
85 |
height: weekViewPage.height - weekViewPath.y |
235.1.1
by Kunal Parmar
View to PAge |
86 |
|
87 |
//This is used to scroll all view together when currentItem scrolls
|
|
88 |
property var childContentY; |
|
89 |
||
90 |
onNextItemHighlighted: { |
|
91 |
nextWeek(); |
|
92 |
weekHeader.incrementCurrentIndex() |
|
93 |
}
|
|
94 |
||
95 |
onPreviousItemHighlighted: { |
|
96 |
previousWeek(); |
|
97 |
weekHeader.decrementCurrentIndex() |
|
98 |
}
|
|
99 |
||
100 |
function nextWeek() { |
|
101 |
dayStart = firstDay.addDays(7); |
|
102 |
}
|
|
103 |
||
104 |
function previousWeek(){ |
|
105 |
dayStart = firstDay.addDays(-7); |
|
106 |
}
|
|
107 |
||
108 |
delegate: TimeLineBaseComponent { |
|
109 |
id: timeLineView
|
|
110 |
||
111 |
type: ViewType.ViewTypeWeek |
|
112 |
||
113 |
width: parent.width |
|
114 |
height: parent.height |
|
115 |
||
295.1.1
by Kunal Parmar
Parallex fix for EventBubble |
116 |
isActive: timeLineView.PathView.isCurrentItem |
117 |
||
235.1.1
by Kunal Parmar
View to PAge |
118 |
startDay: firstDay.addDays( weekViewPath.indexType(index) * 7) |
119 |
||
120 |
Connections{ |
|
338.1.4
by Nicholas Skaggs
standardize object names, tweak setups |
121 |
target: weekViewPage |
235.1.1
by Kunal Parmar
View to PAge |
122 |
onIsCurrentPageChanged:{ |
338.1.4
by Nicholas Skaggs
standardize object names, tweak setups |
123 |
if(weekViewPage.isCurrentPage){ |
235.1.1
by Kunal Parmar
View to PAge |
124 |
timeLineView.scrollToCurrentTime(); |
125 |
}
|
|
216.1.2
by Kunal Parmar
Refactoring |
126 |
}
|
127 |
}
|
|
235.1.1
by Kunal Parmar
View to PAge |
128 |
|
129 |
//get contentY value from PathView, if its not current Item
|
|
130 |
Binding{ |
|
131 |
target: timeLineView |
|
132 |
property: "contentY" |
|
133 |
value: weekViewPath.childContentY; |
|
134 |
when: !timeLineView.PathView.isCurrentItem |
|
135 |
}
|
|
136 |
||
137 |
//set PathView's contentY property, if its current item
|
|
138 |
Binding{ |
|
139 |
target: weekViewPath |
|
140 |
property: "childContentY" |
|
141 |
value: contentY |
|
142 |
when: timeLineView.PathView.isCurrentItem |
|
143 |
}
|
|
216.1.1
by Kunal Parmar
scroll to currnt time |
144 |
}
|
69.1.1
by Kunal Parmar
Initial WeekRibbon and WeekView implementation |
145 |
}
|
146 |
}
|
|
147 |
}
|