← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~pkunal-parmar/ubuntu-calendar-app/UrlInvocation into lp:ubuntu-calendar-app

 


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) {

let me rephrase: "otherwise, after you've opened 5 events, opening the 6th event will trigger 6 functions"

> +                    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