ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02076
Re: [Merge] lp:~pkunal-parmar/ubuntu-calendar-app/UrlInvocation into lp:ubuntu-calendar-app
code comment added
Diff comments:
> === modified file 'calendar.qml'
> --- calendar.qml 2015-01-22 20:07:30 +0000
> +++ calendar.qml 2015-04-05 04:56:25 +0000
> @@ -95,6 +95,21 @@
> footerColor: "#ECECEC"
> anchorToKeyboard: true
>
> + Connections {
> + target: UriHandler
> + onOpened: {
> + var uri = uris[0]
> + if(uri !== undefined && url != "") {
> + var commands = uri.split("://")[1].split("=");
> + if(commands[0].toLowerCase() === "eventid") {
> + // calendar://eventid=??
> + if( eventModel ) {
> + eventModel.showEventFromId(commands[1]);
> + }
> + }
> + }
> + }
> + }
>
> PageStack {
> id: pageStack
> @@ -168,18 +183,26 @@
> collectionFilter.ids = collectionIds;
> }
>
> + function showEventFromId(eventId) {
> + if(eventId === undefined || eventId === "") {
> + return;
> + }
> +
> + var requestId = "";
> + eventModel.onItemsFetched.connect( function(id,fetchedItems) {
I think you have to disconnect from the signal once you're done, otherwise if you open multiple events you will fire the same function multiple times
> + if( requestId === id && fetchedItems.length > 0 ) {
> + var event = fetchedItems[0];
> + pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
> + }
> + });
> + requestId = eventModel.fetchItems(eventId);
> + }
> +
> Component.onCompleted: {
> delayedApplyFilter();
>
> 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]);
> + showEventFromId(args.values.eventid);
> }
> }
> }
>
--
https://code.launchpad.net/~pkunal-parmar/ubuntu-calendar-app/UrlInvocation/+merge/255234
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~pkunal-parmar/ubuntu-calendar-app/UrlInvocation into lp:ubuntu-calendar-app.
References