[Merge] lp:~fboucault/address-book-app/converged_bottom_edge into lp:address-book-app

Renato Araujo Oliveira Filho renato.filho at canonical.com
Wed Sep 30 14:04:11 UTC 2015



Diff comments:

> 
> === modified file 'src/imports/ABContactListPage.qml'
> --- src/imports/ABContactListPage.qml	2015-09-24 18:48:48 +0000
> +++ src/imports/ABContactListPage.qml	2015-09-24 18:48:49 +0000
> @@ -520,15 +520,136 @@
>              contactList.listModel.importContacts("file://" + TEST_DATA)
>          }
>  
> -        mainPage.setBottomEdgePage(Qt.resolvedUrl("ABContactEditorPage.qml"),
> -                                   {model: contactList.listModel,
> -                                    contact: ContactsUI.ContactsJS.createEmptyContact("", mainPage),
> -                                    active: false,
> -                                    enabled: false,
> -                                    initialFocusSection: "name"})
> -
>          if (pageStack) {
>              pageStack.contactListPage = mainPage
>          }
>      }
> +
> +    function onNewContactSaved(contact) {
> +        if (pageStack.columns > 1) {
> +            showContact(contact);
> +        }
> +    }
> +
> +    function showContactEditorPage(editorPage) {
> +        contactList.currentIndex = -1;
> +        mainPage.contactEditorPage = editorPage;
> +        pageStack.addPageToNextColumn(mainPage, editorPage);
> +        editorPage.ready();
> +        editorPage.contactSaved.connect(onNewContactSaved);
> +    }
> +

please move functions to the beginner of the object declaration to keep consistence with others sources.
Item {
   properties
   functions
   <...>
}

> +    Component {
> +        id: editorPageBottomEdge
> +        ABContactEditorPage {
> +            implicitWidth: mainPage.width
> +            implicitHeight: mainPage.height
> +            model: contactList.listModel
> +            contact: ContactsJS.createEmptyContact("", mainPage)
> +            initialFocusSection: "name"
> +            enabled: false
> +        }
> +    }
> +
> +    Component {
> +        id: emptyContact
> +        ContactsUI.ContactDelegate {
> +            width: mainPage.width
> +            property Contact contact: Contact {
> +                Name {
> +                    firstName: i18n.tr("New contact")
> +                }
> +                Avatar {
> +                    imageUrl: "image://theme/contact"
> +                }
> +            }
> +        }
> +    }
> +
> +    BottomEdge {
> +        id: bottomEdge
> +
> +        anchors.fill: parent
> +        contentComponent: pageStack.columns == 1 ? editorPageBottomEdge : emptyContact
> +        flickable: contactList
> +        iconName: "contact-new"
> +        enabled: !contactList.isInSelectionMode
> +
> +        // FIXME: this is a workaround for the lack of fully asynchronous loading
> +        // of Pages in AdaptativePageLayout
> +        function createObjectAsynchronously(url, properties, callback) {

please move functions to the beginner of the object declaration.

> +            var component = Qt.createComponent(url, Component.Asynchronous);
> +            if (component.status == Component.Ready) {
> +                incubateObject(component, properties, callback);
> +            } else {
> +                component.onStatusChanged.connect(function(status) {
> +                    if (status == Component.Ready) {
> +                        incubateObject(component, properties, callback);
> +                    }
> +                });
> +            }
> +        }
> +
> +        property var incubator

please move property to the beginner of the object declaration.

> +        function incubateObject(component, properties, callback) {
> +            if (component.status == Component.Ready) {
> +                incubator = component.incubateObject(null,
> +                                                     properties,
> +                                                     Qt.Asynchronous);
> +                incubator.onStatusChanged = function(status) {
> +                    if (status == Component.Ready) {
> +                        callback(incubator.object);
> +                        incubator = null;
> +                    }
> +                }
> +            }
> +        }
> +
> +        function loadEditorPage() {
> +            var newContact = ContactsJS.createEmptyContact("", mainPage);
> +            createObjectAsynchronously(Qt.resolvedUrl("ABContactEditorPage.qml"),
> +                                       {model: contactList.listModel,
> +                                        contact: newContact,
> +                                        initialFocusSection: "name"},
> +                                       showContactEditorPage);
> +        }
> +
> +        onOpenBegin: {
> +            contactList.prepareNewContact = true;
> +            contactList.positionViewAtBeginning();
> +            if (pageStack.columns > 1) {
> +                loadEditorPage();
> +            }
> +        }
> +        onOpenEnd: {
> +            bottomEdge.visible = false;
> +            contactList.showNewContact = true;
> +            if (pageStack.columns <= 1) {
> +                showContactEditorPage(bottomEdge.content);
> +            }
> +        }
> +
> +        onClicked: {
> +            bottomEdge.open();
> +        }
> +    }
> +
> +    Connections {
> +        target: mainPage.contactViewPage
> +        onEditContact: {
> +            openEditPage(editPageProperties, mainPage.contactViewPage);
> +        }
> +    }
> +
> +    Connections {
> +        target: mainPage.contactEditorPage
> +        onActiveChanged: {
> +            if (!mainPage.contactEditorPage.active) {
> +                contactList.prepareNewContact = false;
> +                contactList.showNewContact = false;
> +                bottomEdge.visible = true;
> +                bottomEdge.close();
> +            }
> +        }
> +    }
>  }


-- 
https://code.launchpad.net/~fboucault/address-book-app/converged_bottom_edge/+merge/270693
Your team Ubuntu Phablet Team is subscribed to branch lp:address-book-app.



More information about the Ubuntu-reviews mailing list