Merge lp:~timo-jyrinki/ubuntu-calendar-app/revert_213_that_reverted_212 into lp:ubuntu-calendar-app
- revert_213_that_reverted_212
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Timo Jyrinki |
Proposed branch: | lp:~timo-jyrinki/ubuntu-calendar-app/revert_213_that_reverted_212 |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
741 lines (+266/-223) 8 files modified
DayView.qml (+3/-4) MonthView.qml (+12/-17) WeekView.qml (+74/-76) YearView.qml (+63/-61) calendar.qml (+100/-49) tests/autopilot/calendar_app/emulators.py (+0/-3) tests/autopilot/calendar_app/tests/__init__.py (+1/-4) tests/autopilot/calendar_app/tests/test_calendar.py (+13/-9) |
To merge this branch: | bzr merge lp:~timo-jyrinki/ubuntu-calendar-app/revert_213_that_reverted_212 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Roman Shchekin (community) | Needs Fixing | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Ubuntu Calendar Developers | Pending | ||
Review via email: mp+212422@code.launchpad.net |
Commit message
Revert bzr213 that reverted bzr212, taking into account conflicts in calendar.qml and WeekView.qml.
Description of the change
The qtdeclarative upload https:/
Note that because of newer commits 217, 219 and 220 there were conflicts in WeekView.qml and calendar.qml which I tried to workaround.
The original commit that was temporarily reverted was this one:
http://
Timo Jyrinki (timo-jyrinki) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:221
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Roman Shchekin (mrqtros) wrote : | # |
Throws a lot of errors similar to
"ReferenceError: yearView is not defined".
Timo Jyrinki (timo-jyrinki) wrote : | # |
Right. It seems to conflict with current trunk again. I think it'd be best revisited by the original author of the LoaderPage branch.
Unmerged revisions
- 221. By Timo Jyrinki
-
Revert bzr213 that reverted bzr212, taking into accound conflicts in calendar.qml and WeekView.qml.
Preview Diff
1 | === modified file 'DayView.qml' | |||
2 | --- DayView.qml 2014-03-22 04:43:11 +0000 | |||
3 | +++ DayView.qml 2014-03-24 13:57:47 +0000 | |||
4 | @@ -4,7 +4,8 @@ | |||
5 | 4 | import "dateExt.js" as DateExt | 4 | import "dateExt.js" as DateExt |
6 | 5 | import "ViewType.js" as ViewType | 5 | import "ViewType.js" as ViewType |
7 | 6 | 6 | ||
9 | 7 | Item{ | 7 | |
10 | 8 | Page{ | ||
11 | 8 | id: root | 9 | id: root |
12 | 9 | objectName: "DayView" | 10 | objectName: "DayView" |
13 | 10 | 11 | ||
14 | @@ -13,13 +14,11 @@ | |||
15 | 13 | 14 | ||
16 | 14 | Column { | 15 | Column { |
17 | 15 | id: column | 16 | id: column |
18 | 17 | anchors.fill: parent | ||
19 | 16 | anchors.top: parent.top | 18 | anchors.top: parent.top |
20 | 17 | anchors.topMargin: units.gu(1.5) | 19 | anchors.topMargin: units.gu(1.5) |
21 | 18 | width: parent.width; height: parent.height | ||
22 | 19 | spacing: units.gu(1) | 20 | spacing: units.gu(1) |
23 | 20 | 21 | ||
24 | 21 | anchors.fill: parent | ||
25 | 22 | |||
26 | 23 | ViewHeader{ | 22 | ViewHeader{ |
27 | 24 | id: viewHeader | 23 | id: viewHeader |
28 | 25 | date: currentDay | 24 | date: currentDay |
29 | 26 | 25 | ||
30 | === modified file 'MonthView.qml' | |||
31 | --- MonthView.qml 2014-03-19 19:46:58 +0000 | |||
32 | +++ MonthView.qml 2014-03-24 13:57:47 +0000 | |||
33 | @@ -3,23 +3,18 @@ | |||
34 | 3 | import "dateExt.js" as DateExt | 3 | import "dateExt.js" as DateExt |
35 | 4 | import "colorUtils.js" as Color | 4 | import "colorUtils.js" as Color |
36 | 5 | 5 | ||
40 | 6 | Page { | 6 | Page{ |
41 | 7 | id: monthViewPage | 7 | id: root |
39 | 8 | objectName: "MonthView" | ||
42 | 9 | 8 | ||
43 | 10 | property var currentMonth: DateExt.today(); | 9 | property var currentMonth: DateExt.today(); |
44 | 11 | |||
45 | 12 | signal dateSelected(var date); | 10 | signal dateSelected(var date); |
46 | 13 | 11 | ||
47 | 12 | anchors.fill: parent | ||
48 | 13 | |||
49 | 14 | PathViewBase{ | 14 | PathViewBase{ |
50 | 15 | id: monthViewPath | 15 | id: monthViewPath |
58 | 16 | 16 | objectName: "MonthView" | |
59 | 17 | property var startMonth: currentMonth; | 17 | anchors.fill: parent |
53 | 18 | |||
54 | 19 | anchors.top:parent.top | ||
55 | 20 | |||
56 | 21 | width:parent.width | ||
57 | 22 | height: parent.height | ||
60 | 23 | 18 | ||
61 | 24 | onNextItemHighlighted: { | 19 | onNextItemHighlighted: { |
62 | 25 | nextMonth(); | 20 | nextMonth(); |
63 | @@ -30,11 +25,11 @@ | |||
64 | 30 | } | 25 | } |
65 | 31 | 26 | ||
66 | 32 | function nextMonth() { | 27 | function nextMonth() { |
68 | 33 | currentMonth = addMonth(currentMonth,1); | 28 | currentMonth = addMonth(root.currentMonth,1); |
69 | 34 | } | 29 | } |
70 | 35 | 30 | ||
71 | 36 | function previousMonth(){ | 31 | function previousMonth(){ |
73 | 37 | currentMonth = addMonth(currentMonth,-1); | 32 | currentMonth = addMonth(root.currentMonth,-1); |
74 | 38 | } | 33 | } |
75 | 39 | 34 | ||
76 | 40 | function addMonth(date,month){ | 35 | function addMonth(date,month){ |
77 | @@ -54,16 +49,16 @@ | |||
78 | 54 | function getMonthDate() { | 49 | function getMonthDate() { |
79 | 55 | switch( monthViewPath.indexType(index)) { | 50 | switch( monthViewPath.indexType(index)) { |
80 | 56 | case 0: | 51 | case 0: |
82 | 57 | return monthViewPath.startMonth; | 52 | return monthViewPath.addMonth(root.currentMonth,0); |
83 | 58 | case -1: | 53 | case -1: |
85 | 59 | return monthViewPath.addMonth(monthViewPath.startMonth,-1); | 54 | return monthViewPath.addMonth(root.currentMonth,-1); |
86 | 60 | case 1: | 55 | case 1: |
88 | 61 | return monthViewPath.addMonth(monthViewPath.startMonth,1); | 56 | return monthViewPath.addMonth(root.currentMonth,1); |
89 | 62 | } | 57 | } |
90 | 63 | } | 58 | } |
91 | 64 | 59 | ||
92 | 65 | onDateSelected: { | 60 | onDateSelected: { |
94 | 66 | monthViewPage.dateSelected(date); | 61 | root.dateSelected(date); |
95 | 67 | } | 62 | } |
96 | 68 | } | 63 | } |
97 | 69 | } | 64 | } |
98 | 70 | 65 | ||
99 | === modified file 'WeekView.qml' | |||
100 | --- WeekView.qml 2014-03-23 14:27:31 +0000 | |||
101 | +++ WeekView.qml 2014-03-24 13:57:47 +0000 | |||
102 | @@ -4,75 +4,87 @@ | |||
103 | 4 | import "dateExt.js" as DateExt | 4 | import "dateExt.js" as DateExt |
104 | 5 | import "ViewType.js" as ViewType | 5 | import "ViewType.js" as ViewType |
105 | 6 | 6 | ||
107 | 7 | Column { | 7 | Page{ |
108 | 8 | id: root | 8 | id: root |
109 | 9 | objectName: "WeekView" | ||
110 | 10 | |||
111 | 11 | property var dayStart: new Date(); | 9 | property var dayStart: new Date(); |
112 | 12 | property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); | 10 | property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek); |
113 | 13 | property bool isCurrentPage: false | 11 | property bool isCurrentPage: false |
114 | 14 | 12 | ||
169 | 15 | anchors.top: parent.top | 13 | Column { |
170 | 16 | anchors.topMargin: units.gu(1.5) | 14 | objectName: "WeekView" |
171 | 17 | spacing: units.gu(1) | 15 | |
172 | 18 | 16 | anchors.fill: parent | |
173 | 19 | anchors.fill: parent | 17 | anchors.top: parent.top |
174 | 20 | 18 | anchors.topMargin: units.gu(1.5) | |
175 | 21 | ViewHeader{ | 19 | spacing: units.gu(1) |
176 | 22 | id: viewHeader | 20 | |
177 | 23 | date: dayStart | 21 | ViewHeader{ |
178 | 24 | } | 22 | id: viewHeader |
179 | 25 | 23 | date: dayStart | |
180 | 26 | TimeLineHeader{ | 24 | } |
181 | 27 | id: weekHeader | 25 | |
182 | 28 | objectName: "weekHeader" | 26 | TimeLineHeader{ |
183 | 29 | type: ViewType.ViewTypeWeek | 27 | id: weekHeader |
184 | 30 | date: weekViewPath.weekStart | 28 | objectName: "weekHeader" |
185 | 31 | } | 29 | type: typeWeek |
186 | 32 | 30 | date: weekViewPath.weekStart | |
187 | 33 | PathViewBase{ | 31 | } |
188 | 34 | id: weekViewPath | 32 | |
189 | 35 | 33 | PathViewBase{ | |
190 | 36 | property var visibleWeek: dayStart.weekStart(Qt.locale().firstDayOfWeek); | 34 | id: weekViewPath |
191 | 37 | property var weekStart: weekViewPath.visibleWeek | 35 | |
192 | 38 | 36 | //This is used to scroll all view together when currentItem scrolls | |
193 | 39 | width: parent.width | 37 | property var childContentY; |
194 | 40 | height: root.height - weekViewPath.y | 38 | |
195 | 41 | 39 | property var visibleWeek: root.dayStart.weekStart(Qt.locale().firstDayOfWeek); | |
196 | 42 | //This is used to scroll all view together when currentItem scrolls | 40 | property var weekStart: weekViewPath.visibleWeek |
143 | 43 | property var childContentY; | ||
144 | 44 | |||
145 | 45 | onNextItemHighlighted: { | ||
146 | 46 | nextWeek(); | ||
147 | 47 | weekHeader.incrementCurrentIndex() | ||
148 | 48 | } | ||
149 | 49 | |||
150 | 50 | onPreviousItemHighlighted: { | ||
151 | 51 | previousWeek(); | ||
152 | 52 | weekHeader.decrementCurrentIndex() | ||
153 | 53 | } | ||
154 | 54 | |||
155 | 55 | function nextWeek() { | ||
156 | 56 | var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); | ||
157 | 57 | dayStart = weekStartDay.addDays(7); | ||
158 | 58 | } | ||
159 | 59 | |||
160 | 60 | function previousWeek(){ | ||
161 | 61 | var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); | ||
162 | 62 | dayStart = weekStartDay.addDays(-7); | ||
163 | 63 | } | ||
164 | 64 | |||
165 | 65 | delegate: TimeLineBaseComponent { | ||
166 | 66 | id: timeLineView | ||
167 | 67 | |||
168 | 68 | type: ViewType.ViewTypeWeek | ||
197 | 69 | 41 | ||
198 | 70 | width: parent.width | 42 | width: parent.width |
204 | 71 | height: parent.height | 43 | height: root.height - weekViewPath.y |
205 | 72 | 44 | ||
206 | 73 | startDay: getWeekStart(); | 45 | onNextItemHighlighted: { |
207 | 74 | 46 | nextWeek(); | |
208 | 75 | Connections{ | 47 | weekHeader.incrementCurrentIndex() |
209 | 48 | } | ||
210 | 49 | |||
211 | 50 | onPreviousItemHighlighted: { | ||
212 | 51 | previousWeek(); | ||
213 | 52 | weekHeader.decrementCurrentIndex() | ||
214 | 53 | } | ||
215 | 54 | |||
216 | 55 | function nextWeek() { | ||
217 | 56 | var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); | ||
218 | 57 | dayStart = weekStartDay.addDays(7); | ||
219 | 58 | } | ||
220 | 59 | |||
221 | 60 | function previousWeek(){ | ||
222 | 61 | var weekStartDay = visibleWeek.weekStart(Qt.locale().firstDayOfWeek); | ||
223 | 62 | dayStart = weekStartDay.addDays(-7); | ||
224 | 63 | } | ||
225 | 64 | |||
226 | 65 | delegate: TimeLineBaseComponent { | ||
227 | 66 | id: timeLineView | ||
228 | 67 | |||
229 | 68 | type: typeWeek | ||
230 | 69 | |||
231 | 70 | width: parent.width | ||
232 | 71 | height: parent.height | ||
233 | 72 | startDay: getWeekStart(); | ||
234 | 73 | |||
235 | 74 | function getWeekStart() { | ||
236 | 75 | switch( weekViewPath.indexType(index)) { | ||
237 | 76 | case 0: | ||
238 | 77 | return weekViewPath.weekStart; | ||
239 | 78 | case -1: | ||
240 | 79 | var weekStartDay= weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); | ||
241 | 80 | return weekStartDay.addDays(-7); | ||
242 | 81 | case 1: | ||
243 | 82 | var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); | ||
244 | 83 | return weekStartDay.addDays(7); | ||
245 | 84 | } | ||
246 | 85 | } | ||
247 | 86 | } | ||
248 | 87 | Connections{ | ||
249 | 76 | target: root | 88 | target: root |
250 | 77 | onIsCurrentPageChanged:{ | 89 | onIsCurrentPageChanged:{ |
251 | 78 | if(root.isCurrentPage){ | 90 | if(root.isCurrentPage){ |
252 | @@ -97,20 +109,6 @@ | |||
253 | 97 | when: timeLineView.PathView.isCurrentItem | 109 | when: timeLineView.PathView.isCurrentItem |
254 | 98 | } | 110 | } |
255 | 99 | 111 | ||
256 | 100 | function getWeekStart() { | ||
257 | 101 | switch( weekViewPath.indexType(index)) { | ||
258 | 102 | case 0: | ||
259 | 103 | return weekViewPath.weekStart; | ||
260 | 104 | case -1: | ||
261 | 105 | var weekStartDay= weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); | ||
262 | 106 | return weekStartDay.addDays(-7); | ||
263 | 107 | case 1: | ||
264 | 108 | var weekStartDay = weekViewPath.weekStart.weekStart(Qt.locale().firstDayOfWeek); | ||
265 | 109 | return weekStartDay.addDays(7); | ||
266 | 110 | } | ||
267 | 111 | } | ||
268 | 112 | } | 112 | } |
269 | 113 | } | 113 | } |
270 | 114 | } | 114 | } |
271 | 115 | |||
272 | 116 | |||
273 | 117 | 115 | ||
274 | === modified file 'YearView.qml' | |||
275 | --- YearView.qml 2014-03-19 19:46:58 +0000 | |||
276 | +++ YearView.qml 2014-03-24 13:57:47 +0000 | |||
277 | @@ -3,76 +3,78 @@ | |||
278 | 3 | 3 | ||
279 | 4 | import "dateExt.js" as DateExt | 4 | import "dateExt.js" as DateExt |
280 | 5 | 5 | ||
282 | 6 | PathViewBase { | 6 | Page { |
283 | 7 | id: root | 7 | id: root |
284 | 8 | objectName: "YearView" | 8 | objectName: "YearView" |
285 | 9 | |||
286 | 10 | property var currentYear: DateExt.today(); | 9 | property var currentYear: DateExt.today(); |
287 | 11 | |||
288 | 12 | signal monthSelected(var date); | 10 | signal monthSelected(var date); |
289 | 13 | 11 | ||
319 | 14 | anchors.fill: parent | 12 | PathViewBase { |
320 | 15 | 13 | id: pathView | |
321 | 16 | onNextItemHighlighted: { | 14 | |
322 | 17 | currentYear = getDateFromYear(currentYear.getFullYear() + 1); | 15 | anchors.fill: parent |
323 | 18 | } | 16 | |
324 | 19 | 17 | onNextItemHighlighted: { | |
325 | 20 | onPreviousItemHighlighted: { | 18 | root.currentYear = pathView.getDateFromYear(root.currentYear.getFullYear() + 1); |
326 | 21 | currentYear = getDateFromYear(currentYear.getFullYear() - 1); | 19 | } |
327 | 22 | } | 20 | |
328 | 23 | 21 | onPreviousItemHighlighted: { | |
329 | 24 | function getDateFromYear(year) { | 22 | root.currentYear = pathView.getDateFromYear(root.currentYear.getFullYear() - 1); |
330 | 25 | return new Date(year,0,1,0,0,0,0); | 23 | } |
331 | 26 | } | 24 | |
332 | 27 | 25 | function getDateFromYear(year) { | |
333 | 28 | delegate: GridView{ | 26 | return new Date(year,0,1,0,0,0,0); |
334 | 29 | id: yearView | 27 | } |
335 | 30 | clip: true | 28 | |
336 | 31 | 29 | delegate: GridView{ | |
337 | 32 | property bool isCurrentItem: index == root.currentIndex | 30 | id: yearView |
338 | 33 | property var year: getYear(); | 31 | clip: true |
339 | 34 | 32 | ||
340 | 35 | function getYear() { | 33 | property bool isCurrentItem: index == pathView.currentIndex |
341 | 36 | switch( root.indexType(index)) { | 34 | property var year: getYear(); |
342 | 37 | case 0: | 35 | |
343 | 38 | return currentYear; | 36 | function getYear() { |
344 | 39 | case -1: | 37 | switch( pathView.indexType(index)) { |
345 | 40 | return getDateFromYear(currentYear.getFullYear() - 1); | 38 | case 0: |
346 | 41 | case 1: | 39 | return root.currentYear; |
347 | 42 | return getDateFromYear(currentYear.getFullYear() + 1); | 40 | case -1: |
348 | 41 | return pathView.getDateFromYear(root.currentYear.getFullYear() - 1); | ||
349 | 42 | case 1: | ||
350 | 43 | return pathView.getDateFromYear(root.currentYear.getFullYear() + 1); | ||
351 | 44 | } | ||
352 | 43 | } | 45 | } |
361 | 44 | } | 46 | |
362 | 45 | 47 | width: parent.width | |
363 | 46 | width: parent.width | 48 | height: parent.height |
364 | 47 | height: parent.height | 49 | anchors.top: parent.top |
365 | 48 | anchors.top: parent.top | 50 | |
366 | 49 | 51 | readonly property int minCellWidth: units.gu(30) | |
367 | 50 | readonly property int minCellWidth: units.gu(30) | 52 | cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n) |
360 | 51 | cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n) | ||
368 | 52 | { return ((width / n >= minCellWidth) ? width / n : width / 2) }))) | 53 | { return ((width / n >= minCellWidth) ? width / n : width / 2) }))) |
369 | 53 | 54 | ||
389 | 54 | cellHeight: cellWidth * 1.4 | 55 | cellHeight: cellWidth * 1.4 |
390 | 55 | 56 | ||
391 | 56 | model: 12 /* months in a year */ | 57 | model: 12 /* months in a year */ |
392 | 57 | delegate: Item { | 58 | delegate: Item { |
393 | 58 | width: yearView.cellWidth | 59 | width: yearView.cellWidth |
394 | 59 | height: yearView.cellHeight | 60 | height: yearView.cellHeight |
395 | 60 | 61 | ||
396 | 61 | MonthComponent{ | 62 | MonthComponent{ |
397 | 62 | id: monthComponent | 63 | id: monthComponent |
398 | 63 | monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0) | 64 | monthDate: new Date(yearView.year.getFullYear(),index,1,0,0,0,0) |
380 | 64 | anchors.fill: parent | ||
381 | 65 | anchors.margins: units.gu(0.5) | ||
382 | 66 | |||
383 | 67 | dayLabelFontSize:"x-small" | ||
384 | 68 | dateLabelFontSize: "medium" | ||
385 | 69 | monthLabelFontSize: "medium" | ||
386 | 70 | yearLabelFontSize: "small" | ||
387 | 71 | |||
388 | 72 | MouseArea{ | ||
399 | 73 | anchors.fill: parent | 65 | anchors.fill: parent |
402 | 74 | onClicked: { | 66 | anchors.margins: units.gu(0.5) |
403 | 75 | root.monthSelected(monthComponent.monthDate); | 67 | |
404 | 68 | dayLabelFontSize:"x-small" | ||
405 | 69 | dateLabelFontSize: "medium" | ||
406 | 70 | monthLabelFontSize: "medium" | ||
407 | 71 | yearLabelFontSize: "small" | ||
408 | 72 | |||
409 | 73 | MouseArea{ | ||
410 | 74 | anchors.fill: parent | ||
411 | 75 | onClicked: { | ||
412 | 76 | root.monthSelected(monthComponent.monthDate); | ||
413 | 77 | } | ||
414 | 76 | } | 78 | } |
415 | 77 | } | 79 | } |
416 | 78 | } | 80 | } |
417 | 79 | 81 | ||
418 | === modified file 'calendar.qml' | |||
419 | --- calendar.qml 2014-03-23 14:21:46 +0000 | |||
420 | +++ calendar.qml 2014-03-24 13:57:47 +0000 | |||
421 | @@ -81,14 +81,16 @@ | |||
422 | 81 | yearView.currentYear = tabPage.currentDay.midnight(); | 81 | yearView.currentYear = tabPage.currentDay.midnight(); |
423 | 82 | } | 82 | } |
424 | 83 | 83 | ||
433 | 84 | if( monthView.currentMonth !== undefined && !monthView.currentMonth.isSameDay(currentDay)) | 84 | if( monthPage.item |
434 | 85 | monthView.currentMonth = currentDay.midnight(); | 85 | && monthPage.item.currentMonth !== undefined |
435 | 86 | 86 | && !monthPage.item.currentMonth.isSameDay(currentDay)) | |
436 | 87 | if( !dayView.currentDay.isSameDay(currentDay)) | 87 | monthPage.item.currentMonth = currentDay.midnight(); |
437 | 88 | dayView.currentDay = currentDay | 88 | |
438 | 89 | 89 | if( dayPage.item && !dayPage.item.currentDay.isSameDay(currentDay)) | |
439 | 90 | if( !weekView.dayStart.isSameDay(currentDay)) | 90 | dayPage.item.currentDay = currentDay |
440 | 91 | weekView.dayStart = currentDay | 91 | |
441 | 92 | if( weekPage.item && !weekPage.item.dayStart.isSameDay(currentDay)) | ||
442 | 93 | weekPage.item.dayStart = currentDay | ||
443 | 92 | 94 | ||
444 | 93 | setStartEndDateToModel(); | 95 | setStartEndDateToModel(); |
445 | 94 | } | 96 | } |
446 | @@ -138,13 +140,13 @@ | |||
447 | 138 | var difference = endTime - startTime; | 140 | var difference = endTime - startTime; |
448 | 139 | 141 | ||
449 | 140 | if (difference > month) | 142 | if (difference > month) |
451 | 141 | return 0; // Year view | 143 | return yearTab.index; // Year view |
452 | 142 | else if (difference > 7 * day) | 144 | else if (difference > 7 * day) |
454 | 143 | return 1; // Month view} | 145 | return monthTab.index; // Month view} |
455 | 144 | else if (difference > day) | 146 | else if (difference > day) |
457 | 145 | return 2; // Week view | 147 | return weekTab.index; // Week view |
458 | 146 | else | 148 | else |
460 | 147 | return 3; // Day view | 149 | return dayTab.index; // Day view |
461 | 148 | } | 150 | } |
462 | 149 | 151 | ||
463 | 150 | // This function parse the argument | 152 | // This function parse the argument |
464 | @@ -183,17 +185,17 @@ | |||
465 | 183 | } | 185 | } |
466 | 184 | else { | 186 | else { |
467 | 185 | // If no endtime has been setted, open the starttime date in day view | 187 | // If no endtime has been setted, open the starttime date in day view |
469 | 186 | tabs.selectedTabIndex = 3; | 188 | tabs.selectedTabIndex = dayTab.index; |
470 | 187 | } | 189 | } |
471 | 188 | } // End of else if (starttime) | 190 | } // End of else if (starttime) |
472 | 189 | else { | 191 | else { |
473 | 190 | // Due to bug #1231558 {if (args.defaultArgument.at(0))} is always true | 192 | // Due to bug #1231558 {if (args.defaultArgument.at(0))} is always true |
474 | 191 | // After the fix we can delete this else | 193 | // After the fix we can delete this else |
476 | 192 | tabs.selectedTabIndex= 1; | 194 | tabs.selectedTabIndex = monthTab.index; |
477 | 193 | } | 195 | } |
478 | 194 | } // End of if about args.values | 196 | } // End of if about args.values |
479 | 195 | else { | 197 | else { |
481 | 196 | tabs.selectedTabIndex= 1; | 198 | tabs.selectedTabIndex = monthTab.index; |
482 | 197 | } | 199 | } |
483 | 198 | 200 | ||
484 | 199 | globalModel = GlobalModel.globalModel(); | 201 | globalModel = GlobalModel.globalModel(); |
485 | @@ -240,56 +242,95 @@ | |||
486 | 240 | id: tabs | 242 | id: tabs |
487 | 241 | 243 | ||
488 | 242 | Tab{ | 244 | Tab{ |
489 | 245 | id: yearTab | ||
490 | 243 | objectName: "yearTab" | 246 | objectName: "yearTab" |
491 | 244 | title: i18n.tr("Year") | 247 | title: i18n.tr("Year") |
493 | 245 | page: Page{ | 248 | page: Loader{ |
494 | 249 | id: yearPage | ||
495 | 246 | objectName: "yearPage" | 250 | objectName: "yearPage" |
500 | 247 | anchors.fill: parent | 251 | anchors { |
501 | 248 | tools: commonToolBar | 252 | top: parent.top |
502 | 249 | YearView{ | 253 | left: parent.left |
503 | 250 | id: yearView | 254 | right: parent.right |
504 | 255 | bottom: parent.bottom | ||
505 | 256 | } | ||
506 | 257 | source: (tabs.selectedTab === yearTab) ? Qt.resolvedUrl("YearView.qml") : "" | ||
507 | 258 | |||
508 | 259 | onLoaded:{ | ||
509 | 260 | item.tools = commonToolBar | ||
510 | 261 | } | ||
511 | 262 | |||
512 | 263 | Connections{ | ||
513 | 264 | target: yearPage.item | ||
514 | 251 | onMonthSelected: { | 265 | onMonthSelected: { |
516 | 252 | tabs.selectedTabIndex = 1 | 266 | tabs.selectedTabIndex = monthTab.index |
517 | 253 | var now = DateExt.today(); | 267 | var now = DateExt.today(); |
518 | 254 | if( date.getMonth() === now.getMonth() | 268 | if( date.getMonth() === now.getMonth() |
519 | 255 | && date.getFullYear() === now.getFullYear()) { | 269 | && date.getFullYear() === now.getFullYear()) { |
521 | 256 | monthView.currentMonth = now | 270 | tabPage.currentDay = now; |
522 | 257 | } else { | 271 | } else { |
524 | 258 | monthView.currentMonth = date.midnight(); | 272 | tabPage.currentDay = date.midnight(); |
525 | 259 | } | 273 | } |
526 | 260 | } | 274 | } |
527 | 261 | } | 275 | } |
528 | 262 | } | 276 | } |
529 | 263 | } | 277 | } |
530 | 278 | |||
531 | 264 | Tab { | 279 | Tab { |
532 | 265 | id: monthTab | 280 | id: monthTab |
533 | 266 | objectName: "monthTab" | 281 | objectName: "monthTab" |
534 | 267 | title: i18n.tr("Month") | 282 | title: i18n.tr("Month") |
543 | 268 | page: MonthView{ | 283 | |
544 | 269 | anchors.fill: parent | 284 | page: Loader{ |
545 | 270 | tools: commonToolBar | 285 | id: monthPage |
546 | 271 | id: monthView | 286 | anchors { |
547 | 272 | 287 | top: parent.top | |
548 | 273 | onDateSelected: { | 288 | left: parent.left |
549 | 274 | tabs.selectedTabIndex = 3 | 289 | right: parent.right |
550 | 275 | tabPage.currentDay = date; | 290 | bottom: parent.bottom |
551 | 291 | } | ||
552 | 292 | |||
553 | 293 | source: (tabs.selectedTab === monthTab) ? Qt.resolvedUrl("MonthView.qml") : "" | ||
554 | 294 | |||
555 | 295 | onLoaded: { | ||
556 | 296 | item.currentMonth = tabPage.currentDay.midnight(); | ||
557 | 297 | item.tools = commonToolBar | ||
558 | 298 | } | ||
559 | 299 | |||
560 | 300 | Connections{ | ||
561 | 301 | target: monthPage.item | ||
562 | 302 | onDateSelected: { | ||
563 | 303 | tabs.selectedTabIndex = dayTab.index | ||
564 | 304 | tabPage.currentDay = date; | ||
565 | 305 | } | ||
566 | 276 | } | 306 | } |
567 | 277 | } | 307 | } |
568 | 278 | } | 308 | } |
569 | 309 | |||
570 | 279 | Tab{ | 310 | Tab{ |
571 | 280 | id: weekTab | 311 | id: weekTab |
572 | 281 | objectName: "weekTab" | 312 | objectName: "weekTab" |
573 | 282 | title: i18n.tr("Week") | 313 | title: i18n.tr("Week") |
582 | 283 | page: Page{ | 314 | |
583 | 284 | anchors.fill: parent | 315 | page: Loader{ |
584 | 285 | tools: commonToolBar | 316 | id: weekPage |
585 | 286 | WeekView{ | 317 | anchors { |
586 | 287 | id: weekView | 318 | top: parent.top |
587 | 288 | anchors.fill: parent | 319 | left: parent.left |
588 | 289 | isCurrentPage: tabs.selectedTab == weekTab | 320 | right: parent.right |
589 | 290 | 321 | bottom: parent.bottom | |
590 | 322 | } | ||
591 | 323 | source: (tabs.selectedTab === weekTab) ? Qt.resolvedUrl("WeekView.qml") : "" | ||
592 | 324 | |||
593 | 325 | onLoaded: { | ||
594 | 326 | item.dayStart = tabPage.currentDay; | ||
595 | 327 | item.tools = commonToolBar | ||
596 | 328 | } | ||
597 | 329 | |||
598 | 330 | Connections{ | ||
599 | 331 | target: weekPage.item | ||
600 | 291 | onDayStartChanged: { | 332 | onDayStartChanged: { |
602 | 292 | tabPage.currentDay = dayStart; | 333 | tabPage.currentDay = weekPage.item.dayStart; |
603 | 293 | } | 334 | } |
604 | 294 | } | 335 | } |
605 | 295 | } | 336 | } |
606 | @@ -299,16 +340,26 @@ | |||
607 | 299 | id: dayTab | 340 | id: dayTab |
608 | 300 | objectName: "dayTab" | 341 | objectName: "dayTab" |
609 | 301 | title: i18n.tr("Day") | 342 | title: i18n.tr("Day") |
618 | 302 | page: Page{ | 343 | |
619 | 303 | anchors.fill: parent | 344 | page: Loader{ |
620 | 304 | tools: commonToolBar | 345 | id: dayPage |
621 | 305 | DayView{ | 346 | anchors { |
622 | 306 | id: dayView | 347 | top: parent.top |
623 | 307 | anchors.fill: parent | 348 | left: parent.left |
624 | 308 | isCurrentPage: tabs.selectedTab == dayTab | 349 | right: parent.right |
625 | 309 | 350 | bottom: parent.bottom | |
626 | 351 | } | ||
627 | 352 | source: (tabs.selectedTab === dayTab) ? Qt.resolvedUrl("DayView.qml") : "" | ||
628 | 353 | |||
629 | 354 | onLoaded: { | ||
630 | 355 | item.currentDay = tabPage.currentDay; | ||
631 | 356 | item.tools = commonToolBar | ||
632 | 357 | } | ||
633 | 358 | |||
634 | 359 | Connections{ | ||
635 | 360 | target: dayPage.item | ||
636 | 310 | onCurrentDayChanged: { | 361 | onCurrentDayChanged: { |
638 | 311 | tabPage.currentDay = currentDay; | 362 | tabPage.currentDay = dayPage.item.currentDay; |
639 | 312 | } | 363 | } |
640 | 313 | } | 364 | } |
641 | 314 | } | 365 | } |
642 | 315 | 366 | ||
643 | === modified file 'tests/autopilot/calendar_app/emulators.py' | |||
644 | --- tests/autopilot/calendar_app/emulators.py 2014-03-20 02:42:05 +0000 | |||
645 | +++ tests/autopilot/calendar_app/emulators.py 2014-03-24 13:57:47 +0000 | |||
646 | @@ -103,6 +103,3 @@ | |||
647 | 103 | def get_month_name(self, component): | 103 | def get_month_name(self, component): |
648 | 104 | return component.wait_select_single( | 104 | return component.wait_select_single( |
649 | 105 | "Label", objectName="monthLabel").text | 105 | "Label", objectName="monthLabel").text |
650 | 106 | |||
651 | 107 | def get_num_events(self): | ||
652 | 108 | return len(self.select_many("EventBubble")) | ||
653 | 109 | 106 | ||
654 | === modified file 'tests/autopilot/calendar_app/tests/__init__.py' | |||
655 | --- tests/autopilot/calendar_app/tests/__init__.py 2014-03-20 16:13:43 +0000 | |||
656 | +++ tests/autopilot/calendar_app/tests/__init__.py 2014-03-24 13:57:47 +0000 | |||
657 | @@ -73,7 +73,6 @@ | |||
658 | 73 | self.launch_test_click() | 73 | self.launch_test_click() |
659 | 74 | 74 | ||
660 | 75 | def launch_test_local(self): | 75 | def launch_test_local(self): |
661 | 76 | logger.debug("Running via local installation") | ||
662 | 77 | self.app = self.launch_test_application( | 76 | self.app = self.launch_test_application( |
663 | 78 | "qmlscene", | 77 | "qmlscene", |
664 | 79 | self.local_location, | 78 | self.local_location, |
665 | @@ -81,7 +80,6 @@ | |||
666 | 81 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) | 80 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
667 | 82 | 81 | ||
668 | 83 | def launch_test_installed(self): | 82 | def launch_test_installed(self): |
669 | 84 | logger.debug("Running via installed debian package") | ||
670 | 85 | self.app = self.launch_test_application( | 83 | self.app = self.launch_test_application( |
671 | 86 | "qmlscene", | 84 | "qmlscene", |
672 | 87 | self.installed_location, | 85 | self.installed_location, |
673 | @@ -89,7 +87,6 @@ | |||
674 | 89 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) | 87 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
675 | 90 | 88 | ||
676 | 91 | def launch_test_click(self): | 89 | def launch_test_click(self): |
677 | 92 | logger.debug("Running via click package") | ||
678 | 93 | self.app = self.launch_click_package( | 90 | self.app = self.launch_click_package( |
679 | 94 | "com.ubuntu.calendar", | 91 | "com.ubuntu.calendar", |
680 | 95 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) | 92 | emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
681 | @@ -125,4 +122,4 @@ | |||
682 | 125 | 122 | ||
683 | 126 | @property | 123 | @property |
684 | 127 | def main_view(self): | 124 | def main_view(self): |
686 | 128 | return self.app.wait_select_single(emulators.MainView) | 125 | return self.app.select_single(emulators.MainView) |
687 | 129 | 126 | ||
688 | === modified file 'tests/autopilot/calendar_app/tests/test_calendar.py' | |||
689 | --- tests/autopilot/calendar_app/tests/test_calendar.py 2014-03-20 03:02:48 +0000 | |||
690 | +++ tests/autopilot/calendar_app/tests/test_calendar.py 2014-03-24 13:57:47 +0000 | |||
691 | @@ -11,7 +11,7 @@ | |||
692 | 11 | 11 | ||
693 | 12 | from autopilot.matchers import Eventually | 12 | from autopilot.matchers import Eventually |
694 | 13 | 13 | ||
696 | 14 | from testtools.matchers import Equals, Not, Is, NotEquals | 14 | from testtools.matchers import Equals, Not, Is |
697 | 15 | 15 | ||
698 | 16 | import time | 16 | import time |
699 | 17 | 17 | ||
700 | @@ -46,10 +46,6 @@ | |||
701 | 46 | 46 | ||
702 | 47 | def test_new_event(self): | 47 | def test_new_event(self): |
703 | 48 | """test add new event """ | 48 | """test add new event """ |
704 | 49 | #go to today | ||
705 | 50 | self.main_view.switch_to_tab("dayTab") | ||
706 | 51 | self.main_view.open_toolbar().click_button("todaybutton") | ||
707 | 52 | num_events = self.main_view.get_num_events() | ||
708 | 53 | 49 | ||
709 | 54 | #click on new event button | 50 | #click on new event button |
710 | 55 | self.main_view.open_toolbar().click_button("neweventbutton") | 51 | self.main_view.open_toolbar().click_button("neweventbutton") |
711 | @@ -72,7 +68,7 @@ | |||
712 | 72 | ok = picker.select_single("Button", objectName="TimePickerOKButton") | 68 | ok = picker.select_single("Button", objectName="TimePickerOKButton") |
713 | 73 | self.pointing_device.click_object(ok) | 69 | self.pointing_device.click_object(ok) |
714 | 74 | 70 | ||
716 | 75 | ## Set the end time | 71 | # Set the end time |
717 | 76 | end_time_field = self.main_view.get_event_end_time_field() | 72 | end_time_field = self.main_view.get_event_end_time_field() |
718 | 77 | self.pointing_device.click_object(end_time_field) | 73 | self.pointing_device.click_object(end_time_field) |
719 | 78 | picker = self.main_view.get_time_picker() | 74 | picker = self.main_view.get_time_picker() |
720 | @@ -87,10 +83,18 @@ | |||
721 | 87 | self.keyboard.type("My location") | 83 | self.keyboard.type("My location") |
722 | 88 | self.assertThat(location_field.text, Eventually(Equals("My location"))) | 84 | self.assertThat(location_field.text, Eventually(Equals("My location"))) |
723 | 89 | 85 | ||
724 | 86 | #input people | ||
725 | 87 | people_field = self.main_view.get_event_people_field() | ||
726 | 88 | self.pointing_device.click_object(people_field) | ||
727 | 89 | self.assertThat(people_field.activeFocus, Eventually(Equals(True))) | ||
728 | 90 | self.keyboard.type("Me") | ||
729 | 91 | self.assertThat(people_field.text, Eventually(Equals("Me"))) | ||
730 | 92 | |||
731 | 90 | #click save button | 93 | #click save button |
732 | 91 | self.main_view.open_toolbar().click_button("eventSaveButton") | 94 | self.main_view.open_toolbar().click_button("eventSaveButton") |
733 | 92 | 95 | ||
734 | 93 | #verify that the event has been created in timeline | 96 | #verify that the event has been created in timeline |
738 | 94 | self.main_view.open_toolbar().click_button("todaybutton") | 97 | self.main_view.switch_to_tab("dayTab") |
739 | 95 | self.assertThat(self.main_view.get_num_events, | 98 | self.assertThat(lambda: self.main_view.get_label_with_text( |
740 | 96 | Eventually(NotEquals(num_events))) | 99 | eventTitle, root=self.main_view.get_day_view()), |
741 | 100 | Eventually(Not(Is(None)))) |
I've just manually tested on desktop going through the views, which seem to now work (I needed to adjust the curly braces in WeekView.qml a bit from my initial conflict resolve).