~timo-jyrinki/ubuntu-calendar-app/revert_213_that_reverted_212

« back to all changes in this revision

Viewing changes to MonthView.qml

  • Committer: Timo Jyrinki
  • Date: 2014-03-24 13:56:27 UTC
  • Revision ID: timo.jyrinki@canonical.com-20140324135627-l1kr11f5avrabstp
Revert bzr213 that reverted bzr212, taking into accound conflicts in calendar.qml and WeekView.qml.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import "dateExt.js" as DateExt
4
4
import "colorUtils.js" as Color
5
5
 
6
 
Page {
7
 
    id: monthViewPage
8
 
    objectName: "MonthView"
 
6
Page{
 
7
    id: root
9
8
 
10
9
    property var currentMonth: DateExt.today();
11
 
 
12
10
    signal dateSelected(var date);
13
11
 
 
12
    anchors.fill: parent
 
13
 
14
14
    PathViewBase{
15
15
        id: monthViewPath
16
 
 
17
 
        property var startMonth: currentMonth;
18
 
 
19
 
        anchors.top:parent.top
20
 
 
21
 
        width:parent.width
22
 
        height: parent.height
 
16
        objectName: "MonthView"
 
17
        anchors.fill: parent
23
18
 
24
19
        onNextItemHighlighted: {
25
20
            nextMonth();
30
25
        }
31
26
 
32
27
        function nextMonth() {
33
 
            currentMonth = addMonth(currentMonth,1);
 
28
            currentMonth = addMonth(root.currentMonth,1);
34
29
        }
35
30
 
36
31
        function previousMonth(){
37
 
            currentMonth = addMonth(currentMonth,-1);
 
32
            currentMonth = addMonth(root.currentMonth,-1);
38
33
        }
39
34
 
40
35
        function addMonth(date,month){
54
49
            function getMonthDate() {
55
50
                switch( monthViewPath.indexType(index)) {
56
51
                case 0:
57
 
                    return monthViewPath.startMonth;
 
52
                    return monthViewPath.addMonth(root.currentMonth,0);
58
53
                case -1:
59
 
                    return monthViewPath.addMonth(monthViewPath.startMonth,-1);
 
54
                    return monthViewPath.addMonth(root.currentMonth,-1);
60
55
                case 1:
61
 
                    return monthViewPath.addMonth(monthViewPath.startMonth,1);
 
56
                    return monthViewPath.addMonth(root.currentMonth,1);
62
57
                }
63
58
            }
64
59
 
65
60
            onDateSelected: {
66
 
                monthViewPage.dateSelected(date);
 
61
                root.dateSelected(date);
67
62
            }
68
63
        }
69
64
    }