[Merge] lp:~renatofilho/address-book-app/search into lp:~phablet-team/address-book-app/staging
Tiago Salem Herrmann
tiago.herrmann at canonical.com
Mon Jun 9 16:38:30 UTC 2014
Review: Needs Fixing
Diff comments:
> === modified file 'README.click'
> --- README.click 2013-12-16 15:04:12 +0000
> +++ README.click 2014-06-07 13:08:00 +0000
> @@ -7,8 +7,8 @@
> cd build
> cmake [path_to_this_location] -DCLICK_MODE=on \
> -DBZR_REVNO=$(cd [path_to_this_location]; bzr revno)
> -make DESTDIR=package install
> -click build package
> +make DESTDIR=[package dir] install
> +click build [package dir]
>
> This package can be installed by running:
>
>
> === modified file 'debian/control'
> --- debian/control 2014-05-16 01:59:36 +0000
> +++ debian/control 2014-06-07 13:08:00 +0000
> @@ -27,7 +27,6 @@
> qmlscene,
> qtcontact5-galera,
> qtdeclarative5-ubuntu-contacts0.1 (= ${binary:Version}),
> - qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
> qtdeclarative5-ubuntu-telephony-phonenumber0.1,
> qtdeclarative5-ubuntu-content0.1,
> qtdeclarative5-ubuntu-keyboard-extensions0.1,
> @@ -41,7 +40,7 @@
> Package: qtdeclarative5-ubuntu-contacts0.1
> Architecture: any
> Depends: qtdeclarative5-qtquick2-plugin,
> - qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
> + qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.46+14.10.20140527) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
> qtdeclarative5-qtcontacts-plugin,
> ${misc:Depends},
> ${shlibs:Depends},
> @@ -71,8 +70,9 @@
> libqt5test5,
> libqt5widgets5,
> python-testscenarios,
> - ubuntu-ui-toolkit-autopilot,
> + qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.46+14.10.20140527),
> + ubuntu-ui-toolkit-autopilot (>= 0.1.46+14.10.20140527),
> address-book-app (>= ${binary:Version}),
> ubuntu-mobile-icons,
> Description: Test package for address-book-app
> - Autopilot tests for the address-book-app package
> + Autopilot tests for the address-book-app package
>
> === modified file 'src/imports/Common/CMakeLists.txt'
> --- src/imports/Common/CMakeLists.txt 2014-05-08 18:10:28 +0000
> +++ src/imports/Common/CMakeLists.txt 2014-06-07 13:08:00 +0000
> @@ -3,7 +3,9 @@
> ContactDetailItem.qml
> ContactDetailGroupBase.qml
> ContactDetailGroupWithTypeBase.qml
> + KeyboardRectangle.qml
> RemoveContactsDialog.qml
> + StandardAnimation.qml
> )
>
> install(FILES ${CONTACT_COMMON_QMLS}
>
> === renamed file 'src/imports/ContactEdit/KeyboardRectangle.qml' => 'src/imports/Common/KeyboardRectangle.qml'
> === renamed file 'src/imports/ContactEdit/StandardAnimation.qml' => 'src/imports/Common/StandardAnimation.qml'
> === modified file 'src/imports/ContactEdit/CMakeLists.txt'
> --- src/imports/ContactEdit/CMakeLists.txt 2014-05-06 14:16:55 +0000
> +++ src/imports/ContactEdit/CMakeLists.txt 2014-06-07 13:08:00 +0000
> @@ -11,8 +11,6 @@
> ContactDetailWithTypeEditor.qml
> ContactEditor.qml
> ContactFetchError.qml
> - KeyboardRectangle.qml
> - StandardAnimation.qml
> TextInputDetail.qml
> ValueSelector.qml
> )
>
> === modified file 'src/imports/ContactList/ContactListPage.qml'
> --- src/imports/ContactList/ContactListPage.qml 2014-05-27 14:48:50 +0000
> +++ src/imports/ContactList/ContactListPage.qml 2014-06-07 13:08:00 +0000
> @@ -32,8 +32,11 @@
> property bool pickMultipleContacts: false
> property var onlineAccountsMessageDialog: null
> property QtObject contactIndex: null
> - property bool syncEnabled: application.syncEnabled
> - property var contactModel: contactList.listModel ? contactList.listModel : null
> + property bool contactsLoaded: false
> +
> + readonly property bool syncEnabled: application.syncEnabled
> + readonly property var contactModel: contactList.listModel ? contactList.listModel : null
> + readonly property bool searching: (state === "searching")
>
> function createEmptyContact(phoneNumber) {
> var details = [ {detail: "PhoneNumber", field: "number", value: phoneNumber},
> @@ -111,13 +114,29 @@
> id: contactList
> objectName: "contactListView"
>
> + anchors {
> + top: parent.top
> + left: parent.left
> + bottom: keyboard.top
> + right: parent.right
> + }
> + swipeToDelete: !pickMode
> multiSelectionEnabled: true
> multipleSelection: !pickMode ||
> ((contactContentHub && contactContentHub.multipleItems) || mainPage.pickMultipleContacts)
> - anchors.fill: parent
> - swipeToDelete: !pickMode
> + DetailFilter {
> + id: nameFilter
> +
> + detail: ContactDetail.DisplayLabel
> + field: DisplayLabel.Label
> + value: searchField.text
> + matchFlags: DetailFilter.MatchContains
> + }
>
> onCountChanged: {
> + if (count > 0)
> + mainPage.contactsLoaded = true
> +
> if ((count > 0) && mainPage.onlineAccountsMessageDialog) {
> // Because of some contacts can take longer to arrive due the dbus delay,
> // we need to destroy the online account dialog if this happen
> @@ -128,6 +147,7 @@
> }
>
> onContactClicked: {
> + mainPage.state = ""
> pageStack.push(Qt.resolvedUrl("../ContactView/ContactView.qml"),
> {model: contactList.listModel,
> contact: contact})
> @@ -171,7 +191,9 @@
>
> anchors.centerIn: parent
> spacing: units.gu(2)
> - visible: (contactList.loading || application.syncing) && (contactList.count === 0)
> + visible: ((contactList.loading && !mainPage.contactsLoaded) ||
> + (application.syncing && (contactList.count === 0)))
> +
>
> ActivityIndicator {
> id: activity
> @@ -215,7 +237,6 @@
> }
>
> ToolbarButton {
> -
> action: Action {
> objectName: "doneSelection"
> text: mainPage.pickMode ? i18n.tr("Select") : i18n.tr("Delete")
> @@ -240,9 +261,81 @@
> onTriggered: application.startSync()
> }
> }
> - }
> -
> - tools: contactList.isInSelectionMode ? toolbarItemsSelectionMode : toolbarItemsNormalMode
> + ToolbarButton {
> + objectName: "Search"
> + action: Action {
> + text: i18n.tr("Search")
> + visible: !mainPage.searching
> + iconName: "search"
> + onTriggered: {
> + mainPage.state = "searching"
> + searchField.forceActiveFocus()
> + }
> + }
> + }
> + }
> +
> + ToolbarItems {
> + id: toolbarItemsSearch
> +
> + visible: false
> + back: ToolbarButton {
> + visible: false
> + action: Action {
> + objectName: "cancelSearch"
> +
> + visible: mainPage.searching
> + iconName: "back"
> + text: i18n.tr("Cancel")
> + onTriggered: mainPage.state = ""
> + }
> + }
> + }
> +
> + TextField {
> + id: searchField
> +
> + visible: mainPage.searching
> + anchors {
> + left: parent.left
> + leftMargin: units.gu(2)
> + right: parent.right
> + rightMargin: units.gu(2)
> + topMargin: units.gu(1.5)
> + bottomMargin: units.gu(1.5)
> + verticalCenter: parent.verticalCenter
> + }
> + onTextChanged: contactSearchTimeout.restart()
> + inputMethodHints: Qt.ImhNoPredictiveText
> + }
> +
> + states: [
> + State {
> + name: ""
> + PropertyChanges {
> + target: searchField
> + text: ""
> + }
> + },
> + State {
> + name: "searching"
> + PropertyChanges {
> + target: mainPage
> + __customHeaderContents: searchField
> + tools: toolbarItemsSearch
> + }
> + },
> + State {
> + name: "selection"
> + when: contactList.isInSelectionMode
> + PropertyChanges {
> + target: mainPage
> + tools: toolbarItemsSelectionMode
> + }
> + }
> + ]
> +
> + tools: toolbarItemsNormalMode
>
> // WORKAROUND: Avoid the gap btw the header and the contact list when the list moves
> // see bug #1296764
> @@ -304,6 +397,11 @@
> }
> }
>
> +
> + KeyboardRectangle {
> + id: keyboard
> + }
> +
> Connections {
> target: mainPage.contactModel
> onContactsChanged: {
> @@ -331,6 +429,26 @@
> }
> }
>
> + Timer {
> + id: contactSearchTimeout
> +
> + running: false
> + repeat: false
> + interval: 300
> + onTriggered: {
> + if (searchField.text === "") {
> + if (contactList.filter !== null) {
> + contactList.changeFilter(null)
> + }
> + } else {
> + if (contactList.filter !== nameFilter) {
> + contactList.changeFilter(nameFilter)
> + }
> + nameFilter.value = searchField.text
> + }
> + }
> + }
> +
>
> Component.onCompleted: {
> if (pickMode) {
>
> === modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
> --- src/imports/Ubuntu/Contacts/ContactListView.qml 2014-06-05 19:20:12 +0000
> +++ src/imports/Ubuntu/Contacts/ContactListView.qml 2014-06-07 13:08:00 +0000
> @@ -43,6 +43,16 @@
>
> property bool showFavourites: false
>
> + signal cleared()
This signal doesn't seem to be used anywhere.
> +
> + function changeFilter(newFilter)
> + {
> + if (root.count > 0) {
> + contactsModel._clearModel = true
> + }
> + root.filter = newFilter
> + }
> +
> header: Rectangle {
> id: itemHeader
>
> @@ -69,7 +79,12 @@
> color: root.showFavourites ? UbuntuColors.warmGrey : UbuntuColors.orange
> MouseArea {
> anchors.fill: parent
> - onClicked: root.showFavourites = false
> + onClicked: {
> + //WORKAROUND: clear the model before start populate it with the new contacts
> + //otherwise the model will wait for all contacts before show any new contact
> + root.changeFilter(root.filter)
> + root.showFavourites = false
> + }
> }
> }
>
> @@ -102,44 +117,67 @@
> }
> }
>
> - ContactModel {
> - id: allContactsModel
> -
> - manager: root.manager
> - sortOrders: root.sortOrders
> - fetchHint: root.fetchHint
> -
> - onErrorChanged: {
> - if (error) {
> - busyIndicator.busy = false
> - contactListView.error(error)
> - }
> - }
> - }
> -
> - ContactModel {
> - id: favouritesContactsModel
> -
> - manager: root.manager
> - sortOrders: root.sortOrders
> - fetchHint: root.fetchHint
> - filter: DetailFilter {
> - id: favouritesFilter
> -
> - detail: ContactDetail.Favorite
> - field: Favorite.Favorite
> - value: true
> - matchFlags: DetailFilter.MatchExactly
> - }
> -
> - onErrorChanged: {
> - if (error) {
> - busyIndicator.busy = false
> - contactListView.error(error)
> - }
> - }
> -
> - }
> -
> - listModel: showFavourites ? favouritesContactsModel : allContactsModel
> + DetailFilter {
> + id: favouritesFilter
> +
> + detail: ContactDetail.Favorite
> + field: Favorite.Favorite
> + value: true
> + matchFlags: DetailFilter.MatchExactly
> + }
> +
> + InvalidFilter {
> + id: invalidFilter
> + }
> +
> + IntersectionFilter {
> + id: contactsFilter
> +
> + filters: {
> + var filters = []
> + if (root.showFavourites) {
> + filters.push(favouritesFilter)
> + }
> + if (root.filter) {
> + filters.push(root.filter)
> + }
> + return filters
> + }
> + }
> +
> + ContactModel {
> + id: contactsModel
> +
> + property bool _clearModel: false
> +
> + manager: root.manager
> + sortOrders: root.sortOrders
> + fetchHint: root.fetchHint
> + filter: {
> + if (contactsModel._clearModel) {
> + return invalidFilter
> + } else if (root.showFavourites || root.filter) {
> + return contactsFilter
> + } else {
> + return null
> + }
> + }
> + onErrorChanged: {
> + if (error) {
> + console.error("Contact List error:" + error)
> + }
> + }
> + onContactsChanged: {
> + //WORKAROUND: clear the model before start populate it with the new contacts
> + //otherwise the model will wait for all contacts before show any new contact
> +
> + //after all contacts get removed we can populate the model again, this will show
> + //new contacts as soon as it arrives in the model
> + if (contactsModel._clearModel && contacts.length === 0) {
> + contactsModel._clearModel = false
> + }
> + }
> + }
> +
> + listModel: contactsModel
> }
>
> === modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
> --- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-06-05 19:20:12 +0000
> +++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-06-07 13:08:00 +0000
> @@ -88,8 +88,6 @@
> */
> property list<SortOrder> sortOrders : [
> SortOrder {
> - id: sortOrder
> -
> detail: ContactDetail.Tag
> field: Tag.Tag
> direction: Qt.AscendingOrder
>
--
https://code.launchpad.net/~renatofilho/address-book-app/search/+merge/222241
Your team Ubuntu Phablet Team is subscribed to branch lp:~phablet-team/address-book-app/staging.
More information about the Ubuntu-reviews
mailing list