Merge lp:~renatofilho/address-book-app/multiple-addressbook into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 154
Merged at revision: 159
Proposed branch: lp:~renatofilho/address-book-app/multiple-addressbook
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/optimize-app
Diff against target: 306 lines (+189/-5)
9 files modified
src/imports/Common/ContactDetailBase.qml (+6/-0)
src/imports/ContactEdit/CMakeLists.txt (+1/-0)
src/imports/ContactEdit/ContactDetailSyncTargetEditor.qml (+106/-0)
src/imports/ContactEdit/ContactEditor.qml (+15/-0)
src/imports/ContactList/ContactListPage.qml (+1/-1)
src/imports/ContactView/CMakeLists.txt (+1/-0)
src/imports/ContactView/ContactDetailSyncTargetView.qml (+30/-0)
src/imports/ContactView/ContactView.qml (+9/-0)
src/imports/Ubuntu/Contacts/ContactSimpleListView.qml (+20/-4)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/multiple-addressbook
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+211806@code.launchpad.net

This proposal supersedes a proposal from 2014-03-05.

Commit message

Implemented support to create contacts in different sources.

Description of the change

How to test this:

- You can use this script: http://paste.ubuntu.com/7132433/ to create multitple sources on your phone. (run this as phablet user. Ex: python3 create-source.py MySource)

- You will need this service branch to have access to other sources: https://code.launchpad.net/~renatofilho/address-book-service/implement-multiple-addressbook-support/+merge/210881

- Try create contacts in different sources and check if it was correct saved on the contact view.

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

FAILED: Continuous integration, rev:143
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/446/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/156
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/156
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/156/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/156
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3691
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3285/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3242
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3696
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3696/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3287
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3287/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5657/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4503

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

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

FAILED: Continuous integration, rev:144
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/464/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/174
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/174
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/174/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/174
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4089
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3673/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3568
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4141
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4141/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3675
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3675/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5995/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5004

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

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

Merged parent branch.

146. By Renato Araujo Oliveira Filho

Merged parent branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
147. By Renato Araujo Oliveira Filho

Added missing file.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:147
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/470/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/180
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/180
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/180/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/180
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4140
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3724/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3605
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4204
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4204/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3726
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3726/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6033/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5068

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

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

Fixed problem saving contact without sync target.

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 :

is this really required?

152 + z: 1000

also, can we remove the following line, or did you leave it there on purpose?

229 + //defaultIcon: "image://theme/language-chooser"

149. By Renato Araujo Oliveira Filho

Merged parent branch.

150. By Renato Araujo Oliveira Filho

Set the default icon for address-book.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
151. By Renato Araujo Oliveira Filho

Merged parent branch: lp:~renatofilho/address-book-app/optimize-app

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
152. By Renato Araujo Oliveira Filho

