2
import Ubuntu.Components 0.1
3
import "dateExt.js" as DateExt
8
property var currentDayStart: (new Date()).midnight()
10
signal incrementCurrentDay
11
signal decrementCurrentDay
13
readonly property real visibleHeight: parent.height - y
17
property int currentIndexSaved: 0
18
property int currentIndex: 0
19
property var currentDayStart: (new Date()).midnight()
22
onCurrentIndexChanged: {
23
var delta = currentIndex - intern.currentIndexSaved
24
if (intern.currentIndexSaved == count - 1 && currentIndex == 0) delta = 1
25
if (intern.currentIndexSaved == 0 && currentIndex == count - 1) delta = -1
26
intern.currentIndexSaved = currentIndex
27
if (delta > 0) incrementCurrentDay()
28
else decrementCurrentDay()
31
onCurrentDayStartChanged: {
32
if (!moving) intern.currentDayStart = currentDayStart
36
intern.currentDayStart = currentDayStart
37
intern.currentIndex = currentIndex
40
preferredHighlightBegin: 0.5
41
preferredHighlightEnd: 0.5
42
highlightRangeMode: PathView.StrictlyEnforceRange
45
startX: -eventView.width; startY: eventView.height / 2
46
PathLine { relativeX: eventView.width; relativeY: 0 }
47
PathLine { relativeX: eventView.width; relativeY: 0 }
48
PathLine { relativeX: eventView.width; relativeY: 0 }
51
snapMode: PathView.SnapOneItem
57
if (index == intern.currentIndex) return intern.currentDayStart
58
var previousIndex = intern.currentIndex > 0 ? intern.currentIndex - 1 : 2
59
if (index == previousIndex) return intern.currentDayStart.addDays(-1)
60
return intern.currentDayStart.addDays(1)
62
width: eventView.width
63
height: eventView.height