~pkunal-parmar/ubuntu-calendar-app/ICalImport

96.2.1 by Kunal Parmar
initial version
1
import QtQuick 2.0
2
import Ubuntu.Components 0.1
3
4
import "dateExt.js" as DateExt
5
114.2.1 by Kunal Parmar
dayview weekview transition added
6
PathViewBase {
7
    id: header
96.2.1 by Kunal Parmar
initial version
8
9
    readonly property int typeWeek: 0
10
    readonly property int typeDay: 1
114.2.1 by Kunal Parmar
dayview weekview transition added
11
    property int type: typeWeek
12
13
    interactive: false
14
    model:3
15
124.4.1 by Kunal Parmar
Background added to day labels
16
    height: units.gu(8)
96.2.1 by Kunal Parmar
initial version
17
    width: parent.width
96.2.2 by Kunal Parmar
final weekview and dayview
18
114.2.1 by Kunal Parmar
dayview weekview transition added
19
    property var date;
20
124.4.1 by Kunal Parmar
Background added to day labels
21
    DayHeaderBackground{
22
        height: FontUtils.sizeToPixels("medium") + units.gu(1.5)
23
    }
24
114.2.1 by Kunal Parmar
dayview weekview transition added
25
    delegate: TimeLineHeaderComponent{
114.2.3 by Kunal Parmar
dayview header changed
26
        type: header.type
27
28
        isCurrentItem: index == header.currentIndex
29
30
        width: {
31
            if( type == typeWeek ) {
32
                 parent.width
33
            } else if( type == typeDay && isCurrentItem ){
34
                (header.width/7) * 5
35
            } else {
36
                (header.width/7)
37
            }
38
        }
114.2.1 by Kunal Parmar
dayview weekview transition added
39
40
        startDay: getStartDate();
41
42
        function getStartDate() {
43
            switch(type) {
44
            case typeWeek:
45
                return getDateForWeek();
46
            case typeDay:
47
                return getDateForDay();
48
            }
49
        }
50
51
        function getDateForDay() {
52
            switch( header.indexType(index)) {
53
            case 0:
54
                return date;
55
            case -1:
114.2.3 by Kunal Parmar
dayview header changed
56
                return date.addDays(-1);
114.2.1 by Kunal Parmar
dayview weekview transition added
57
            case 1:
58
                return date.addDays(1);
59
            }
60
        }
61
62
        function getDateForWeek() {
63
            switch( header.indexType(index)) {
64
            case 0:
65
                return date;
66
            case -1:
67
                return date.addDays(14);
68
            case 1:
69
                return date.addDays(7);
96.2.1 by Kunal Parmar
initial version
70
            }
71
        }
72
    }
73
}
96.2.2 by Kunal Parmar
final weekview and dayview
74