Merge lp:~pkunal-parmar/ubuntu-calendar-app/Refactoring into lp:ubuntu-calendar-app

Proposed by Kunal Parmar
Status: Merged
Approved by: Mihir Soni
Approved revision: 258
Merged at revision: 254
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/Refactoring
Merge into: lp:ubuntu-calendar-app
Diff against target: 177 lines (+31/-36)
7 files modified
DayView.qml (+1/-12)
EventListModel.qml (+7/-0)
MonthComponent.qml (+13/-7)
MonthView.qml (+3/-12)
TimeLineBaseComponent.qml (+7/-3)
YearView.qml (+0/-1)
calendar.qml (+0/-1)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/Refactoring
Reviewer Review Type Date Requested Status
Mihir Soni Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+217326@code.launchpad.net

Commit message

Loading Event indicator using Loader in monthView and other minor changes

Description of the change

Loading Event indicator using Loader in monthView and other minor changes

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mihir Soni (mihirsoni) wrote :

LGTM.
Thanks kunal

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DayView.qml'
2--- DayView.qml 2014-04-11 00:21:42 +0000
3+++ DayView.qml 2014-04-26 05:02:19 +0000
4@@ -108,18 +108,7 @@
5
6 contentInteractive: timeLineView.PathView.isCurrentItem
7
8- startDay: getStartDay()
9-
10- function getStartDay() {
11- switch( dayViewPath.indexType(index)) {
12- case 0:
13- return dayViewPath.startDay;
14- case -1:
15- return dayViewPath.startDay.addDays(-1);
16- case 1:
17- return dayViewPath.startDay.addDays(1);
18- }
19- }
20+ startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
21 }
22 }
23 }
24
25=== modified file 'EventListModel.qml'
26--- EventListModel.qml 2014-04-05 04:49:47 +0000
27+++ EventListModel.qml 2014-04-26 05:02:19 +0000
28@@ -11,6 +11,13 @@
29 listeners.push(listener);
30 }
31
32+ function removeModelChangeListener(listener) {
33+ var i = listeners.indexOf(listener);
34+ if(i != -1) {
35+ listeners.splice(i, 1);
36+ }
37+ }
38+
39 function getItems(startDate, endDate){
40 return itemsByTimePeriod(startDate,endDate);
41 }
42
43=== modified file 'MonthComponent.qml'
44--- MonthComponent.qml 2014-04-19 21:46:54 +0000
45+++ MonthComponent.qml 2014-04-26 05:02:19 +0000
46@@ -57,7 +57,6 @@
47 property int todayMonth: today.getMonth()
48 property int todayYear: today.getFullYear()
49
50-
51 //date from month will start, this date might be from previous month
52 property var monthStart: currentMonth.weekStart( Qt.locale().firstDayOfWeek )
53 property int monthStartDate: monthStart.getDate()
54@@ -210,15 +209,12 @@
55 }
56 }
57
58- Rectangle {
59- width: units.gu(1)
60- height: width
61- radius: height/2
62- color:"#5E2750"
63- visible: showEvents
64+ Loader{
65+ property bool shouldLoad: showEvents
66 && intern.eventStatus !== undefined
67 && intern.eventStatus[index] !== undefined
68 &&intern.eventStatus[index]
69+ sourceComponent: shouldLoad ? eventIndicatorComp : undefined
70 anchors.top: dateLabel.bottom
71 anchors.horizontalCenter: dateLabel.horizontalCenter
72 }
73@@ -251,6 +247,16 @@
74 }
75
76 Component{
77+ id: eventIndicatorComp
78+ Rectangle {
79+ width: units.gu(1)
80+ height: width
81+ radius: height/2
82+ color:"#5E2750"
83+ }
84+ }
85+
86+ Component{
87 id: dafaultDayLabelComponent
88
89 Label{
90
91=== modified file 'MonthView.qml'
92--- MonthView.qml 2014-04-19 21:46:54 +0000
93+++ MonthView.qml 2014-04-26 05:02:19 +0000
94@@ -51,20 +51,11 @@
95 width: parent.width - units.gu(5)
96 height: parent.height - units.gu(5)
97
98- currentMonth: getMonthDate();
99+ currentMonth: monthViewPath.addMonth(monthViewPath.startMonth,
100+ monthViewPath.indexType(index));
101+
102 isYearView: false
103
104- function getMonthDate() {
105- switch( monthViewPath.indexType(index)) {
106- case 0:
107- return monthViewPath.addMonth(monthViewPath.startMonth, 0);
108- case -1:
109- return monthViewPath.addMonth(monthViewPath.startMonth, -1);
110- case 1:
111- return monthViewPath.addMonth(monthViewPath.startMonth, 1);
112- }
113- }
114-
115 onDateSelected: {
116 monthViewPage.dateSelected(date);
117 }
118
119=== modified file 'TimeLineBaseComponent.qml'
120--- TimeLineBaseComponent.qml 2014-04-19 21:21:52 +0000
121+++ TimeLineBaseComponent.qml 2014-04-26 05:02:19 +0000
122@@ -19,9 +19,7 @@
123 property int scrollHour;
124
125 function scrollToCurrentTime() {
126- //scroll to current time
127 var currentTime = new Date();
128- //TODO: if current time is early morning should we show time from 9 am ?
129 scrollHour = currentTime.getHours();
130
131 timeLineView.contentY = scrollHour * units.gu(10);
132@@ -76,7 +74,10 @@
133 startDay: root.startDay
134 model: mainModel
135 Component.onCompleted: {
136- model.addModelChangeListener(createAllDayEvents);
137+ mainModel.addModelChangeListener(createAllDayEvents);
138+ }
139+ Component.onDestruction: {
140+ mainModel.removeModelChangeListener(createAllDayEvents);
141 }
142 }
143
144@@ -122,6 +123,9 @@
145 Component.onCompleted: {
146 model.addModelChangeListener(createEvents);
147 }
148+ Component.onDestruction: {
149+ model.removeModelChangeListener(createEvents);
150+ }
151 }
152 }
153 }
154
155=== modified file 'YearView.qml'
156--- YearView.qml 2014-04-19 21:46:54 +0000
157+++ YearView.qml 2014-04-26 05:02:19 +0000
158@@ -56,7 +56,6 @@
159 yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
160 }
161
162-
163 Connections{
164 target: pathView
165 onScrollUp: {
166
167=== modified file 'calendar.qml'
168--- calendar.qml 2014-04-19 21:22:21 +0000
169+++ calendar.qml 2014-04-26 05:02:19 +0000
170@@ -290,7 +290,6 @@
171 onLoaded: {
172 item.tools = Qt.binding(function() { return commonToolBar })
173 item.currentMonth = tabs.currentDay.midnight();
174- print("onLoaded:"+ tabs.currentDay);
175 }
176
177 anchors{

Subscribers

People subscribed via source and target branches

to status/vote changes: