Merge lp:~renatofilho/ubuntu-calendar-app/fix-1439049 into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Arthur Mello
Approved revision: 787
Merged at revision: 795
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/fix-1439049
Merge into: lp:ubuntu-calendar-app
Diff against target: 269 lines (+92/-52)
1 file modified
calendar.qml (+92/-52)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/fix-1439049
Reviewer Review Type Date Requested Status
Arthur Mello (community) Approve
Nekhelesh Ramananthan Approve
Review via email: mp+289198@code.launchpad.net

Commit message

Accept 'calendar://*' url as argument on app startup.

This is necessary because url-dispatcher calls the app with uri as an argument if the app is not opened yet.

Description of the change

To post a comment you must log in.
783. By Renato Araujo Oliveira Filho

Trunk merged.

784. By Renato Araujo Oliveira Filho

Accept 'startdate' in the uri handler.

785. By Renato Araujo Oliveira Filho

Trunk merged.

786. By Renato Araujo Oliveira Filho

Handle 'startTime' arg on uri.

Make sure that the app opens on day view with the 'startTime' visible when app is called from uri handler.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

On testing on the device, I found that clicking the event in the indicator opens the calendar app in the Day View (nice!) rather than the month/year/week view. It also nicely positions the hours close to the event. However it does not show the event details page which is critical to fixing this bug.

review: Needs Fixing
Revision history for this message
Arthur Mello (artmello) wrote :

Added some diff comments

review: Needs Fixing
787. By Renato Araujo Oliveira Filho

Removed debug message.
Fixed function name typo.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

> On testing on the device, I found that clicking the event in the indicator
> opens the calendar app in the Day View (nice!) rather than the month/year/week
> view. It also nicely positions the hours close to the event. However it does
> not show the event details page which is critical to fixing this bug.

yes we know that, unfortunately we do not have a API necessary to do this right now. (There is no way to fetch for a specific recurrence). As short term solution we will open the day view page in the event time.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

> Added some diff comments
fixed.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

> > On testing on the device, I found that clicking the event in the indicator
> > opens the calendar app in the Day View (nice!) rather than the
> month/year/week
> > view. It also nicely positions the hours close to the event. However it does
> > not show the event details page which is critical to fixing this bug.
>
> yes we know that, unfortunately we do not have a API necessary to do this
> right now. (There is no way to fetch for a specific recurrence). As short term
> solution we will open the day view page in the event time.

Based on that reasoning, the MP lgtm.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

> > On testing on the device, I found that clicking the event in the indicator
> > opens the calendar app in the Day View (nice!) rather than the
> month/year/week
> > view. It also nicely positions the hours close to the event. However it does
> > not show the event details page which is critical to fixing this bug.
>
> yes we know that, unfortunately we do not have a API necessary to do this
> right now. (There is no way to fetch for a specific recurrence). As short term
> solution we will open the day view page in the event time.

Based on that reasoning, the MP lgtm.

