~ubuntu-calendar-dev/ubuntu-calendar-app/filesRestructure

« back to all changes in this revision

Viewing changes to app/views/YearView.qml

  • Committer: Mihir Soni
  • Date: 2014-10-20 15:19:10 UTC
  • mfrom: (442.2.67 trunk)
  • Revision ID: mihirsoni.123@gmail.com-20141020151910-4820r2awzt5yqmb7
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
17
 */
18
 
import QtQuick 2.0
 
18
 
 
19
import QtQuick 2.3
19
20
import Ubuntu.Components 1.1
20
21
import "../components"
21
22
 
29
30
 
30
31
    Keys.forwardTo: [yearPathView]
31
32
 
 
33
    Action {
 
34
        id: calendarTodayAction
 
35
        objectName:"todaybutton"
 
36
        iconName: "calendar-today"
 
37
        text: i18n.tr("Today")
 
38
        onTriggered: {
 
39
            currentYear = new Date().getFullYear()
 
40
        }
 
41
    }
 
42
 
 
43
    head {
 
44
        actions: [
 
45
            calendarTodayAction,
 
46
            commonHeaderActions.newEventAction,
 
47
            commonHeaderActions.showCalendarAction,
 
48
            commonHeaderActions.reloadAction
 
49
        ]
 
50
    }
 
51
 
32
52
    PathViewBase {
33
53
        id: yearPathView
34
54
        objectName: "yearPathView"
66
86
 
67
87
            onYearChanged: {
68
88
                scrollMonth = 0;
 
89
                var today = new Date();
 
90
                if(year == today.getFullYear()) {
 
91
                    scrollMonth = today.getMonth();
 
92
                }
69
93
                yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
70
94
            }
71
95
 
72
96
            //scroll in case content height changed
73
97
            onHeightChanged: {
74
 
                scrollMonth = 0;
 
98
                yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
 
99
            }
 
100
 
 
101
            Component.onCompleted: {
75
102
                yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
76
103
            }
77
104
 
99
126
                width: yearView.cellWidth
100
127
                height: yearView.cellHeight
101
128
 
102
 
                MonthComponent {
103
 
                    id: monthComponent
104
 
                    objectName: "monthComponent" + index
105
 
                    showEvents: false
106
 
                    currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0)
107
 
 
108
 
                    isYearView: true
 
129
                UbuntuShape {
109
130
                    anchors.fill: parent
110
131
                    anchors.margins: units.gu(0.5)
111
 
 
112
 
                    dayLabelFontSize:"x-small"
113
 
                    dateLabelFontSize: "medium"
114
 
                    monthLabelFontSize: "medium"
115
 
                    yearLabelFontSize: "small"
116
 
 
117
 
                    onMonthSelected: {
118
 
                       yearViewPage.monthSelected(date);
 
132
                    radius: "medium"
 
133
 
 
134
                    MonthComponent {
 
135
                        id: monthComponent
 
136
                        objectName: "monthComponent" + index
 
137
                        showEvents: false
 
138
                        currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0)
 
139
 
 
140
                        isYearView: true
 
141
                        anchors.fill: parent
 
142
 
 
143
                        dayLabelFontSize:"x-small"
 
144
                        dateLabelFontSize: "medium"
 
145
                        monthLabelFontSize: "medium"
 
146
                        yearLabelFontSize: "small"
 
147
 
 
148
                        onMonthSelected: {
 
149
                            yearViewPage.monthSelected(date);
 
150
                        }
119
151
                    }
120
152
                }
121
153
            }