~mihirsoni/ubuntu-calendar-app/dateSelectNewEventTest

« back to all changes in this revision

Viewing changes to TimeLineHeaderComponent.qml

  • Committer: Kunal Parmar
  • Date: 2014-10-03 04:15:55 UTC
  • mto: This revision was merged to the branch mainline in revision 498.
  • Revision ID: pkunal.parmar@gmail.com-20141003041555-fvk6rqflur745dlr
Dayview like iOS

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
    property var startDay: DateExt.today();
30
30
    property bool isCurrentItem: false
 
31
    property var currentDay
31
32
 
32
33
    signal dateSelected(var date);
33
34
 
34
35
    width: parent.width
35
36
 
36
37
    Repeater{
37
 
        model: type == ViewType.ViewTypeWeek ? 7 : 1
 
38
        model: 7
38
39
 
39
40
        delegate: HeaderDateComponent{
40
41
            date: startDay.addDays(index);
41
 
            dayFormat: {
42
 
                if( type == ViewType.ViewTypeWeek || (type == ViewType.ViewTypeDay && !header.isCurrentItem) ) {
43
 
                    Locale.ShortFormat
44
 
                } else {
45
 
                    Locale.LongFormat
46
 
                }
47
 
            }
 
42
            dayFormat: Locale.ShortFormat
48
43
 
49
44
            dayColor: {
50
45
                if( type == ViewType.ViewTypeWeek && date.isSameDay(DateExt.today())){
51
46
                    UbuntuColors.orange
52
 
                } else if( type == ViewType.ViewTypeDay && header.isCurrentItem ) {
 
47
                } else if( type == ViewType.ViewTypeDay && date.isSameDay(currentDay) ) {
53
48
                    UbuntuColors.orange
54
49
                } else {
55
50
                    UbuntuColors.darkGrey
56
51
                }
57
52
            }
58
53
 
59
 
            width: {
60
 
                if( type == ViewType.ViewTypeWeek ) {
61
 
                    header.width/7
62
 
                } else {
63
 
                    header.width
64
 
                }
65
 
            }
 
54
            width: header.width/7
66
55
 
67
56
            onDateSelected: {
68
57
                header.dateSelected(date);