~pkunal-parmar/ubuntu-calendar-app/EventBubble-Truncation

« back to all changes in this revision

Viewing changes to TimeLineHeaderComponent.qml

  • Committer: Tarmac
  • Author(s): Kunal Parmar
  • Date: 2014-10-13 17:28:42 UTC
  • mfrom: (489.2.6 ubuntu-calendar-app)
  • Revision ID: tarmac-20141013172842-n9lhyodv3tuawt5q
Making dayview behave like something in iOS cal and also making dayview and weekview look similar.

Approved by Mihir Soni, Ubuntu Phone Apps Jenkins Bot, Alan Pope ( ͡° ͜ʖ ͡°).

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);