Revision history for this message
Nekhelesh Ramananthan (nik90) :
review: Approve
Revision history for this message
Arthur Mello (artmello) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'calendar.qml'
--- calendar.qml 2016-03-17 17:45:21 +0000
+++ calendar.qml 2016-03-22 19:00:24 +0000
@@ -31,6 +31,29 @@
31 property int reminderDefaultValue: 900;31 property int reminderDefaultValue: 900;
32 readonly property bool syncInProgress: commonHeaderActions.syncInProgress32 readonly property bool syncInProgress: commonHeaderActions.syncInProgress
3333
34 function handleUri(uri)
35 {
36 if(uri !== undefined && uri !== "") {
37 var commands = uri.split("://")[1].split("=");
38 if(commands[0].toLowerCase() === "eventid") {
39 // calendar://eventid=??
40 if( eventModel ) {
41 // qtorganizer:eds::<event-id>
42 var eventId = commands[1];
43 var prefix = "qtorganizer:eds::";
44 if (eventId.indexOf(prefix) < 0)
45 eventId = prefix + eventId;
46
47 eventModel.showEventFromId(eventId);
48 }
49 } else if (commands[0].toLowerCase() === "startdate") {
50 var date = new Date(commands[1])
51 // this will be handled by Tabs.component.completed
52 tabs.starttime = date.getTime()
53 }
54 }
55 }
56
34 // Work-around until this branch lands:57 // Work-around until this branch lands:
35 // https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer/+merge/21249658 // https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer/+merge/212496
36 //property bool windowActive: typeof window != 'undefined'59 //property bool windowActive: typeof window != 'undefined'
@@ -100,21 +123,11 @@
100 Connections {123 Connections {
101 target: UriHandler124 target: UriHandler
102 onOpened: {125 onOpened: {
103 var uri = uris[0]126 handleUri(uris[0])
104 if(uri !== undefined && uri !== "") {127 if (tabs.starttime !== -1) {
105 var commands = uri.split("://")[1].split("=");128 tabs.currentDay = new Date(tabs.starttime);
106 if(commands[0].toLowerCase() === "eventid") {129 tabs.selectedTabIndex = dayTab.index
107 // calendar://eventid=??130 tabs.starttime = -1
108 if( eventModel ) {
109 // qtorganizer:eds::<event-id>
110 var eventId = commands[1];
111 var prefix = "qtorganizer:eds::";
112 if (eventId.indexOf(prefix) < 0)
113 eventId = prefix + eventId;
114
115 eventModel.showEventFromId(eventId);
116 }
117 }
118 }131 }
119 }132 }
120 }133 }
@@ -240,11 +253,16 @@
240 var requestId = "";253 var requestId = "";
241 var callbackFunc = function(id,fetchedItems) {254 var callbackFunc = function(id,fetchedItems) {
242 if( requestId === id && fetchedItems.length > 0 ) {255 if( requestId === id && fetchedItems.length > 0 ) {
243 pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":fetchedItems[0],"model": eventModel});256 var event = fetchedItems[0]
257 var currentPage = tabs.selectedTab.page.item
258 if (currentPage.showDate) {
259 currentPage.showDate(event.startDateTime)
260 }
261
262 pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
244 }263 }
245 eventModel.onItemsFetched.disconnect( callbackFunc );264 eventModel.onItemsFetched.disconnect( callbackFunc );
246 }265 }
247
248 eventModel.onItemsFetched.connect( callbackFunc );266 eventModel.onItemsFetched.connect( callbackFunc );
249 requestId = eventModel.fetchItems(eventId);267 requestId = eventModel.fetchItems(eventId);
250 }268 }
@@ -282,8 +300,8 @@
282300
283 // Arguments on startup301 // Arguments on startup
284 property bool newevent: false;302 property bool newevent: false;
285 property int starttime: -1;303 property real starttime: -1;
286 property int endtime: -1;304 property real endtime: -1;
287 property string eventId;305 property string eventId;
288306
289 //WORKAROUND: The new header api does not work with tabs check bug: #1539759307 //WORKAROUND: The new header api does not work with tabs check bug: #1539759
@@ -380,14 +398,20 @@
380 var starttimepattern = new RegExp ("starttime=\\d+");398 var starttimepattern = new RegExp ("starttime=\\d+");
381 var endtimepattern = new RegExp ("endtime=\\d+");399 var endtimepattern = new RegExp ("endtime=\\d+");
382 var eventIdpattern = new RegExp ("eventId=.*")400 var eventIdpattern = new RegExp ("eventId=.*")
401 var urlpattern = new RegExp("calendar://.*")
402
403 if (urlpattern.test(url)) {
404 handleUri(url)
405 return
406 }
383407
384 newevent = newevenpattern.test(url);408 newevent = newevenpattern.test(url);
385409
386 if (starttimepattern.test(url))410 if (starttimepattern.test(url))
387 starttime = url.match(/starttime=(\d+)/)[1];411 starttime = parseInt(url.match(/starttime=(\d+)/)[1]);
388412
389 if (endtimepattern.test(url))413 if (endtimepattern.test(url))
390 endtime = url.match(/endtime=(\d+)/)[1];414 endtime = parseInt(url.match(/endtime=(\d+)/)[1]);
391415
392 if (eventIdpattern.test(url))416 if (eventIdpattern.test(url))
393 eventId = url.match(/eventId=(.*)/)[1];417 eventId = url.match(/eventId=(.*)/)[1];
@@ -396,20 +420,17 @@
396 Component.onCompleted: {420 Component.onCompleted: {
397 // If an url has been set421 // If an url has been set
398 if (args.defaultArgument.at(0)) {422 if (args.defaultArgument.at(0)) {
423 tabs.currentDay = new Date()
399 parseArguments(args.defaultArgument.at(0))424 parseArguments(args.defaultArgument.at(0))
400 tabs.currentDay = new Date()
401 // If newevent has been called on startup425 // If newevent has been called on startup
402 if (newevent) {426 if (newevent) {
403 timer.running = true;427 timer.running = true;
404 }428 }
405 else if (starttime !== -1) { // If no newevent has been setted, but starttime429 else if (starttime !== -1) { // If no newevent has been setted, but starttime
406 var startTime = parseInt(starttime);430 tabs.currentDay = new Date(tabs.starttime);
407 tabs.currentDay = new Date(startTime);
408
409 // If also endtime has been settend431 // If also endtime has been settend
410 if (endtime !== -1) {432 if (endtime !== -1) {
411 var endTime = parseInt(endtime);433 tabs.selectedTabIndex = calculateDifferenceStarttimeEndtime(tabs.startTime, tabs.endTime);
412 tabs.selectedTabIndex = calculateDifferenceStarttimeEndtime(startTime, endTime);
413 }434 }
414 else {435 else {
415 // If no endtime has been setted, open the starttime date in day view436 // If no endtime has been setted, open the starttime date in day view
@@ -432,6 +453,9 @@
432 else {453 else {
433 tabs.selectedTabIndex = settings.defaultViewIndex;454 tabs.selectedTabIndex = settings.defaultViewIndex;
434 }455 }
456 tabs.starttime = -1
457 tabs.endtime = -1
458 tabs.eventId = ""
435 tabs.isReady = true459 tabs.isReady = true
436 // WORKAROUND: Due the missing feature on SDK, they can not detect if460 // WORKAROUND: Due the missing feature on SDK, they can not detect if
437 // there is a mouse attached to device or not. And this will cause the461 // there is a mouse attached to device or not. And this will cause the
@@ -575,6 +599,11 @@
575 YearView {599 YearView {
576 readonly property bool tabSelected: tabs.selectedTabIndex === yearTab.index600 readonly property bool tabSelected: tabs.selectedTabIndex === yearTab.index
577601
602 function showDate(date)
603 {
604 refreshCurrentYear(date.getFullYear())
605 }
606
578 reminderValue: mainView.reminderDefaultValue607 reminderValue: mainView.reminderDefaultValue
579 model: eventModel.isReady ? eventModel : null608 model: eventModel.isReady ? eventModel : null
580 bootomEdgeEnabled: tabSelected609 bootomEdgeEnabled: tabSelected
@@ -597,7 +626,7 @@
597626
598 onTabSelectedChanged: {627 onTabSelectedChanged: {
599 if (tabSelected) {628 if (tabSelected) {
600 refreshCurrentYear(tabs.currentDay.getFullYear())629 showDate(tabs.currentDay)
601 }630 }
602 }631 }
603 }632 }
@@ -609,6 +638,14 @@
609 MonthView {638 MonthView {
610 readonly property bool tabSelected: tabs.selectedTabIndex === monthTab.index639 readonly property bool tabSelected: tabs.selectedTabIndex === monthTab.index
611640
641 function showDate(date)
642 {
643 anchorDate = new Date(date.getFullYear(),
644 date.getMonth(),
645 1,
646 0, 0, 0)
647 }
648
612 reminderValue: mainView.reminderDefaultValue649 reminderValue: mainView.reminderDefaultValue
613 model: eventModel.isReady ? eventModel : null650 model: eventModel.isReady ? eventModel : null
614 bootomEdgeEnabled: tabSelected651 bootomEdgeEnabled: tabSelected
@@ -632,10 +669,7 @@
632669
633 onTabSelectedChanged: {670 onTabSelectedChanged: {
634 if (tabSelected) {671 if (tabSelected) {
635 anchorDate = new Date(tabs.currentDay.getFullYear(),672 showDate(tabs.currentDay)
636 tabs.currentDay.getMonth(),
637 1,
638 0, 0, 0)
639 }673 }
640 }674 }
641 }675 }
@@ -647,6 +681,18 @@
647 WeekView {681 WeekView {
648 readonly property bool tabSelected: tabs.selectedTab === weekTab682 readonly property bool tabSelected: tabs.selectedTab === weekTab
649683
684 function showDate(date)
685 {
686 var dateGoTo = new Date(date)
687 if (!anchorDate ||
688 (dateGoTo.getFullYear() != anchorDate.getFullYear()) ||
689 (dateGoTo.getMonth() != anchorDate.getMonth()) ||
690 (dateGoTo.getDate() != anchorDate.getDate())) {
691 anchorDate = new Date(dateGoTo)
692 }
693 delayScrollToDate(dateGoTo)
694 }
695
650 reminderValue: mainView.reminderDefaultValue696 reminderValue: mainView.reminderDefaultValue
651 model: eventModel.isReady ? eventModel : null697 model: eventModel.isReady ? eventModel : null
652 bootomEdgeEnabled: tabSelected698 bootomEdgeEnabled: tabSelected
@@ -674,16 +720,7 @@
674720
675 onTabSelectedChanged: {721 onTabSelectedChanged: {
676 if (tabSelected) {722 if (tabSelected) {
677 // 'tabs.currntDay' can change after set 'anchorDate' to avoid that723 showDate(tabs.currentDay)
678 // create a copy of the current value
679 var tabDate = new Date(tabs.currentDay)
680 if (!anchorDate ||
681 (tabs.currentDay.getFullYear() != anchorDate.getFullYear()) ||
682 (tabs.currentDay.getMonth() != anchorDate.getMonth()) ||
683 (tabs.currentDay.getDate() != anchorDate.getDate())) {
684 anchorDate = new Date(tabDate)
685 }
686 delayScrollToDate(tabDate)
687 }724 }
688 }725 }
689 }726 }
@@ -695,6 +732,18 @@
695 DayView {732 DayView {
696 readonly property bool tabSelected: tabs.selectedTabIndex === dayTab.index733 readonly property bool tabSelected: tabs.selectedTabIndex === dayTab.index
697734
735 function showDate(date)
736 {
737 var dateGoTo = new Date(date)
738 if (!anchorDate ||
739 (dateGoTo.getFullYear() != anchorDate.getFullYear()) ||
740 (dateGoTo.getMonth() != anchorDate.getMonth()) ||
741 (dateGoTo.getDate() != anchorDate.getDate())) {
742 anchorDate = new Date(dateGoTo)
743 }
744 delayScrollToDate(dateGoTo)
745 }
746
698 reminderValue: mainView.reminderDefaultValue747 reminderValue: mainView.reminderDefaultValue
699 model: eventModel.isReady ? eventModel : null748 model: eventModel.isReady ? eventModel : null
700 bootomEdgeEnabled: tabSelected749 bootomEdgeEnabled: tabSelected
@@ -714,16 +763,7 @@
714763
715 onTabSelectedChanged: {764 onTabSelectedChanged: {
716 if (tabSelected) {765 if (tabSelected) {
717 // 'tabs.currntDay' can change after set 'anchorDate' to avoid that766 showDate(tabs.currentDay)
718 // create a copy of the current value
719 var tabDate = new Date(tabs.currentDay)
720 if (!anchorDate ||
721 (tabs.currentDay.getFullYear() != anchorDate.getFullYear()) ||
722 (tabs.currentDay.getMonth() != anchorDate.getMonth()) ||
723 (tabs.currentDay.getDate() != anchorDate.getDate())) {
724 anchorDate = new Date(tabDate)
725 }
726 delayScrollToDate(tabDate)
727 }767 }
728 }768 }
729 }769 }

Subscribers

People subscribed via source and target branches

to status/vote changes: