[Merge] lp:~ken-vandine/address-book-app/oop_peer_picker into lp:address-book-app

Renato Araujo Oliveira Filho renato.filho at canonical.com
Thu Dec 8 15:00:49 UTC 2016


Review: Needs Fixing

code looks good, just a small comment.

Diff comments:

> 
> === modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/AvatarImport.qml'
> --- src/imports/Ubuntu/AddressBook/ContactEditor/AvatarImport.qml	2016-09-23 12:35:41 +0000
> +++ src/imports/Ubuntu/AddressBook/ContactEditor/AvatarImport.qml	2016-12-08 14:51:43 +0000
> @@ -17,24 +17,40 @@
>  import QtQuick 2.4
>  
>  import Ubuntu.Components 1.3
> -import Ubuntu.Components.Popups 1.3
> +import Ubuntu.Content 1.3
>  
>  Item {
> -    id: root
> -
> -    property var importDialog: null
> -
> +    id: avatarImport
> +
> +    property alias activeTransfer: signalConnections.target
>      signal avatarReceived(string avatarUrl)
>  
> -    function requestNewAvatar()
> -    {
> -        if (!root.importDialog) {
> -            root.importDialog = PopupUtils.open(Qt.resolvedUrl("AvatarImportDialog.qml"), null)
> -            root.importDialog.avatarReceived.connect(root.avatarReceived)
> -            root.importDialog.destruction.connect(function () {root.importDialog = null})
> -
> -        } else {
> -            console.warn("Import dialog already running")
> +    function requestNewAvatar() {
> +        ContentHub.requestPeerForType(
> +            ContentType.Pictures,
> +            ContentHandler.Source);
> +    }
> +
> +    Connections {
> +        target: ContentHub
> +        onPeerSelected: {
> +            console.debug("onPeerSelected: " + peer);
> +            avatarImport.activeTransfer = peer.request();
> +        }
> +    }
> +
> +    Connections {
> +        id: signalConnections
> +
> +        onStateChanged: {
> +            var done = ((avatarImport.activeTransfer.state === ContentTransfer.Charged) ||

I do not see a user for "done" anymore, I think it is safe to remove it.

> +                        (avatarImport.activeTransfer.state === ContentTransfer.Aborted))
> +
> +            if (avatarImport.activeTransfer.state === ContentTransfer.Charged) {
> +                if (avatarImport.activeTransfer.items.length > 0) {
> +                    avatarImport.avatarReceived(avatarImport.activeTransfer.items[0].url)
> +                }
> +            }
>          }
>      }
>  }


-- 
https://code.launchpad.net/~ken-vandine/address-book-app/oop_peer_picker/+merge/312296
Your team Ubuntu Phablet Team is subscribed to branch lp:address-book-app.



More information about the Ubuntu-reviews mailing list