~pkunal-parmar/ubuntu-calendar-app/Minor-Performance

400.1.1 by mihirsoni-123
Added copyright header comments in all the pages
1
/*
400.1.2 by mihirsoni-123
updated copyright year
2
 * Copyright (C) 2013-2014 Canonical Ltd
400.1.1 by mihirsoni-123
Added copyright header comments in all the pages
3
 *
4
 * This file is part of Ubuntu Calendar App
5
 *
6
 * Ubuntu Calendar App is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License version 3 as
8
 * published by the Free Software Foundation.
9
 *
10
 * Ubuntu Calendar App is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
455.4.4 by Nekhelesh Ramananthan
Improved week views
18
19
import QtQuick 2.3
422.5.1 by Akiva Avraham
Upgraded component library imports
20
import Ubuntu.Components 1.1
114.2.2 by Kunal Parmar
added missing file
21
import "dateExt.js" as DateExt
191.4.1 by Kunal Parmar
Applying changes
22
import "ViewType.js" as ViewType
114.2.2 by Kunal Parmar
added missing file
23
124.4.1 by Kunal Parmar
Background added to day labels
24
Row{
25
    id: header
114.2.2 by Kunal Parmar
added missing file
26
191.4.1 by Kunal Parmar
Applying changes
27
    property int type: ViewType.ViewTypeWeek
114.2.2 by Kunal Parmar
added missing file
28
29
    property var startDay: DateExt.today();
114.2.3 by Kunal Parmar
dayview header changed
30
    property bool isCurrentItem: false
489.2.1 by Kunal Parmar
Dayview like iOS
31
    property var currentDay
114.2.2 by Kunal Parmar
added missing file
32
221.2.1 by Jason Gerlowski
Clicking on a day in 'Week' tab brings up that day in 'Day' tab
33
    signal dateSelected(var date);
34
114.2.2 by Kunal Parmar
added missing file
35
    width: parent.width
36
124.4.1 by Kunal Parmar
Background added to day labels
37
    Repeater{
489.2.1 by Kunal Parmar
Dayview like iOS
38
        model: 7
124.4.1 by Kunal Parmar
Background added to day labels
39
40
        delegate: HeaderDateComponent{
41
            date: startDay.addDays(index);
489.2.1 by Kunal Parmar
Dayview like iOS
42
            dayFormat: Locale.ShortFormat
124.4.1 by Kunal Parmar
Background added to day labels
43
455.4.4 by Nekhelesh Ramananthan
Improved week views
44
            dayColor: {
191.4.1 by Kunal Parmar
Applying changes
45
                if( type == ViewType.ViewTypeWeek && date.isSameDay(DateExt.today())){
455.4.4 by Nekhelesh Ramananthan
Improved week views
46
                    UbuntuColors.orange
489.2.1 by Kunal Parmar
Dayview like iOS
47
                } else if( type == ViewType.ViewTypeDay && date.isSameDay(currentDay) ) {
455.4.4 by Nekhelesh Ramananthan
Improved week views
48
                    UbuntuColors.orange
124.4.1 by Kunal Parmar
Background added to day labels
49
                } else {
455.4.4 by Nekhelesh Ramananthan
Improved week views
50
                    UbuntuColors.darkGrey
124.4.1 by Kunal Parmar
Background added to day labels
51
                }
52
            }
53
489.2.1 by Kunal Parmar
Dayview like iOS
54
            width: header.width/7
221.2.1 by Jason Gerlowski
Clicking on a day in 'Week' tab brings up that day in 'Day' tab
55
56
            onDateSelected: {
57
                header.dateSelected(date);
58
            }
114.2.2 by Kunal Parmar
added missing file
59
        }
60
    }
61
}
124.4.1 by Kunal Parmar
Background added to day labels
62