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

Proposed by Kunal Parmar
Status: Merged
Approved by: Mihir Soni
Approved revision: 218
Merged at revision: 217
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/ScrollBehavior
Merge into: lp:ubuntu-calendar-app
Diff against target: 170 lines (+54/-16)
4 files modified
DayView.qml (+10/-0)
TimeLineBaseComponent.qml (+9/-16)
WeekView.qml (+30/-0)
calendar.qml (+5/-0)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/ScrollBehavior
Reviewer Review Type Date Requested Status
Mihir Soni Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+212274@code.launchpad.net

Commit message

Resolves Bug #1295068,Bug #1294679,

When Week or day tab is selected, view scrolls to current time

When inside week or day view when user changes the week or day, keep current scrolled time

Description of the change

Resolves Bug #1295068,Bug #1294679,

When Week or day tab is selected, view scrolls to current time

When inside week or day view when user changes the week or day, keep current scrolled time

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 :

Looks good to me.

Thank you for your MR.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'DayView.qml'
--- DayView.qml 2014-03-19 19:46:58 +0000
+++ DayView.qml 2014-03-22 04:47:27 +0000
@@ -9,6 +9,7 @@
9 objectName: "DayView"9 objectName: "DayView"
1010
11 property var currentDay: new Date()11 property var currentDay: new Date()
12 property bool isCurrentPage: false
1213
13 Column {14 Column {
14 id: column15 id: column
@@ -77,6 +78,15 @@
77 height: parent.height78 height: parent.height
78 z: index == dayViewPath.currentIndex ? 2 : 179 z: index == dayViewPath.currentIndex ? 2 : 1
7980
81 Connections{
82 target: root
83 onIsCurrentPageChanged:{
84 if(root.isCurrentPage){
85 timeLineView.scrollToCurrentTime();
86 }
87 }
88 }
89
80 //get contentY value from PathView, if its not current Item90 //get contentY value from PathView, if its not current Item
81 Binding{91 Binding{
82 target: timeLineView92 target: timeLineView
8393
=== modified file 'TimeLineBaseComponent.qml'
--- TimeLineBaseComponent.qml 2014-01-31 03:20:40 +0000
+++ TimeLineBaseComponent.qml 2014-03-22 04:47:27 +0000
@@ -15,13 +15,16 @@
1515
16 property int type: ViewType.ViewTypeWeek16 property int type: ViewType.ViewTypeWeek
1717
18 onStartDayChanged: {18 function scrollToCurrentTime() {
19 timeLineView.scroll();19 //scroll to current time
20 }20 var currentTime = new Date();
21 //TODO: if current time is early morning should we show time from 9 am ?
22 var hour = currentTime.getHours();
2123
22 //scroll in case content height changed24 timeLineView.contentY = hour * units.gu(10);
23 onHeightChanged: {25 if(timeLineView.contentY >= timeLineView.contentHeight - timeLineView.height) {
24 timeLineView.scroll()26 timeLineView.contentY = timeLineView.contentHeight - timeLineView.height
27 }
25 }28 }
2629
27 Column {30 Column {
@@ -47,16 +50,6 @@
4750
48 clip: true51 clip: true
4952
50 function scroll() {
51 //scroll to 9 o'clock
52 var hour = 9
53
54 timeLineView.contentY = hour * units.gu(10);
55 if(timeLineView.contentY >= timeLineView.contentHeight - timeLineView.height) {
56 timeLineView.contentY = timeLineView.contentHeight - timeLineView.height
57 }
58 }
59
60 TimeLineBackground{53 TimeLineBackground{
61 }54 }
6255
6356
=== modified file 'WeekView.qml'
--- WeekView.qml 2014-03-19 19:46:58 +0000
+++ WeekView.qml 2014-03-22 04:47:27 +0000
@@ -10,6 +10,8 @@
1010
11 property var dayStart: new Date();11 property var dayStart: new Date();
12 property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek);12 property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek);
13 property bool isCurrentPage: false
14
13 anchors.top: parent.top15 anchors.top: parent.top
14 anchors.topMargin: units.gu(1.5)16 anchors.topMargin: units.gu(1.5)
15 spacing: units.gu(1)17 spacing: units.gu(1)
@@ -37,6 +39,9 @@
37 width: parent.width39 width: parent.width
38 height: root.height - weekViewPath.y40 height: root.height - weekViewPath.y
3941
42 //This is used to scroll all view together when currentItem scrolls
43 property var childContentY;
44
40 onNextItemHighlighted: {45 onNextItemHighlighted: {
41 nextWeek();46 nextWeek();
42 weekHeader.incrementCurrentIndex()47 weekHeader.incrementCurrentIndex()
@@ -66,6 +71,31 @@
66 height: parent.height71 height: parent.height
67 startDay: getWeekStart();72 startDay: getWeekStart();
6873
74 Connections{
75 target: root
76 onIsCurrentPageChanged:{
77 if(root.isCurrentPage){
78 timeLineView.scrollToCurrentTime();
79 }
80 }
81 }
82
83 //get contentY value from PathView, if its not current Item
84 Binding{
85 target: timeLineView
86 property: "contentY"
87 value: weekViewPath.childContentY;
88 when: !timeLineView.PathView.isCurrentItem
89 }
90
91 //set PathView's contentY property, if its current item
92 Binding{
93 target: weekViewPath
94 property: "childContentY"
95 value: contentY
96 when: timeLineView.PathView.isCurrentItem
97 }
98
69 function getWeekStart() {99 function getWeekStart() {
70 switch( weekViewPath.indexType(index)) {100 switch( weekViewPath.indexType(index)) {
71 case 0:101 case 0:
72102
=== modified file 'calendar.qml'
--- calendar.qml 2014-03-19 19:46:58 +0000
+++ calendar.qml 2014-03-22 04:47:27 +0000
@@ -233,6 +233,7 @@
233233
234 Tabs{234 Tabs{
235 id: tabs235 id: tabs
236
236 Tab{237 Tab{
237 objectName: "yearTab"238 objectName: "yearTab"
238 title: i18n.tr("Year")239 title: i18n.tr("Year")
@@ -270,6 +271,7 @@
270 }271 }
271 }272 }
272 Tab{273 Tab{
274 id: weekTab
273 objectName: "weekTab"275 objectName: "weekTab"
274 title: i18n.tr("Week")276 title: i18n.tr("Week")
275 page: Page{277 page: Page{
@@ -278,6 +280,7 @@
278 WeekView{280 WeekView{
279 id: weekView281 id: weekView
280 anchors.fill: parent282 anchors.fill: parent
283 isCurrentPage: tabs.selectedTab == weekTab
281284
282 onDayStartChanged: {285 onDayStartChanged: {
283 tabPage.currentDay = dayStart;286 tabPage.currentDay = dayStart;
@@ -287,6 +290,7 @@
287 }290 }
288291
289 Tab{292 Tab{
293 id: dayTab
290 objectName: "dayTab"294 objectName: "dayTab"
291 title: i18n.tr("Day")295 title: i18n.tr("Day")
292 page: Page{296 page: Page{
@@ -295,6 +299,7 @@
295 DayView{299 DayView{
296 id: dayView300 id: dayView
297 anchors.fill: parent301 anchors.fill: parent
302 isCurrentPage: tabs.selectedTab == dayTab
298303
299 onCurrentDayChanged: {304 onCurrentDayChanged: {
300 tabPage.currentDay = currentDay;305 tabPage.currentDay = currentDay;

Subscribers

People subscribed via source and target branches

to status/vote changes: