1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
import QtQuick 2.0
import Ubuntu.Components 0.1
import "dateExt.js" as DateExt
import "dataService.js" as DataService
Item{
id: root
objectName: "DayView"
anchors.fill: parent
property var currentDay: new Date()
PathViewBase{
id: dayViewPath
objectName: "DayViewPathBase"
property var startDay: currentDay.addDays(-1)
anchors.top: parent.top
anchors.topMargin: units.gu(1.5)
width: parent.width
height: parent.height - units.gu(3)
onNextItemHighlighted: {
//next day
currentDay = currentDay.addDays(1);
}
onPreviousItemHighlighted: {
//previous day
currentDay = currentDay.addDays(-1);
}
delegate: TimeLineBaseComponent {
id: timeLineView
objectName: "DayComponent-"+index
type: typeDay
width: parent.width
height: parent.height
startDay: getStartDay().addDays(-1);
function getStartDay() {
//previous page
if (index === dayViewPath.currentIndex) {
return dayViewPath.startDay;
}
//next page
var previousIndex = dayViewPath.currentIndex > 0 ? dayViewPath.currentIndex - 1 : 2
if ( index === previousIndex ) {
return dayViewPath.startDay.addDays(2);
}
//current page
return dayViewPath.startDay.addDays(1);
}
}
}
}
|