2
import Ubuntu.Components 1.1
8
property int scrollMonth;
9
property bool isCurrentItem;
12
readonly property int minCellWidth: units.gu(30)
13
cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n)
14
{ return ((width / n >= minCellWidth) ? width / n : width / 2) })))
16
cellHeight: cellWidth * 1.4
18
model: 12 /* months in a year */
22
var today = new Date();
23
if(year == today.getFullYear()) {
24
scrollMonth = today.getMonth();
26
yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
29
//scroll in case content height changed
31
yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
34
Component.onCompleted: {
35
yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
45
yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
50
var visibleMonths = yearView.height / cellHeight;
51
if( scrollMonth >= (11 - visibleMonths)) {
52
scrollMonth = (11 - visibleMonths);
54
yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
59
width: yearView.cellWidth
60
height: yearView.cellHeight
62
sourceComponent: delegateComponent
63
asynchronous: !yearView.focus
70
anchors.margins: units.gu(0.5)
74
objectName: "monthComponent" + index
76
currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0)
78
isCurrentItem: yearView.focus
83
dayLabelFontSize:"x-small"
84
dateLabelFontSize: "medium"
85
monthLabelFontSize: "medium"
86
yearLabelFontSize: "medium"
89
yearViewPage.monthSelected(date);