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

« back to all changes in this revision

Viewing changes to TimeLineHeaderComponent.qml

  • Committer: Launchpad Translations on behalf of ubuntu-calendar-dev
  • Date: 2014-06-09 06:30:09 UTC
  • Revision ID: launchpad_translations_on_behalf_of_ubuntu-calendar-dev-20140609063009-vf9c9x0iyl0ossr6
Launchpad automatic translations update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import Ubuntu.Components 0.1
 
3
 
 
4
import "dateExt.js" as DateExt
 
5
import "ViewType.js" as ViewType
 
6
 
 
7
 
 
8
Row{
 
9
    id: header
 
10
 
 
11
    property int type: ViewType.ViewTypeWeek
 
12
 
 
13
    property var startDay: DateExt.today();
 
14
    property bool isCurrentItem: false
 
15
 
 
16
    signal dateSelected(var date);
 
17
 
 
18
    width: parent.width
 
19
 
 
20
    Repeater{
 
21
        model: type == ViewType.ViewTypeWeek ? 7 : 1
 
22
 
 
23
        delegate: HeaderDateComponent{
 
24
            date: startDay.addDays(index);
 
25
            dayFormat: {
 
26
                if( type == ViewType.ViewTypeWeek || (type == ViewType.ViewTypeDay && !root.isCurrentItem) ) {
 
27
                    Locale.ShortFormat
 
28
                } else {
 
29
                    Locale.LongFormat
 
30
                }
 
31
            }
 
32
 
 
33
            dateColor: {
 
34
                if( type == ViewType.ViewTypeWeek && date.isSameDay(DateExt.today())){
 
35
                    "#5D5D5D"
 
36
                } else if( type == ViewType.ViewTypeDay && header.isCurrentItem ) {
 
37
                    "#5D5D5D"
 
38
                } else {
 
39
                    "#AEA79F"
 
40
                }
 
41
            }
 
42
 
 
43
            width: {
 
44
                if( type == ViewType.ViewTypeWeek ) {
 
45
                    header.width/7
 
46
                } else {
 
47
                    header.width
 
48
                }
 
49
            }
 
50
 
 
51
            onDateSelected: {
 
52
                header.dateSelected(date);
 
53
            }
 
54
        }
 
55
    }
 
56
}
 
57