Merge lp:~renatofilho/address-book-app/fix-1371243 into lp:~phablet-team/address-book-app/staging
- fix-1371243
- Merge into staging
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michał Karnicki | ||||
Approved revision: | 312 | ||||
Merged at revision: | 312 | ||||
Proposed branch: | lp:~renatofilho/address-book-app/fix-1371243 | ||||
Merge into: | lp:~phablet-team/address-book-app/staging | ||||
Diff against target: |
189 lines (+39/-43) 4 files modified
src/imports/ContactList/ContactExporter.qml (+12/-8) src/imports/ContactList/ContactListPage.qml (+24/-33) src/imports/ContactShare/ContactSharePage.qml (+1/-1) src/imports/ContentHubProxy.qml (+2/-1) |
||||
To merge this branch: | bzr merge lp:~renatofilho/address-book-app/fix-1371243 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Karnicki (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+235708@code.launchpad.net |
Commit message
Fetch the full contact before export it on contact list.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
- 309. By Renato Araujo Oliveira Filho
-
Hide select all button if the list is in single selection mode.
Michał Karnicki (karni) wrote : | # |
Left some in-line questions. Marking as "needs information" only because I have questions, since I'm not familiar with the code base.
- 310. By Renato Araujo Oliveira Filho
-
Renamed ContactExporter signal name from contactFetched to contactsFetched
- 311. By Renato Araujo Oliveira Filho
-
Used contact name on vcard file used during the contact export process.
Renato Araujo Oliveira Filho (renatofilho) : | # |
Michał Karnicki (karni) wrote : | # |
Lookds good to me. I would advise at least another review from the apps team.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:309
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:311
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Michał Karnicki (karni) wrote : | # |
Renato, I'm getting 404, can't test the deb.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:311
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 312. By Renato Araujo Oliveira Filho
-
Fixed content hub import in single mode.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:312
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Michał Karnicki (karni) wrote : | # |
Works fine, although I find it confusing to see checkboxes in a single select mode. Clicking on a contact should be, in my opinion, sufficient to pick it. The 'share' button seems artifical, but I can guess that has been 'designed that way'.
Preview Diff
1 | === modified file 'src/imports/ContactList/ContactExporter.qml' |
2 | --- src/imports/ContactList/ContactExporter.qml 2014-05-06 13:18:07 +0000 |
3 | +++ src/imports/ContactList/ContactExporter.qml 2014-10-01 18:56:48 +0000 |
4 | @@ -20,15 +20,15 @@ |
5 | Item { |
6 | id: root |
7 | |
8 | - property var contacts: [] |
9 | property var contactModel |
10 | property var outputFile |
11 | |
12 | - signal completed(int error) |
13 | + signal contactExported(int error, string url) |
14 | + signal contactsFetched(var contacts) |
15 | |
16 | - function start() { |
17 | + function start(contacts) { |
18 | if (!contactModel) { |
19 | - console.log("No contact model defined") |
20 | + console.error("No contact model defined") |
21 | return |
22 | } |
23 | |
24 | @@ -48,6 +48,7 @@ |
25 | priv.currentQueryId = contactModel.fetchContacts(ids) |
26 | } |
27 | } |
28 | + |
29 | Item { |
30 | id: priv |
31 | |
32 | @@ -58,15 +59,18 @@ |
33 | |
34 | onExportCompleted: { |
35 | priv.currentQueryId = -1 |
36 | - root.completed(error) |
37 | + root.contactExported(error, root.outputFile) |
38 | } |
39 | |
40 | onContactsFetched: { |
41 | // currentQueryId == -2 is used during a fetch using "memory" manager |
42 | if ((priv.currentQueryId == -2) || (requestId == priv.currentQueryId)) { |
43 | - root.contactModel.exportContacts(root.outputFile, |
44 | - [], |
45 | - fetchedContacts) |
46 | + if (root.outputFile !== "") { |
47 | + root.contactModel.exportContacts(root.outputFile, |
48 | + [], |
49 | + fetchedContacts) |
50 | + } |
51 | + root.contactsFetched(fetchedContacts) |
52 | } |
53 | } |
54 | } |
55 | |
56 | === modified file 'src/imports/ContactList/ContactListPage.qml' |
57 | --- src/imports/ContactList/ContactListPage.qml 2014-09-18 23:08:25 +0000 |
58 | +++ src/imports/ContactList/ContactListPage.qml 2014-10-01 18:56:48 +0000 |
59 | @@ -258,9 +258,7 @@ |
60 | filterTerm: searchField.text |
61 | detailToPick: ContactDetail.PhoneNumber |
62 | multiSelectionEnabled: true |
63 | - multipleSelection: !pickMode || |
64 | - mainPage.pickMultipleContacts || |
65 | - (contactExporter.active && contactExporter.isMultiple) |
66 | + multipleSelection: (mainPage.pickMode && mainPage.pickMultipleContacts) || !mainPage.pickMode |
67 | |
68 | leftSideAction: Action { |
69 | iconName: "delete" |
70 | @@ -305,7 +303,6 @@ |
71 | } |
72 | |
73 | onAddDetailClicked: mainPage.addPhoneToContact(contact.contactId, " ") |
74 | - |
75 | onIsInSelectionModeChanged: mainPage.state = isInSelectionMode ? "selection" : "default" |
76 | onSelectionCanceled: { |
77 | if (pickMode) { |
78 | @@ -463,7 +460,7 @@ |
79 | contactList.selectAll() |
80 | } |
81 | } |
82 | - visible: contactList.isInSelectionMode |
83 | + visible: contactList.multipleSelection |
84 | }, |
85 | Action { |
86 | objectName: "share" |
87 | @@ -478,13 +475,7 @@ |
88 | contacts.push(items.get(i).model.contact) |
89 | } |
90 | |
91 | - if (mainPage.pickMode) { |
92 | - contactExporter.exportContacts(contacts) |
93 | - mainPage.pickMode = false |
94 | - } else { |
95 | - pageStack.push(Qt.resolvedUrl("../ContactShare/ContactSharePage.qml"), |
96 | - { contactModel: contactList.listModel, contacts: contacts }) |
97 | - } |
98 | + contactExporter.start(contacts) |
99 | contactList.endSelection() |
100 | } |
101 | }, |
102 | @@ -628,39 +619,39 @@ |
103 | } |
104 | } |
105 | |
106 | - QtObject { |
107 | + ContactExporter { |
108 | id: contactExporter |
109 | |
110 | property var activeTransfer: null |
111 | - readonly property bool active: activeTransfer && (activeTransfer.state === ContentHub.ContentTransfer.InProgress && activeTransfer.direction === ContentHub.ContentTransfer.Import) |
112 | - readonly property bool isMultiple: activeTransfer && (activeTransfer.selectionType === ContentHub.ContentTransfer.Multiple) |
113 | - |
114 | - function exportContacts(contacts) |
115 | - { |
116 | - if (activeTransfer) { |
117 | - var exportUrl = "file:///tmp/address_book_app_export.vcf" |
118 | - mainPage.contactModel.exportCompleted.connect(contactExporter.onExportCompleted) |
119 | - mainPage.contactModel.exportContacts(exportUrl, [], contacts) |
120 | - } else { |
121 | - console.error("Export requested with noo active transfer") |
122 | - } |
123 | - } |
124 | - |
125 | - function onExportCompleted(error, url) |
126 | - { |
127 | - mainPage.contactModel.exportCompleted.disconnect(contactExporter.onExportCompleted) |
128 | + |
129 | + contactModel: contactList.listModel |
130 | + outputFile: mainPage.pickMode ? "file:///tmp/address_book_app_export.vcf" : "" |
131 | + onContactExported: { |
132 | + // send contacts back to source app (pick mode) |
133 | if (error === ContactModel.ExportNoError) { |
134 | var obj = Qt.createQmlObject("import Ubuntu.Content 0.1; ContentItem { url: '" + url + "' }", contactExporter) |
135 | - activeTransfer.items = [obj] |
136 | - activeTransfer.state = ContentHub.ContentTransfer.Charged |
137 | + if (activeTransfer) { |
138 | + activeTransfer.items = [obj] |
139 | + activeTransfer.state = ContentHub.ContentTransfer.Charged |
140 | + } else { |
141 | + console.error("No active transfer") |
142 | + } |
143 | } else { |
144 | console.error("Fail to export contacts:" + error) |
145 | } |
146 | activeTransfer = null |
147 | - pickMode = false |
148 | + mainPage.pickMode = false |
149 | mainPage.state = "defautl" |
150 | application.returnVcard(url) |
151 | } |
152 | + |
153 | + onContactsFetched: { |
154 | + // Share contacts to an application chosen by the user |
155 | + if (!mainPage.pickMode) { |
156 | + pageStack.push(Qt.resolvedUrl("../ContactShare/ContactSharePage.qml"), |
157 | + { contactModel: contactExporter.contactModel, contacts: contacts }) |
158 | + } |
159 | + } |
160 | } |
161 | |
162 | Component.onCompleted: { |
163 | |
164 | === modified file 'src/imports/ContactShare/ContactSharePage.qml' |
165 | --- src/imports/ContactShare/ContactSharePage.qml 2014-07-24 12:22:13 +0000 |
166 | +++ src/imports/ContactShare/ContactSharePage.qml 2014-10-01 18:56:48 +0000 |
167 | @@ -35,7 +35,7 @@ |
168 | onPeerSelected: { |
169 | picker.curTransfer = peer.request(); |
170 | if (picker.curTransfer.state === ContentHub.ContentTransfer.InProgress) { |
171 | - var vCardUrl = "file:///tmp/vcard_" + encodeURIComponent(contact.contactId) + ".vcf" |
172 | + var vCardUrl = "file:///tmp/vcard_" + (picker.contacts[0].displayLabel.label.replace(/\s/g, '')) + ".vcf" |
173 | picker.contactModel.exportContacts(vCardUrl, [], picker.contacts) |
174 | } |
175 | } |
176 | |
177 | === modified file 'src/imports/ContentHubProxy.qml' |
178 | --- src/imports/ContentHubProxy.qml 2014-07-28 23:12:24 +0000 |
179 | +++ src/imports/ContentHubProxy.qml 2014-10-01 18:56:48 +0000 |
180 | @@ -24,7 +24,8 @@ |
181 | target: ContentHub.ContentHub |
182 | onExportRequested: { |
183 | // enter in pick mode |
184 | - pageStack.contactListPage.startPickMode(false, transfer) |
185 | + pageStack.contactListPage.startPickMode((transfer.selectionType === ContentHub.ContentTransfer.Single), |
186 | + transfer) |
187 | } |
188 | onImportRequested: { |
189 | if (transfer.state === ContentHub.ContentTransfer.Charged) { |
FAILED: Continuous integration, rev:308 jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- ci/342/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/5109/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 3722 jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- utopic- i386-ci/ 342 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/4857/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/6361 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/6361/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 13622 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 3115 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/4033 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/4033/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/phablet- team-address- book-app- staging- ci/342/ rebuild
http://