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

« back to all changes in this revision

Viewing changes to TimeLineHeader.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
PathViewBase {
 
8
    id: header
 
9
 
 
10
    property int type: ViewType.ViewTypeWeek
 
11
 
 
12
    interactive: false
 
13
    model:3
 
14
 
 
15
    height: units.gu(8)
 
16
    width: parent.width
 
17
 
 
18
    property var date;
 
19
 
 
20
    signal dateSelected(var date);
 
21
 
 
22
    DayHeaderBackground{
 
23
        height: FontUtils.sizeToPixels("medium") + units.gu(1.5)
 
24
    }
 
25
 
 
26
    delegate: TimeLineHeaderComponent{
 
27
        type: header.type
 
28
 
 
29
        isCurrentItem: index == header.currentIndex
 
30
 
 
31
        width: {
 
32
            if( type == ViewType.ViewTypeWeek ) {
 
33
                 parent.width
 
34
            } else if( type == ViewType.ViewTypeDay && isCurrentItem ){
 
35
                (header.width/7) * 5
 
36
            } else {
 
37
                (header.width/7)
 
38
            }
 
39
        }
 
40
 
 
41
        startDay: getStartDate();
 
42
 
 
43
        onDateSelected: {
 
44
            header.dateSelected(date);
 
45
        }
 
46
 
 
47
        function getStartDate() {
 
48
            var indexType = header.indexType(index);
 
49
            switch(type) {
 
50
            case ViewType.ViewTypeWeek:
 
51
                return date.addDays(7*indexType);
 
52
            case ViewType.ViewTypeDay:
 
53
                return date.addDays(1*indexType);
 
54
            }
 
55
        }
 
56
    }
 
57
}
 
58