Merge lp:~rpadovani/ubuntu-calendar-app/1321695 into lp:ubuntu-calendar-app

Proposed by Riccardo Padovani
Status: Merged
Approved by: Kunal Parmar
Approved revision: 281
Merged at revision: 308
Proposed branch: lp:~rpadovani/ubuntu-calendar-app/1321695
Merge into: lp:ubuntu-calendar-app
Diff against target: 51 lines (+25/-1)
1 file modified
calendar.qml (+25/-1)
To merge this branch: bzr merge lp:~rpadovani/ubuntu-calendar-app/1321695
Reviewer Review Type Date Requested Status
Kunal Parmar Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+220463@code.launchpad.net

Commit message

Added eventid property to app url

Description of the change

I added the eventid property to app url, so the app can be launched directly on the page of the event with id eventid.

As soon as indicators implement this, I'll update the MR to reflect the name of their property

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
Kunal Parmar (pkunal-parmar) wrote :

57 + pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":eventid,"model": eventModel});

EventDetails required Event and not Event Id, so we need to fetch event from event id, before we push EventDetails on stack.

You can use code like below,

            eventModel.onItemsFetched.connect( function(id,fetchedItems){
                if(requestId === id && fetchedItems.length > 0) {
                    var event = fetchedItems[0];
                    pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
                }
            });
            var requestId = eventModel.fetchItems([eventId]);

review: Needs Fixing
279. By Riccardo Padovani

Updated the function to open the event page

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
Michał Karnicki (karni) wrote :

Is there anything blocking this MP? :)

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> Is there anything blocking this MP? :)

When last I tested, logic for fetching Item from itemid was not working. so event details page is not getting loaded with correct image.

So we still need to investigate it further. I will check issue further and update.

Revision history for this message
Michał Karnicki (karni) wrote :

Thank you, Kunal!

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

17 + *
18 + *
19 + * Open an existing event
20 + * Keyword: eventid (provisional)
21 + *
22 + * It takes a id of an event and open that event on full page
23 */

We better use Argument element, it makes parsing so easier.

         Argument {
            name: "eventid"
            required: false
            valueNames: ["EVENT_ID"]
        }

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

46 +
47 + if (eventidpattern.test(url))
48 + eventid = url.match(/eventid=(\w+)/)[0].replace("eventid=", '');
49 }

once we use Argument, we will not need this code

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

56 + else if (eventid) {
57 + eventModel.onItemsFetched.connect( function(id,fetchedItems){
58 + if(requestId === id && fetchedItems.length > 0) {
59 + var event = fetchedItems[0];
60 + pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
61 + }
62 + });
63 + var requestId = eventModel.fetchItems([eventId]);
64 + } // End of else if (eventid)

And this code, I think should be moved to initialization of model, as we are not sure if model is in working condition here.

        EventListModel{
            id: eventModel
            //This model is just for newevent
            //so we dont need any update
            autoUpdate: false

            Component.onCompleted: {
                if ( args.values.eventid ) {
                    var requestId = "";
                    eventModel.onItemsFetched.connect( function(id,fetchedItems) {
                        if( requestId === id && fetchedItems.length > 0 ) {
                            var event = fetchedItems[0];
                            pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
                        }
                    });
                    requestId = eventModel.fetchItems([args.values.eventid]);
                }
            }
        }

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

One note,
when I tested above code with non recurring event, it seems to work just fine.

But if we use recurrent event, then EDS is not able to fetch event.

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

I pasted my code here.

http://pastebin.ubuntu.com/7605554/

let me know if you need further help

280. By Riccardo Padovani

Working implementation following Kunal guidelines

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Wow Kunal, thanks for your awesome work!
I updated the code, let me know if it's ok now :-)

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
Kunal Parmar (pkunal-parmar) wrote :

it looks good now,

But it looks like we dont need following variable any more can you remove it

56 + property var eventid: null;

review: Needs Fixing
281. By Riccardo Padovani

Removed unused var

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Yap, thanks, sorry for the distraction!

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
Kunal Parmar (pkunal-parmar) wrote :

Looks good now. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'calendar.qml'
2--- calendar.qml 2014-06-05 19:19:36 +0000
3+++ calendar.qml 2014-06-09 10:49:02 +0000
4@@ -18,7 +18,7 @@
5 // Due to bug #1231558 you have to pass arguments BEFORE app:
6 // qmlscene calendar:///new-event calendar.qml
7
8- defaultArgument.help: i18n.tr("Calendar app accept three arguments: --starttime, --endtime and --newevet. They will be managed by system. See the source for a full comment about them");
9+ defaultArgument.help: i18n.tr("Calendar app accept four arguments: --starttime, --endtime, --newevent and --eventid. They will be managed by system. See the source for a full comment about them");
10 //defaultArgument.required: false;
11 defaultArgument.valueNames: ["URL"]
12
13@@ -45,7 +45,18 @@
14 * If newevent isn't set and startime is set, its value is used to choose the right view.
15 * If neither of precendet flags are set, endtime is ignored.
16 * It accepts an integer value of the number of seconds since UNIX epoch in the UTC timezone.
17+ *
18+ *
19+ * Open an existing event
20+ * Keyword: eventid (provisional)
21+ *
22+ * It takes a id of an event and open that event on full page
23 */
24+ Argument {
25+ name: "eventid"
26+ required: false
27+ valueNames: ["EVENT_ID"]
28+ }
29 }
30
31 objectName: "calendar"
32@@ -84,6 +95,19 @@
33 //This model is just for newevent
34 //so we dont need any update
35 autoUpdate: false
36+
37+ Component.onCompleted: {
38+ if (args.values.eventid) {
39+ var requestId = "";
40+ eventModel.onItemsFetched.connect( function(id,fetchedItems) {
41+ if( requestId === id && fetchedItems.length > 0 ) {
42+ var event = fetchedItems[0];
43+ pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
44+ }
45+ });
46+ requestId = eventModel.fetchItems([args.values.eventid]);
47+ }
48+ }
49 }
50
51 Tabs{

Subscribers

People subscribed via source and target branches

to status/vote changes: