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

« back to all changes in this revision

Viewing changes to MonthView.qml

  • Committer: Tarmac
  • Author(s): nskaggs
  • Date: 2014-03-20 14:56:32 UTC
  • mfrom: (212.1.7 revert-212)
  • Revision ID: tarmac-20140320145632-hul9eb00eot702ed
Revert rev 212. Fixes: https://bugs.launchpad.net/bugs/1294181.

Approved by Timo Jyrinki, Ubuntu Phone Apps Jenkins Bot.

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