Merged mainline.

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 (e.g. bzr pull lp:trunk -> no changes): 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 (https://wiki.ubuntu.com/Process/Merges/TestPlan/address-book-app) on device or emulator? YES
If you changed the UI, was the change specified/approved by design? NO UI CHANGE
If you changed the packaging (debian), did you subscribe a core-dev to this MP? NO PACKAGE CHANGE

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:152
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/487/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/197
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/197
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/197/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/197
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4282
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3867/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3708
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4367
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4367/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3869
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3869/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6148/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5243

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

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

Fixed scroll to created contact.

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

FAILED: Continuous integration, rev:153
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/490/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/200
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/200
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/200/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/200
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4288
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3873/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3713
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4373
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4373/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3875
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3875/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6154/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5252

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

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

Scroll to contact based on the contact name if the contact id is empty

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:154
http://jenkins.qa.ubuntu.com/job/address-book-app-ci/491/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-amd64-ci/201
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/201
        deb: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-armhf-ci/201/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/address-book-app-trusty-i386-ci/201
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4291
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3878/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3717
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4378
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4378/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3880
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3880/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6158/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5265

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

review: Needs Fixing (continuous-integration)
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 to me.

review: Approve
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/Common/ContactDetailBase.qml'
2--- src/imports/Common/ContactDetailBase.qml 2013-11-14 13:25:28 +0000
3+++ src/imports/Common/ContactDetailBase.qml 2014-03-26 22:14:43 +0000
4@@ -61,6 +61,10 @@
5 imMap[QtContacts.OnlineAccount.Protocol] = "imProtocol"
6 imMap[QtContacts.OnlineAccount.Capabilities] = "imCaps"
7
8+ // SyncTarget
9+ var syncTargetMap = {}
10+ syncTargetMap[QtContacts.SyncTarget.SyncTarget] = "syncTarget"
11+
12 // all
13 var detailMap = {}
14 detailMap[QtContacts.ContactDetail.Name] = nameMap
15@@ -68,6 +72,7 @@
16 detailMap[QtContacts.ContactDetail.Email] = emailMap
17 detailMap[QtContacts.ContactDetail.Address] = addressMap
18 detailMap[QtContacts.ContactDetail.OnlineAccount] = imMap
19+ detailMap[QtContacts.ContactDetail.SyncTarget] = syncTargetMap
20
21 // detail name
22 var detailNameMap = {}
23@@ -76,6 +81,7 @@
24 detailNameMap[QtContacts.ContactDetail.Email] = "email"
25 detailNameMap[QtContacts.ContactDetail.Address] = "address"
26 detailNameMap[QtContacts.ContactDetail.OnlineAccount] = "onlineAccount"
27+ detailNameMap[QtContacts.ContactDetail.SyncTarget] = "syncTarget"
28
29 if ((detail in detailMap) && (field in detailMap[detail])) {
30 return detailMap[detail][field]
31
32=== modified file 'src/imports/ContactEdit/CMakeLists.txt'
33--- src/imports/ContactEdit/CMakeLists.txt 2013-09-24 15:07:46 +0000
34+++ src/imports/ContactEdit/CMakeLists.txt 2014-03-26 22:14:43 +0000
35@@ -7,6 +7,7 @@
36 ContactDetailOnlineAccountsEditor.qml
37 ContactDetailOrganizationsEditor.qml
38 ContactDetailPhoneNumbersEditor.qml
39+ ContactDetailSyncTargetEditor.qml
40 ContactDetailWithTypeEditor.qml
41 ContactEditor.qml
42 ContactFetchError.qml
43
44=== added file 'src/imports/ContactEdit/ContactDetailSyncTargetEditor.qml'
45--- src/imports/ContactEdit/ContactDetailSyncTargetEditor.qml 1970-01-01 00:00:00 +0000
46+++ src/imports/ContactEdit/ContactDetailSyncTargetEditor.qml 2014-03-26 22:14:43 +0000
47@@ -0,0 +1,106 @@
48+/*
49+ * Copyright (C) 2012-2013 Canonical, Ltd.
50+ *
51+ * This program is free software; you can redistribute it and/or modify
52+ * it under the terms of the GNU General Public License as published by
53+ * the Free Software Foundation; version 3.
54+ *
55+ * This program is distributed in the hope that it will be useful,
56+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
57+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+ * GNU General Public License for more details.
59+ *
60+ * You should have received a copy of the GNU General Public License
61+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
62+ */
63+
64+import QtQuick 2.0
65+import QtContacts 5.0
66+import Ubuntu.Components 0.1
67+import Ubuntu.Components.ListItems 0.1 as ListItem
68+
69+import "../Common"
70+
71+ContactDetailBase {
72+ id: root
73+
74+ function save() {
75+ // only changes the target sync for new contacts
76+ if (!isNewContact) {
77+ return;
78+ }
79+ var activeSource = getSelectedSource()
80+ if (!activeSource) {
81+ return;
82+ }
83+
84+ if (!root.detail) {
85+ root.detail = root.contact.syncTarget
86+ }
87+ root.detail.syncTarget = activeSource
88+ }
89+
90+ function getSelectedSource() {
91+ var selectedContact = sourceModel.contacts[sources.selectedIndex]
92+ if (selectedContact) {
93+ return selectedContact.guid.guid
94+ } else {
95+ return -1
96+ }
97+ }
98+
99+ property bool isNewContact: contact && contact.contactId === "qtcontacts:::"
100+ property real myHeight: sources.containerHeight + units.gu(4) + label.height
101+
102+ detail: contact ? contact.detail(ContactDetail.SyncTarget) : null
103+ implicitHeight: isNewContact ? myHeight : 0
104+
105+ ContactModel {
106+ id: sourceModel
107+
108+ manager: QTCONTACTS_MANAGER_OVERRIDE && QTCONTACTS_MANAGER_OVERRIDE != "" ? QTCONTACTS_MANAGER_OVERRIDE : "galera"
109+ filter: DetailFilter {
110+ detail: ContactDetail.Type
111+ field: Type.TypeField
112+ value: Type.Group
113+ matchFlags: DetailFilter.MatchExactly
114+ }
115+ }
116+
117+ Label {
118+ id: label
119+
120+ text: i18n.tr("Addressbook")
121+ anchors {
122+ left: parent.left
123+ top: parent.top
124+ right: parent.right
125+ margins: units.gu(2)
126+ }
127+ height: root.active ? units.gu(4) : units.gu(3)
128+ }
129+
130+ OptionSelector {
131+ id: sources
132+
133+ anchors {
134+ left: parent.left
135+ leftMargin: units.gu(2)
136+ top: label.bottom
137+ topMargin: units.gu(1)
138+ right: parent.right
139+ rightMargin: units.gu(2)
140+ bottom: parent.bottom
141+ bottomMargin: units.gu(2)
142+ }
143+
144+ model: sourceModel
145+ delegate: OptionSelectorDelegate {
146+ text: contact.displayLabel.label
147+ height: units.gu(5)
148+ }
149+
150+ containerHeight: sourceModel.contacts.length > 4 ? itemHeight * 4 : itemHeight * sourceModel.contacts.length
151+ }
152+}
153+
154
155=== modified file 'src/imports/ContactEdit/ContactEditor.qml'
156--- src/imports/ContactEdit/ContactEditor.qml 2014-03-26 22:14:43 +0000
157+++ src/imports/ContactEdit/ContactEditor.qml 2014-03-26 22:14:43 +0000
158@@ -181,6 +181,7 @@
159 }
160 height: implicitHeight + units.gu(3)
161 KeyNavigation.tab: avatarEditor
162+ KeyNavigation.backtab : syncTargetEditor
163 }
164
165 ContactDetailAvatarEditor {
166@@ -261,6 +262,20 @@
167 }
168 height: implicitHeight
169 KeyNavigation.backtab : addressesEditor
170+ KeyNavigation.tab: syncTargetEditor
171+ }
172+
173+ ContactDetailSyncTargetEditor {
174+ id: syncTargetEditor
175+
176+ contact: contactEditor.contact
177+ anchors {
178+ left: parent.left
179+ right: parent.right
180+ }
181+ height: implicitHeight
182+ KeyNavigation.backtab : organizationsEditor
183+ KeyNavigation.tab: nameEditor
184 }
185 }
186 }
187
188=== modified file 'src/imports/ContactList/ContactListPage.qml'
189--- src/imports/ContactList/ContactListPage.qml 2014-03-26 22:14:43 +0000
190+++ src/imports/ContactList/ContactListPage.qml 2014-03-26 22:14:43 +0000
191@@ -174,7 +174,7 @@
192 Connections {
193 target: mainPage.contactModel
194 onContactsChanged: {
195- if (contactIndex && contactIndex.contactId != "contact:qtcontacts:::") {
196+ if (contactIndex) {
197 contactList.positionViewAtContact(mainPage.contactIndex)
198 mainPage.contactIndex = null
199 }
200
201=== modified file 'src/imports/ContactView/CMakeLists.txt'
202--- src/imports/ContactView/CMakeLists.txt 2013-10-21 19:25:51 +0000
203+++ src/imports/ContactView/CMakeLists.txt 2014-03-26 22:14:43 +0000
204@@ -11,6 +11,7 @@
205 ContactDetailOrganizationsView.qml
206 ContactDetailPhoneNumbersView.qml
207 ContactDetailPhoneNumberView.qml
208+ ContactDetailSyncTargetView.qml
209 ContactDetailWithTypeView.qml
210 ContactHeaderView.qml
211 ContactView.qml
212
213=== added file 'src/imports/ContactView/ContactDetailSyncTargetView.qml'
214--- src/imports/ContactView/ContactDetailSyncTargetView.qml 1970-01-01 00:00:00 +0000
215+++ src/imports/ContactView/ContactDetailSyncTargetView.qml 2014-03-26 22:14:43 +0000
216@@ -0,0 +1,30 @@
217+/*
218+ * Copyright (C) 2014 Canonical, Ltd.
219+ *
220+ * This program is free software; you can redistribute it and/or modify
221+ * it under the terms of the GNU General Public License as published by
222+ * the Free Software Foundation; version 3.
223+ *
224+ * This program is distributed in the hope that it will be useful,
225+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
226+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
227+ * GNU General Public License for more details.
228+ *
229+ * You should have received a copy of the GNU General Public License
230+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
231+ */
232+
233+import QtQuick 2.0
234+import Ubuntu.Components 0.1
235+import QtContacts 5.0 as QtContacts
236+
237+ContactDetailGroupWithTypeView {
238+ id: root
239+
240+ title: i18n.tr("Addressbook")
241+ defaultIcon: "image://theme/contact-group"
242+ detailType: QtContacts.ContactDetail.SyncTarget
243+ typeModel: null
244+
245+ fields: [ QtContacts.SyncTarget.SyncTarget ]
246+}
247
248=== modified file 'src/imports/ContactView/ContactView.qml'
249--- src/imports/ContactView/ContactView.qml 2014-03-18 21:02:25 +0000
250+++ src/imports/ContactView/ContactView.qml 2014-03-26 22:14:43 +0000
251@@ -137,6 +137,15 @@
252 }
253 height: implicitHeight
254 }
255+
256+ ContactDetailSyncTargetView {
257+ contact: root.contact
258+ anchors {
259+ left: parent.left
260+ right: parent.right
261+ }
262+ height: implicitHeight
263+ }
264 }
265 }
266
267
268=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
269--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-03-26 22:14:43 +0000
270+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2014-03-26 22:14:43 +0000
271@@ -191,16 +191,32 @@
272 signal detailClicked(QtObject contact, QtObject detail)
273
274 /*!
275- Retrieve the contact index inside of the list
276+ Retrieve the contact index inside of the list based on contact id or contact name if the id is empty
277 */
278 function getIndex(contact)
279 {
280- var contacts = listModel.contacts;
281+ var contacts = listModel.contacts
282+ var contactId = null
283+ var firstName
284+ var middleName
285+ var lastName
286+
287+ if (contact.contactId !== "qtcontacts:::") {
288+ contactId = contact.contactId
289+ } else {
290+ firstName = contact.name.firstName
291+ middleName = contact.name.middleName
292+ lastName = contact.name.lastName
293+ }
294
295 for (var i = 0, count = contacts.length; i < count; i++) {
296- var itemId = contacts[i].contactId
297- if (itemId === contact.contactId) {
298+ var c = contacts[i]
299+ if (contactId && (c.contactId === contactId)) {
300 return i
301+ } else if ((c.name.firstName === firstName) &&
302+ (c.name.middleName === middleName) &&
303+ (c.name.lastName === lastName)) {
304+ return i
305 }
306 }
307

Subscribers

People subscribed via source and target branches