Merge lp:~renatofilho/address-book-app/split-contactlist into lp:~phablet-team/address-book-app/staging

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 245
Merged at revision: 282
Proposed branch: lp:~renatofilho/address-book-app/split-contactlist
Merge into: lp:~phablet-team/address-book-app/staging
Diff against target: 392 lines (+178/-137)
4 files modified
src/imports/Ubuntu/Contacts/CMakeLists.txt (+1/-0)
src/imports/Ubuntu/Contacts/ContactListModel.qml (+171/-0)
src/imports/Ubuntu/Contacts/ContactListView.qml (+5/-137)
src/imports/Ubuntu/Contacts/qmldir (+1/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/split-contactlist
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+230992@code.launchpad.net

Commit message

[Contacts] Split ContactListView in two components (ContactListView and ContactListModel)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:244
http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-ci/285/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3613
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2829
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-amd64-ci/285
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-armhf-ci/285
        deb: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-armhf-ci/285/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-i386-ci/285
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3498
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4860
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4860/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11560
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2294
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3113
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3113/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/phablet-team-address-book-app-staging-ci/285/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:245
http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-ci/286/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3621/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2832
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-amd64-ci/286
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-armhf-ci/286
        deb: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-armhf-ci/286/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-team-address-book-app-staging-utopic-i386-ci/286
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3509/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4868
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4868/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11575
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2297
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3116
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3116/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/phablet-team-address-book-app-staging-ci/286/rebuild

review: Needs Fixing (continuous-integration)
244. By Renato Araujo Oliveira Filho

[Contacts] Split ContactListView in two components (ContactListView and ContactListModel)

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Are there any related MPs required for this MP to build/function as expected? NO

Is your branch in sync with latest trunk? YES
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES

Did you successfully run all tests found in your component's Test Plan on device or emulator? YES

If you changed the UI, was the change specified/approved by design? NO UI CHANGE

If you changed UI labels, did you update the pot file? NO NECESSARY

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP? NO PACKAGE CHANGE

245. By Renato Araujo Oliveira Filho

Merged parent branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

Looks good. Works as expected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/imports/Ubuntu/Contacts/CMakeLists.txt'
--- src/imports/Ubuntu/Contacts/CMakeLists.txt 2014-08-13 20:52:57 +0000
+++ src/imports/Ubuntu/Contacts/CMakeLists.txt 2014-08-18 18:28:33 +0000
@@ -22,6 +22,7 @@
22 ContactDetailWithTypeView.qml22 ContactDetailWithTypeView.qml
23 ContactFetch.qml23 ContactFetch.qml
24 ContactList.js24 ContactList.js
25 ContactListModel.qml
25 ContactListView.qml26 ContactListView.qml
26 ContactPreviewPage.qml27 ContactPreviewPage.qml
27 ContactSimpleListView.qml28 ContactSimpleListView.qml
2829
=== added file 'src/imports/Ubuntu/Contacts/ContactListModel.qml'
--- src/imports/Ubuntu/Contacts/ContactListModel.qml 1970-01-01 00:00:00 +0000
+++ src/imports/Ubuntu/Contacts/ContactListModel.qml 2014-08-18 18:28:33 +0000
@@ -0,0 +1,171 @@
1 /*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import QtContacts 5.0
19
20ContactModel {
21 id: root
22
23 property var externalFilter: null
24 property string filterTerm: ""
25 property bool onlyFavorites: false
26 property var view: null
27
28 /* internal */
29 property bool _clearModel: false
30 property list<QtObject> _extraFilters
31 property QtObject _timeout
32
33
34 function changeFilter(newFilter)
35 {
36 if (root.contacts.length > 0) {
37 root._clearModel = true
38 }
39 root.externalFilter = newFilter
40 }
41
42
43 filter: {
44 if (root._clearModel) {
45 return invalidFilter
46 } else if (contactsFilter.active) {
47 return contactsFilter
48 } else {
49 return null
50 }
51 }
52
53 _extraFilters: [
54 InvalidFilter {
55 id: invalidFilter
56 },
57 DetailFilter {
58 id: favouritesFilter
59
60 detail: ContactDetail.Favorite
61 field: Favorite.Favorite
62 value: true
63 matchFlags: DetailFilter.MatchExactly
64 },
65 UnionFilter {
66 id: contactTermFilter
67
68 property string value: ""
69
70 DetailFilter {
71 detail: ContactDetail.DisplayLabel
72 field: DisplayLabel.Label
73 value: contactTermFilter.value
74 matchFlags: DetailFilter.MatchContains
75 }
76
77 DetailFilter {
78 detail: ContactDetail.PhoneNumber
79 field: PhoneNumber.Number
80 value: contactTermFilter.value
81 matchFlags: DetailFilter.MatchPhoneNumber
82 }
83
84 DetailFilter {
85 detail: ContactDetail.PhoneNumber
86 field: PhoneNumber.Number
87 value: contactTermFilter.value
88 matchFlags: DetailFilter.MatchContains
89 }
90 },
91 IntersectionFilter {
92 id: contactsFilter
93
94 // avoid runtime warning "depends on non-NOTIFYable properties"
95 readonly property alias filtersProxy: contactsFilter.filters
96
97 property bool active: {
98 var filters_ = []
99 if (contactTermFilter.value.length > 0) {
100 filters_.push(contactTermFilter)
101 } else if (root.onlyFavorites) {
102 filters_.push(favouritesFilter)
103 }
104
105 if (root.externalFilter) {
106 filters_.push(root.externalFilter)
107 }
108
109 // check if the filter has changed
110 var oldFilters = filtersProxy
111 if (oldFilters.length !== filters_.length) {
112 contactsFilter.filters = filters_
113 } else {
114 for(var i=0; i < oldFilters.length; i++) {
115 if (filters_.indexOf(oldFilters[i]) === -1) {
116 contactsFilter.filters = filters_
117 }
118 }
119 }
120
121 return (filters_.length > 0)
122 }
123 }
124 ]
125
126 _timeout: Timer {
127 id: contactSearchTimeout
128
129 running: false
130 repeat: false
131 interval: 300
132 onTriggered: {
133 if (root.view) {
134 view.positionViewAtBeginning()
135 }
136
137 root.changeFilter(root.externalFilter)
138 contactTermFilter.value = root.filterTerm
139
140 // manually update if autoUpdate is disabled
141 if (!root.autoUpdate) {
142 root.update()
143 }
144 }
145 }
146
147 onFilterTermChanged: contactSearchTimeout.restart()
148
149 onErrorChanged: {
150 if (error) {
151 console.error("Contact List error:" + error)
152 }
153 }
154
155 onContactsChanged: {
156 //WORKAROUND: clear the model before start populate it with the new contacts
157 //otherwise the model will wait for all contacts before show any new contact
158
159 //after all contacts get removed we can populate the model again, this will show
160 //new contacts as soon as it arrives in the model
161 if (root._clearModel && contacts.length === 0) {
162 root._clearModel = false
163 // do a new update if autoUpdate is false
164 if (!root.autoUpdate) {
165 root.update()
166 }
167
168 }
169 }
170}
171
0172
=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml 2014-08-12 23:51:38 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2014-08-18 18:28:33 +0000
@@ -52,7 +52,7 @@
52 This property holds a string that will be used to filter contacts on the list52 This property holds a string that will be used to filter contacts on the list
53 By default this is set to empty53 By default this is set to empty
54 */54 */
55 property string filterTerm: ""55 property alias filterTerm: contactsModel.filterTerm
56 /*!56 /*!
57 \qmlproperty Filter filter57 \qmlproperty Filter filter
5858
@@ -60,7 +60,7 @@
6060
61 \sa Filter61 \sa Filter
62 */62 */
63 property var filter: null63 property alias filter: contactsModel.externalFilter
64 /*!64 /*!
65 \qmlproperty bool showAvatar65 \qmlproperty bool showAvatar
6666
@@ -285,10 +285,7 @@
285 }285 }
286 function changeFilter(newFilter)286 function changeFilter(newFilter)
287 {287 {
288 if (root.count > 0) {288 contactsModel.changeFilter(newFilter)
289 contactsModel._clearModel = true
290 }
291 root.filter = newFilter
292 }289 }
293 function reset()290 function reset()
294 {291 {
@@ -324,8 +321,6 @@
324 contactsModel.update()321 contactsModel.update()
325 }322 }
326323
327 onFilterTermChanged: contactSearchTimeout.restart()
328
329 // colapse contacts if the keyboard appears324 // colapse contacts if the keyboard appears
330 Connections {325 Connections {
331 target: Qt.inputMethod326 target: Qt.inputMethod
@@ -341,7 +336,7 @@
341 id: view336 id: view
342337
343 property bool showFavourites: true338 property bool showFavourites: true
344 property bool favouritesIsSelected: false339 property alias favouritesIsSelected: contactsModel.onlyFavorites
345340
346 function getSectionText(index) {341 function getSectionText(index) {
347 var tag = listModel.contacts[index].tag.tag342 var tag = listModel.contacts[index].tag.tag
@@ -488,139 +483,12 @@
488 onContactDisappeared: root.contactDisappeared(contact)483 onContactDisappeared: root.contactDisappeared(contact)
489 clip: true484 clip: true
490485
491 InvalidFilter {486 listModel: ContactListModel {
492 id: invalidFilter
493 }
494
495 DetailFilter {
496 id: favouritesFilter
497
498 detail: ContactDetail.Favorite
499 field: Favorite.Favorite
500 value: true
501 matchFlags: DetailFilter.MatchExactly
502 }
503
504 UnionFilter {
505 id: contactTermFilter
506
507 property string value: ""
508
509 DetailFilter {
510 detail: ContactDetail.DisplayLabel
511 field: DisplayLabel.Label
512 value: contactTermFilter.value
513 matchFlags: DetailFilter.MatchContains
514 }
515
516 DetailFilter {
517 detail: ContactDetail.PhoneNumber
518 field: PhoneNumber.Number
519 value: contactTermFilter.value
520 matchFlags: DetailFilter.MatchPhoneNumber
521 }
522
523 DetailFilter {
524 detail: ContactDetail.PhoneNumber
525 field: PhoneNumber.Number
526 value: contactTermFilter.value
527 matchFlags: DetailFilter.MatchContains
528 }
529 }
530
531
532 IntersectionFilter {
533 id: contactsFilter
534
535 // avoid runtime warning "depends on non-NOTIFYable properties"
536 readonly property alias filtersProxy: contactsFilter.filters
537
538 property bool active: {
539 var filters_ = []
540 if (contactTermFilter.value.length > 0) {
541 filters_.push(contactTermFilter)
542 } else if (view.favouritesIsSelected) {
543 filters_.push(favouritesFilter)
544 }
545
546 if (root.filter) {
547 filters_.push(root.filter)
548 }
549
550 // check if the filter has changed
551 var oldFilters = filtersProxy
552 if (oldFilters.length !== filters_.length) {
553 contactsFilter.filters = filters_
554 } else {
555 for(var i=0; i < oldFilters.length; i++) {
556 if (filters_.indexOf(oldFilters[i]) === -1) {
557 contactsFilter.filters = filters_
558 }
559 }
560 }
561
562 return (filters_.length > 0)
563 }
564 }
565
566 Timer {
567 id: contactSearchTimeout
568
569 running: false
570 repeat: false
571 interval: 300
572 onTriggered: {
573 view.positionViewAtBeginning()
574
575 root.changeFilter(root.filter)
576 contactTermFilter.value = root.filterTerm
577
578 // manually update if autoUpdate is disabled
579 if (!root.autoUpdate) {
580 contactsModel.update()
581 }
582 }
583 }
584
585 listModel: ContactModel {
586 id: contactsModel487 id: contactsModel
587488
588 property bool _clearModel: false
589
590 manager: root.manager489 manager: root.manager
591 sortOrders: root.sortOrders490 sortOrders: root.sortOrders
592 fetchHint: root.fetchHint491 fetchHint: root.fetchHint
593 filter: {
594 if (contactsModel._clearModel) {
595 return invalidFilter
596 } else if (contactsFilter.active) {
597 return contactsFilter
598 } else {
599 return null
600 }
601 }
602
603 onErrorChanged: {
604 if (error) {
605 console.error("Contact List error:" + error)
606 }
607 }
608
609 onContactsChanged: {
610 //WORKAROUND: clear the model before start populate it with the new contacts
611 //otherwise the model will wait for all contacts before show any new contact
612
613 //after all contacts get removed we can populate the model again, this will show
614 //new contacts as soon as it arrives in the model
615 if (contactsModel._clearModel && contacts.length === 0) {
616 contactsModel._clearModel = false
617 // do a new update if autoUpdate is false
618 if (!contactsModel.autoUpdate) {
619 contactsModel.update()
620 }
621
622 }
623 }
624 }492 }
625 }493 }
626494
627495
=== modified file 'src/imports/Ubuntu/Contacts/qmldir'
--- src/imports/Ubuntu/Contacts/qmldir 2014-08-13 20:52:57 +0000
+++ src/imports/Ubuntu/Contacts/qmldir 2014-08-18 18:28:33 +0000
@@ -6,6 +6,7 @@
6ContactDetailOnlineAccountTypeModel 0.1 ContactDetailOnlineAccountTypeModel.qml6ContactDetailOnlineAccountTypeModel 0.1 ContactDetailOnlineAccountTypeModel.qml
7ContactDetailPhoneNumberTypeModel 0.1 ContactDetailPhoneNumberTypeModel.qml7ContactDetailPhoneNumberTypeModel 0.1 ContactDetailPhoneNumberTypeModel.qml
8ContactFetch 0.1 ContactFetch.qml8ContactFetch 0.1 ContactFetch.qml
9ContactListModel 0.1 ContactListModel.qml
9ContactListView 0.1 ContactListView.qml10ContactListView 0.1 ContactListView.qml
10ContactPreviewPage 0.1 ContactPreviewPage.qml11ContactPreviewPage 0.1 ContactPreviewPage.qml
11ListItemWithActions 0.1 ListItemWithActions.qml12ListItemWithActions 0.1 ListItemWithActions.qml

Subscribers

People subscribed via source and target branches