[Merge] lp:~abreu-alexandre/webbrowser-app/restore-overlay-oom into lp:webbrowser-app

Alberto Mardegan alberto.mardegan at canonical.com
Tue Dec 8 08:32:38 UTC 2015


Review: Approve

Just a tiny inline comment, but not that important.

Diff comments:

> === modified file 'src/app/webcontainer/PopupWindowController.qml'
> --- src/app/webcontainer/PopupWindowController.qml	2015-08-10 15:22:00 +0000
> +++ src/app/webcontainer/PopupWindowController.qml	2015-12-02 20:16:22 +0000
> @@ -34,8 +35,56 @@
>      signal newViewCreated(string url)
>      signal windowOverlayOpenAnimationDone()
>  
> +    signal initializeOverlayViewsWithUrls(var urls)
> +
>      readonly property int maxSimultaneousViews: 3
>  
> +    Settings {
> +        id: webviewOverlayUrlsSettings
> +        property string overlayUrls
> +    }
> +
> +    QtObject {
> +        id: internal
> +        property var urlPerOverlap
> +    }
> +
> +    function onUrlUpdatedForOverlay(overlayView, url) {
> +        if (!internal.urlPerOverlap) {
> +            internal.urlPerOverlap = {}
> +        }
> +
> +        internal.urlPerOverlap[overlayView] = url
> +
> +        var urls = []
> +        webviewOverlayUrlsSettings.overlayUrls = "[]"

Why is this needed?

> +        for (var i in internal.urlPerOverlap) {
> +            urls.push(internal.urlPerOverlap[i].toString())
> +        }
> +        webviewOverlayUrlsSettings.overlayUrls = JSON.stringify(urls)
> +    }
> +
> +    Connections {
> +        target: Qt.application
> +        onAboutToQuit: {
> +            webviewOverlayUrlsSettings.overlayUrls = "[]"
> +        }
> +    }
> +
> +    Component.onCompleted: {
> +        if (webviewOverlayUrlsSettings.overlayUrls
> +                && webviewOverlayUrlsSettings.overlayUrls.length > 0) {
> +            try {
> +                var urls = JSON.parse(webviewOverlayUrlsSettings.overlayUrls)
> +                if (typeof(urls) === 'object'
> +                        && urls.length != undefined
> +                        && urls.length > 0) {
> +                    initializeOverlayViewsWithUrls(urls)
> +                }
> +            } catch (e) {}
> +        }
> +    }
> +
>      function openUrlExternally(url) {
>          if (!blockOpenExternalUrls) {
>              Qt.openUrlExternally(url)


-- 
https://code.launchpad.net/~abreu-alexandre/webbrowser-app/restore-overlay-oom/+merge/279186
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.



More information about the Ubuntu-reviews mailing list