Merge lp:~pkunal-parmar/ubuntu-calendar-app/SyncSelection into lp:ubuntu-calendar-app
- SyncSelection
- Merge into trunk
Proposed by
Kunal Parmar
Status: | Merged |
---|---|
Approved by: | Mihir Soni |
Approved revision: | 713 |
Merged at revision: | 715 |
Proposed branch: | lp:~pkunal-parmar/ubuntu-calendar-app/SyncSelection |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
342 lines (+104/-4) 9 files modified
MonthComponent.qml (+24/-2) MonthComponentDateDelegate.qml (+1/-0) MonthView.qml (+7/-0) TimeLineBaseComponent.qml (+7/-0) TimeLineHeader.qml (+14/-0) TimeLineHeaderComponent.qml (+18/-2) WeekView.qml (+7/-0) calendar.qml (+11/-0) dateExt.js (+15/-0) |
To merge this branch: | bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/SyncSelection |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mihir Soni | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+270237@code.launchpad.net |
Commit message
resolves Bug #1475747
Description of the change
resolves Bug #1475747
To post a comment you must log in.
- 713. By Kunal Parmar
-
print statement removed
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 : | # |
Looks good to me !
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'MonthComponent.qml' | |||
2 | --- MonthComponent.qml 2015-08-03 04:32:33 +0000 | |||
3 | +++ MonthComponent.qml 2015-09-05 05:34:16 +0000 | |||
4 | @@ -30,6 +30,7 @@ | |||
5 | 30 | 30 | ||
6 | 31 | property var currentMonth; | 31 | property var currentMonth; |
7 | 32 | property var isYearView; | 32 | property var isYearView; |
8 | 33 | property var selectedDay; | ||
9 | 33 | 34 | ||
10 | 34 | property string dayLabelFontSize: "medium" | 35 | property string dayLabelFontSize: "medium" |
11 | 35 | property string dateLabelFontSize: "large" | 36 | property string dateLabelFontSize: "large" |
12 | @@ -40,7 +41,8 @@ | |||
13 | 40 | property alias dateLabelDelegate : dateLabelRepeater.delegate | 41 | property alias dateLabelDelegate : dateLabelRepeater.delegate |
14 | 41 | 42 | ||
15 | 42 | signal monthSelected(var date); | 43 | signal monthSelected(var date); |
17 | 43 | signal dateSelected(var date) | 44 | signal dateSelected(var date); |
18 | 45 | signal dateHighlighted(var date); | ||
19 | 44 | 46 | ||
20 | 45 | //creatng timer only if we need to show events in month | 47 | //creatng timer only if we need to show events in month |
21 | 46 | Loader { | 48 | Loader { |
22 | @@ -90,6 +92,7 @@ | |||
23 | 90 | property int todayMonth: today.getMonth() | 92 | property int todayMonth: today.getMonth() |
24 | 91 | property int todayYear: today.getFullYear() | 93 | property int todayYear: today.getFullYear() |
25 | 92 | 94 | ||
26 | 95 | |||
27 | 93 | //date from month will start, this date might be from previous month | 96 | //date from month will start, this date might be from previous month |
28 | 94 | property var monthStart: currentMonth.weekStart( Qt.locale().firstDayOfWeek ) | 97 | property var monthStart: currentMonth.weekStart( Qt.locale().firstDayOfWeek ) |
29 | 95 | property int monthStartDate: monthStart.getDate() | 98 | property int monthStartDate: monthStart.getDate() |
30 | @@ -113,10 +116,29 @@ | |||
31 | 113 | property int dayFontSize: FontUtils.sizeToPixels(root.dayLabelFontSize) | 116 | property int dayFontSize: FontUtils.sizeToPixels(root.dayLabelFontSize) |
32 | 114 | 117 | ||
33 | 115 | property int selectedIndex: -1 | 118 | property int selectedIndex: -1 |
34 | 119 | |||
35 | 120 | function findSelectedDayIndex(){ | ||
36 | 121 | if(!selectedDay) { | ||
37 | 122 | return -1; | ||
38 | 123 | } | ||
39 | 124 | |||
40 | 125 | if( todayMonth === selectedDay.getMonth() && selectedDay.getFullYear() === todayYear){ | ||
41 | 126 | return selectedDay.getDate() + | ||
42 | 127 | (Date.daysInMonth(monthStartYear, monthStartMonth) - monthStartDate); | ||
43 | 128 | } else { | ||
44 | 129 | return -1; | ||
45 | 130 | } | ||
46 | 131 | } | ||
47 | 132 | } | ||
48 | 133 | |||
49 | 134 | onSelectedDayChanged: { | ||
50 | 135 | if( isCurrentItem ) { | ||
51 | 136 | intern.selectedIndex = intern.findSelectedDayIndex(); | ||
52 | 137 | } | ||
53 | 116 | } | 138 | } |
54 | 117 | 139 | ||
55 | 118 | onCurrentMonthChanged: { | 140 | onCurrentMonthChanged: { |
57 | 119 | intern.selectedIndex = -1 | 141 | intern.selectedIndex = -1; |
58 | 120 | } | 142 | } |
59 | 121 | 143 | ||
60 | 122 | Column{ | 144 | Column{ |
61 | 123 | 145 | ||
62 | === modified file 'MonthComponentDateDelegate.qml' | |||
63 | --- MonthComponentDateDelegate.qml 2015-08-20 12:14:57 +0000 | |||
64 | +++ MonthComponentDateDelegate.qml 2015-09-05 05:34:16 +0000 | |||
65 | @@ -114,6 +114,7 @@ | |||
66 | 114 | root.dateSelected(selectedDate); | 114 | root.dateSelected(selectedDate); |
67 | 115 | } else { | 115 | } else { |
68 | 116 | intern.selectedIndex = index | 116 | intern.selectedIndex = index |
69 | 117 | root.dateHighlighted(selectedDate) | ||
70 | 117 | } | 118 | } |
71 | 118 | } | 119 | } |
72 | 119 | } | 120 | } |
73 | 120 | 121 | ||
74 | === modified file 'MonthView.qml' | |||
75 | --- MonthView.qml 2015-03-01 14:01:35 +0000 | |||
76 | +++ MonthView.qml 2015-09-05 05:34:16 +0000 | |||
77 | @@ -25,8 +25,10 @@ | |||
78 | 25 | objectName: "monthViewPage" | 25 | objectName: "monthViewPage" |
79 | 26 | 26 | ||
80 | 27 | property var currentMonth: DateExt.today(); | 27 | property var currentMonth: DateExt.today(); |
81 | 28 | property var selectedDay; | ||
82 | 28 | 29 | ||
83 | 29 | signal dateSelected(var date); | 30 | signal dateSelected(var date); |
84 | 31 | signal dateHighlighted(var date); | ||
85 | 30 | 32 | ||
86 | 31 | Keys.forwardTo: [monthViewPath] | 33 | Keys.forwardTo: [monthViewPath] |
87 | 32 | 34 | ||
88 | @@ -111,11 +113,16 @@ | |||
89 | 111 | currentMonth: monthViewPath.addMonth(monthViewPath.startMonth, | 113 | currentMonth: monthViewPath.addMonth(monthViewPath.startMonth, |
90 | 112 | monthViewPath.indexType(index)); | 114 | monthViewPath.indexType(index)); |
91 | 113 | 115 | ||
92 | 116 | selectedDay: monthViewPage.selectedDay | ||
93 | 114 | isYearView: false | 117 | isYearView: false |
94 | 115 | 118 | ||
95 | 116 | onDateSelected: { | 119 | onDateSelected: { |
96 | 117 | monthViewPage.dateSelected(date); | 120 | monthViewPage.dateSelected(date); |
97 | 118 | } | 121 | } |
98 | 122 | |||
99 | 123 | onDateHighlighted: { | ||
100 | 124 | monthViewPage.dateHighlighted(date); | ||
101 | 125 | } | ||
102 | 119 | } | 126 | } |
103 | 120 | } | 127 | } |
104 | 121 | } | 128 | } |
105 | 122 | 129 | ||
106 | === modified file 'TimeLineBaseComponent.qml' | |||
107 | --- TimeLineBaseComponent.qml 2015-07-25 05:19:10 +0000 | |||
108 | +++ TimeLineBaseComponent.qml 2015-09-05 05:34:16 +0000 | |||
109 | @@ -35,6 +35,7 @@ | |||
110 | 35 | property bool isActive: false | 35 | property bool isActive: false |
111 | 36 | property alias contentY: timeLineView.contentY | 36 | property alias contentY: timeLineView.contentY |
112 | 37 | property alias contentInteractive: timeLineView.interactive | 37 | property alias contentInteractive: timeLineView.interactive |
113 | 38 | property var selectedDay; | ||
114 | 38 | 39 | ||
115 | 39 | property int type: ViewType.ViewTypeWeek | 40 | property int type: ViewType.ViewTypeWeek |
116 | 40 | 41 | ||
117 | @@ -44,6 +45,7 @@ | |||
118 | 44 | property EventListModel mainModel; | 45 | property EventListModel mainModel; |
119 | 45 | 46 | ||
120 | 46 | signal dateSelected(var date); | 47 | signal dateSelected(var date); |
121 | 48 | signal dateHighlighted(var date); | ||
122 | 47 | 49 | ||
123 | 48 | function scrollToCurrentTime() { | 50 | function scrollToCurrentTime() { |
124 | 49 | var currentTime = new Date(); | 51 | var currentTime = new Date(); |
125 | @@ -139,10 +141,15 @@ | |||
126 | 139 | contentX: timeLineView.contentX | 141 | contentX: timeLineView.contentX |
127 | 140 | type: root.type | 142 | type: root.type |
128 | 141 | isActive: root.isActive | 143 | isActive: root.isActive |
129 | 144 | selectedDay: root.selectedDay | ||
130 | 142 | 145 | ||
131 | 143 | onDateSelected: { | 146 | onDateSelected: { |
132 | 144 | root.dateSelected(date); | 147 | root.dateSelected(date); |
133 | 145 | } | 148 | } |
134 | 149 | |||
135 | 150 | onDateHighlighted: { | ||
136 | 151 | root.dateHighlighted(date); | ||
137 | 152 | } | ||
138 | 146 | } | 153 | } |
139 | 147 | 154 | ||
140 | 148 | SimpleDivider{} | 155 | SimpleDivider{} |
141 | 149 | 156 | ||
142 | === modified file 'TimeLineHeader.qml' | |||
143 | --- TimeLineHeader.qml 2015-07-25 05:19:10 +0000 | |||
144 | +++ TimeLineHeader.qml 2015-09-05 05:34:16 +0000 | |||
145 | @@ -30,8 +30,10 @@ | |||
146 | 30 | property double contentX; | 30 | property double contentX; |
147 | 31 | property int firstDayOfWeek: Qt.locale().firstDayOfWeek | 31 | property int firstDayOfWeek: Qt.locale().firstDayOfWeek |
148 | 32 | property bool isActive: false; | 32 | property bool isActive: false; |
149 | 33 | property var selectedDay; | ||
150 | 33 | 34 | ||
151 | 34 | signal dateSelected(var date); | 35 | signal dateSelected(var date); |
152 | 36 | signal dateHighlighted(var date); | ||
153 | 35 | 37 | ||
154 | 36 | width: parent.width | 38 | width: parent.width |
155 | 37 | height: units.gu(10) | 39 | height: units.gu(10) |
156 | @@ -155,10 +157,22 @@ | |||
157 | 155 | width: parent.width | 157 | width: parent.width |
158 | 156 | height: units.gu(5) | 158 | height: units.gu(5) |
159 | 157 | isCurrentItem: root.isActive | 159 | isCurrentItem: root.isActive |
160 | 160 | selectedDay: { | ||
161 | 161 | if( root.selectedDay && startDay.weekNumber(Qt.locale().firstDayOfWeek) | ||
162 | 162 | === root.selectedDay.weekNumber(Qt.locale().firstDayOfWeek)) { | ||
163 | 163 | root.selectedDay; | ||
164 | 164 | } else { | ||
165 | 165 | null; | ||
166 | 166 | } | ||
167 | 167 | } | ||
168 | 158 | 168 | ||
169 | 159 | onDateSelected: { | 169 | onDateSelected: { |
170 | 160 | root.dateSelected(date); | 170 | root.dateSelected(date); |
171 | 161 | } | 171 | } |
172 | 172 | |||
173 | 173 | onDateHighlighted: { | ||
174 | 174 | root.dateHighlighted(date); | ||
175 | 175 | } | ||
176 | 162 | } | 176 | } |
177 | 163 | 177 | ||
178 | 164 | SimpleDivider{} | 178 | SimpleDivider{} |
179 | 165 | 179 | ||
180 | === modified file 'TimeLineHeaderComponent.qml' | |||
181 | --- TimeLineHeaderComponent.qml 2015-07-25 05:19:10 +0000 | |||
182 | +++ TimeLineHeaderComponent.qml 2015-09-05 05:34:16 +0000 | |||
183 | @@ -31,27 +31,42 @@ | |||
184 | 31 | property var currentDay | 31 | property var currentDay |
185 | 32 | 32 | ||
186 | 33 | property int highlightedIndex; | 33 | property int highlightedIndex; |
187 | 34 | property var selectedDay; | ||
188 | 34 | 35 | ||
189 | 35 | signal dateSelected(var date); | 36 | signal dateSelected(var date); |
190 | 37 | signal dateHighlighted(var date); | ||
191 | 36 | 38 | ||
192 | 37 | width: parent.width | 39 | width: parent.width |
193 | 38 | height: units.gu(4) | 40 | height: units.gu(4) |
194 | 39 | 41 | ||
195 | 42 | function findSelectedDayIndex() { | ||
196 | 43 | if(!selectedDay){ | ||
197 | 44 | return -1; | ||
198 | 45 | } | ||
199 | 46 | return DateExt.daysBetween(startDay, selectedDay); | ||
200 | 47 | } | ||
201 | 48 | |||
202 | 40 | onIsCurrentItemChanged: { | 49 | onIsCurrentItemChanged: { |
203 | 41 | highlightedIndex = -1 | 50 | highlightedIndex = -1 |
204 | 42 | } | 51 | } |
205 | 43 | 52 | ||
206 | 53 | onSelectedDayChanged: { | ||
207 | 54 | if(isCurrentItem){ | ||
208 | 55 | highlightedIndex = findSelectedDayIndex() | ||
209 | 56 | } | ||
210 | 57 | } | ||
211 | 58 | |||
212 | 44 | Repeater{ | 59 | Repeater{ |
213 | 45 | model: type == ViewType.ViewTypeWeek ? 7 : 1 | 60 | model: type == ViewType.ViewTypeWeek ? 7 : 1 |
214 | 46 | 61 | ||
215 | 47 | delegate: HeaderDateComponent{ | 62 | delegate: HeaderDateComponent{ |
216 | 48 | date: type == ViewType.ViewTypeWeek ? startDay.addDays(index) : startDay | 63 | date: type == ViewType.ViewTypeWeek ? startDay.addDays(index) : startDay |
217 | 49 | dayFormat: Locale.ShortFormat | 64 | dayFormat: Locale.ShortFormat |
219 | 50 | highlighted: (type == ViewType.ViewTypeWeek) && (highlightedIndex == index) | 65 | highlighted: (type == ViewType.ViewTypeWeek) && (highlightedIndex === index) |
220 | 51 | 66 | ||
221 | 52 | dayColor: { | 67 | dayColor: { |
222 | 53 | if( type == ViewType.ViewTypeWeek && date.isSameDay(DateExt.today())){ | 68 | if( type == ViewType.ViewTypeWeek && date.isSameDay(DateExt.today())){ |
224 | 54 | header.highlightedIndex = index | 69 | //header.highlightedIndex = index |
225 | 55 | UbuntuColors.orange | 70 | UbuntuColors.orange |
226 | 56 | } /*else if( type == ViewType.ViewTypeDay && date.isSameDay(currentDay) ) { | 71 | } /*else if( type == ViewType.ViewTypeDay && date.isSameDay(currentDay) ) { |
227 | 57 | UbuntuColors.orange | 72 | UbuntuColors.orange |
228 | @@ -71,6 +86,7 @@ | |||
229 | 71 | header.dateSelected(date); | 86 | header.dateSelected(date); |
230 | 72 | } else { | 87 | } else { |
231 | 73 | header.highlightedIndex = index | 88 | header.highlightedIndex = index |
232 | 89 | header.dateHighlighted(date); | ||
233 | 74 | } | 90 | } |
234 | 75 | } | 91 | } |
235 | 76 | } | 92 | } |
236 | 77 | 93 | ||
237 | === modified file 'WeekView.qml' | |||
238 | --- WeekView.qml 2015-03-20 17:32:03 +0000 | |||
239 | +++ WeekView.qml 2015-09-05 05:34:16 +0000 | |||
240 | @@ -28,8 +28,10 @@ | |||
241 | 28 | property var dayStart: new Date(); | 28 | property var dayStart: new Date(); |
242 | 29 | property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); | 29 | property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
243 | 30 | property bool isCurrentPage: false | 30 | property bool isCurrentPage: false |
244 | 31 | property var selectedDay; | ||
245 | 31 | 32 | ||
246 | 32 | signal dateSelected(var date); | 33 | signal dateSelected(var date); |
247 | 34 | signal dateHighlighted(var date); | ||
248 | 33 | 35 | ||
249 | 34 | Keys.forwardTo: [weekViewPath] | 36 | Keys.forwardTo: [weekViewPath] |
250 | 35 | 37 | ||
251 | @@ -106,6 +108,7 @@ | |||
252 | 106 | isActive: parent.PathView.isCurrentItem | 108 | isActive: parent.PathView.isCurrentItem |
253 | 107 | startDay: firstDay.addDays( weekViewPath.indexType(index) * 7) | 109 | startDay: firstDay.addDays( weekViewPath.indexType(index) * 7) |
254 | 108 | keyboardEventProvider: weekViewPath | 110 | keyboardEventProvider: weekViewPath |
255 | 111 | selectedDay: weekViewPage.selectedDay | ||
256 | 109 | 112 | ||
257 | 110 | onIsActiveChanged: { | 113 | onIsActiveChanged: { |
258 | 111 | timeLineView.scrollTocurrentDate(); | 114 | timeLineView.scrollTocurrentDate(); |
259 | @@ -115,6 +118,10 @@ | |||
260 | 115 | weekViewPage.dateSelected(date); | 118 | weekViewPage.dateSelected(date); |
261 | 116 | } | 119 | } |
262 | 117 | 120 | ||
263 | 121 | onDateHighlighted:{ | ||
264 | 122 | weekViewPage.dateHighlighted(date); | ||
265 | 123 | } | ||
266 | 124 | |||
267 | 118 | Connections{ | 125 | Connections{ |
268 | 119 | target: calendarTodayAction | 126 | target: calendarTodayAction |
269 | 120 | onTriggered:{ | 127 | onTriggered:{ |
270 | 121 | 128 | ||
271 | === modified file 'calendar.qml' | |||
272 | --- calendar.qml 2015-06-11 12:29:28 +0000 | |||
273 | +++ calendar.qml 2015-09-05 05:34:16 +0000 | |||
274 | @@ -214,6 +214,7 @@ | |||
275 | 214 | Keys.forwardTo: [tabs.currentPage.item] | 214 | Keys.forwardTo: [tabs.currentPage.item] |
276 | 215 | 215 | ||
277 | 216 | property var currentDay: DateExt.today(); | 216 | property var currentDay: DateExt.today(); |
278 | 217 | property var selectedDay; | ||
279 | 217 | 218 | ||
280 | 218 | // Arguments on startup | 219 | // Arguments on startup |
281 | 219 | property bool newevent: false; | 220 | property bool newevent: false; |
282 | @@ -385,6 +386,7 @@ | |||
283 | 385 | source: tabs.selectedTab == monthTab ? Qt.resolvedUrl("MonthView.qml"):"" | 386 | source: tabs.selectedTab == monthTab ? Qt.resolvedUrl("MonthView.qml"):"" |
284 | 386 | onLoaded: { | 387 | onLoaded: { |
285 | 387 | item.currentMonth = tabs.currentDay.midnight(); | 388 | item.currentMonth = tabs.currentDay.midnight(); |
286 | 389 | item.selectedDay = tabs.selectedDay; | ||
287 | 388 | } | 390 | } |
288 | 389 | 391 | ||
289 | 390 | anchors{ | 392 | anchors{ |
290 | @@ -399,6 +401,10 @@ | |||
291 | 399 | tabs.currentDay = date; | 401 | tabs.currentDay = date; |
292 | 400 | tabs.selectedTabIndex = dayTab.index; | 402 | tabs.selectedTabIndex = dayTab.index; |
293 | 401 | } | 403 | } |
294 | 404 | |||
295 | 405 | onDateHighlighted:{ | ||
296 | 406 | tabs.selectedDay = date; | ||
297 | 407 | } | ||
298 | 402 | } | 408 | } |
299 | 403 | } | 409 | } |
300 | 404 | } | 410 | } |
301 | @@ -414,6 +420,7 @@ | |||
302 | 414 | onLoaded: { | 420 | onLoaded: { |
303 | 415 | item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == weekTab }) | 421 | item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == weekTab }) |
304 | 416 | item.dayStart = tabs.currentDay; | 422 | item.dayStart = tabs.currentDay; |
305 | 423 | item.selectedDay = tabs.selectedDay; | ||
306 | 417 | } | 424 | } |
307 | 418 | 425 | ||
308 | 419 | anchors{ | 426 | anchors{ |
309 | @@ -432,6 +439,10 @@ | |||
310 | 432 | tabs.currentDay = date; | 439 | tabs.currentDay = date; |
311 | 433 | tabs.selectedTabIndex = dayTab.index; | 440 | tabs.selectedTabIndex = dayTab.index; |
312 | 434 | } | 441 | } |
313 | 442 | |||
314 | 443 | onDateHighlighted:{ | ||
315 | 444 | tabs.selectedDay = date; | ||
316 | 445 | } | ||
317 | 435 | } | 446 | } |
318 | 436 | } | 447 | } |
319 | 437 | } | 448 | } |
320 | 438 | 449 | ||
321 | === modified file 'dateExt.js' | |||
322 | --- dateExt.js 2015-04-02 12:54:38 +0000 | |||
323 | +++ dateExt.js 2015-09-05 05:34:16 +0000 | |||
324 | @@ -132,3 +132,18 @@ | |||
325 | 132 | return ( date1.getFullYear() === date2.getFullYear() | 132 | return ( date1.getFullYear() === date2.getFullYear() |
326 | 133 | && date1.getMonth() === date2.getMonth() ) | 133 | && date1.getMonth() === date2.getMonth() ) |
327 | 134 | } | 134 | } |
328 | 135 | |||
329 | 136 | function daysBetween( date1, date2 ) { | ||
330 | 137 | //Get 1 day in milliseconds | ||
331 | 138 | var one_day=1000*60*60*24; | ||
332 | 139 | |||
333 | 140 | // Convert both dates to milliseconds | ||
334 | 141 | var date1_ms = date1.getTime(); | ||
335 | 142 | var date2_ms = date2.getTime(); | ||
336 | 143 | |||
337 | 144 | // Calculate the difference in milliseconds | ||
338 | 145 | var difference_ms = date2_ms - date1_ms; | ||
339 | 146 | |||
340 | 147 | // Convert back to days and return | ||
341 | 148 | return Math.round(difference_ms/one_day); | ||
342 | 149 | } |
PASSED: Continuous integration, rev:713 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 1232/ 91.189. 93.70:8080/ job/ubuntu- calendar- app-vivid- amd64-ci/ 229
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- calendar- app-ci/ 1232/rebuild
http://