Merge lp:~renatofilho/address-book-app/improve-vcard-import into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Superseded
Proposed branch: lp:~renatofilho/address-book-app/improve-vcard-import
Merge into: lp:address-book-app
Diff against target: 403 lines (+103/-132)
6 files modified
src/imports/ABContactListPage.qml (+97/-26)
src/imports/BottomEdge.qml (+1/-1)
src/imports/CMakeLists.txt (+0/-1)
src/imports/Ubuntu/Contacts/ContactListView.qml (+1/-6)
src/imports/Ubuntu/Contacts/ContactSimpleListView.qml (+4/-4)
src/imports/VCardImportDialog.qml (+0/-94)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/improve-vcard-import
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+277918@code.launchpad.net

This proposal has been superseded by a proposal from 2015-11-20.

Commit message

Show a list of imported contacts when importing vcards.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
502. By Renato Araujo Oliveira Filho

Merged: lp:~renatofilho/address-book-app/fix-1511477

503. By Renato Araujo Oliveira Filho

Removed old file from cmake file.

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

Merged: ~renatofilho/address-book-app/vcard-does-not-export-uid

505. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/address-book-app/contact-view-editable

506. By Renato Araujo Oliveira Filho

Does not reset contact list state after edit a contact while importing contacts.

507. By Renato Araujo Oliveira Filho

Show a 'busy' dialog while importing contacts.

508. By Renato Araujo Oliveira Filho

Make sure that the contact list is cleared before apply a new filter to avoid delays on contact populte.

509. By Renato Araujo Oliveira Filho

Trunk merged.

510. By Renato Araujo Oliveira Filho

Trunk merged.

511. By Renato Araujo Oliveira Filho

Show a error message if the contact import fails.

512. By Renato Araujo Oliveira Filho

Test import vcard.

513. By Renato Araujo Oliveira Filho

Typo fixed.

514. By Renato Araujo Oliveira Filho

Only try to stop maliit if it is running already.

515. By Renato Araujo Oliveira Filho

Avoid switch to importVcard state while loading test data.

516. By Renato Araujo Oliveira Filho

Update import from sim autopilot test.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/ABContactListPage.qml'
2--- src/imports/ABContactListPage.qml 2015-10-26 13:18:11 +0000
3+++ src/imports/ABContactListPage.qml 2015-11-19 14:41:33 +0000
4@@ -89,7 +89,11 @@
5
6 function showContact(contact)
7 {
8- mainPage.state = "default";
9+ // go back to normal state if not searching
10+ if ((state !== "searching") &&
11+ (state !== "vcardImported")) {
12+ mainPage.state = "default";
13+ }
14 openViewPage({model: contactList.listModel,
15 contact: contact});
16 }
17@@ -109,13 +113,10 @@
18
19 function importContact(urls)
20 {
21- if (urls.length > 0) {
22- var importDialog = Qt.createQmlObject("VCardImportDialog{}",
23- mainPage,
24- "VCardImportDialog")
25- if (importDialog) {
26- importDialog.importVCards(contactList.listModel, urls)
27- }
28+ for(var i=0, iMax=urls.length; i < iMax; i++) {
29+ var url = urls[i]
30+ if (url && url != "")
31+ contactList.listModel.importContacts(url)
32 }
33 }
34
35@@ -129,6 +130,11 @@
36
37 function moveListToContact(contact)
38 {
39+ // skipt it if searching
40+ if (state === "searching") {
41+ return
42+ }
43+
44 contactIndex = contact
45 mainPage.state = "default"
46 // this means a new contact was created
47@@ -176,15 +182,11 @@
48 filterTerm: searchField.text
49 multiSelectionEnabled: true
50 multipleSelection: (mainPage.pickMode && mainPage.pickMultipleContacts) || !mainPage.pickMode
51- highlightedContact: contactViewPage ? contactViewPage.contact :
52- contactEditorPage ? contactEditorPage.contact : null
53-
54+ highlightSelected: pageStack.columns > 1
55 onAddContactClicked: mainPage.createContactWithPhoneNumber(label)
56 onAddNewContactClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd)
57
58- onContactClicked: {
59- showContact(contact);
60- }
61+ onContactClicked: mainPage.showContact(contact)
62 onIsInSelectionModeChanged: mainPage.state = isInSelectionMode ? "selection" : "default"
63 onSelectionCanceled: {
64 if (pickMode) {
65@@ -209,10 +211,15 @@
66 right: parent.right
67 rightMargin: units.gu(2)
68 }
69- visible: mainPage.searching
70+ focus: false
71+ visible: false
72 onTextChanged: contactList.currentIndex = -1
73 inputMethodHints: Qt.ImhNoPredictiveText
74 placeholderText: i18n.tr("Search...")
75+ onFocusChanged: {
76+ if (visible && focus)
77+ searchField.forceActiveFocus()
78+ }
79 }
80
81 Connections {
82@@ -289,6 +296,10 @@
83 target: searchField
84 text: ""
85 }
86+ PropertyChanges {
87+ target: contactList
88+ filter: null
89+ }
90 },
91 PageHeadState {
92 id: searchingState
93@@ -305,6 +316,11 @@
94 }
95
96 PropertyChanges {
97+ target: bottomEdge
98+ enabled: false
99+ }
100+
101+ PropertyChanges {
102 target: mainPage.head
103 backAction: searchingState.backAction
104 contents: searchField
105@@ -314,6 +330,12 @@
106 target: searchField
107 text: ""
108 }
109+
110+ PropertyChanges {
111+ target: searchField
112+ visible: true
113+ focus: true
114+ }
115 },
116 PageHeadState {
117 id: selectionState
118@@ -418,12 +440,50 @@
119 target: bottomEdge
120 enabled: false
121 }
122+ },
123+ PageHeadState {
124+ id: varctImportedState
125+
126+ name: "vcardImported"
127+ backAction: Action {
128+ iconName: "back"
129+ text: i18n.tr("Back")
130+ onTriggered: {
131+ contactList.forceActiveFocus()
132+ mainPage.state = "default"
133+ importedIdsFilter.ids = []
134+ }
135+ }
136+ PropertyChanges {
137+ target: mainPage.head
138+ backAction: varctImportedState.backAction
139+ }
140+ PropertyChanges {
141+ target: bottomEdge
142+ enabled: false
143+ }
144+ PropertyChanges {
145+ target: contactList
146+ filter: importedIdsFilter
147+ }
148+ PropertyChanges {
149+ target: mainPage
150+ title: i18n.tr("Imported contacts")
151+ }
152 }
153 ]
154+
155 onActiveChanged: {
156 if (active && contactList.showAddNewButton) {
157 contactList.positionViewAtBeginning()
158 }
159+ if (active && (state === "searching")) {
160+ searchField.forceActiveFocus()
161+ }
162+ }
163+
164+ IdFilter {
165+ id: importedIdsFilter
166 }
167
168 KeyboardRectangle {
169@@ -478,16 +538,6 @@
170 }
171 }
172
173- Connections {
174- target: mainPage.contactModel
175- onContactsChanged: {
176- if (contactIndex) {
177- contactList.positionViewAtContact(mainPage.contactIndex)
178- mainPage.contactIndex = null
179- }
180- }
181- }
182-
183 ContactExporter {
184 id: contactExporter
185
186@@ -538,7 +588,7 @@
187
188 Component.onCompleted: {
189 application.elapsed()
190- if ((typeof(TEST_DATA) !== "undefined") && (TEST_DATA !== "")) {
191+ if ((typeof(TEST_DATA) !== "undefined") && (TEST_DATA != "")) {
192 contactList.listModel.importContacts("file://" + TEST_DATA)
193 }
194
195@@ -647,6 +697,27 @@
196 }
197
198 Connections {
199+ target: mainPage.contactModel
200+ onContactsChanged: {
201+ if (contactIndex) {
202+ contactList.positionViewAtContact(mainPage.contactIndex)
203+ mainPage.contactIndex = null
204+ }
205+ }
206+ onImportCompleted: {
207+ if (error !== ContactModel.ImportNoError) {
208+ console.error("Fail to import vcard:" + error)
209+ } else {
210+ var importedIds = ids
211+ importedIds.concat(importedIdsFilter.ids)
212+ importedIdsFilter.ids = importedIds
213+ console.debug("Imported ids:" + importedIds)
214+ mainPage.state = "vcardImported"
215+ }
216+ }
217+ }
218+
219+ Connections {
220 target: mainPage.contactViewPage
221 onEditContact: {
222 openEditPage(editPageProperties, mainPage.contactViewPage);
223
224=== modified file 'src/imports/BottomEdge.qml'
225--- src/imports/BottomEdge.qml 2015-10-23 14:32:47 +0000
226+++ src/imports/BottomEdge.qml 2015-11-19 14:41:33 +0000
227@@ -89,10 +89,10 @@
228 id: bottomEdgeLoader
229 sourceComponent: bottomEdge.contentComponent
230 asynchronous: true
231+ active: bottomEdge.enabled
232 }
233 }
234
235-
236 BottomEdgeHint {
237 id: bottomEdgeHint
238
239
240=== modified file 'src/imports/CMakeLists.txt'
241--- src/imports/CMakeLists.txt 2015-10-16 13:37:25 +0000
242+++ src/imports/CMakeLists.txt 2015-11-19 14:41:33 +0000
243@@ -6,7 +6,6 @@
244 ABContactViewPage.qml
245 ContentHubProxy.qml
246 MainWindow.qml
247- VCardImportDialog.qml
248 BottomEdgeShadow.qml
249 BottomEdge.qml
250 )
251
252=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
253--- src/imports/Ubuntu/Contacts/ContactListView.qml 2015-10-28 01:07:59 +0000
254+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2015-11-19 14:41:33 +0000
255@@ -248,12 +248,8 @@
256 This property holds the vertical velocity of the list
257 */
258 readonly property real verticalVelocity: view.verticalVelocity
259- /*!
260- \qmlproperty Contact highlightedContact
261
262- This property holds a reference to the Contact that should be highlighted
263- */
264- property Contact highlightedContact: null
265+ property alias highlightSelected: view.highlightSelected
266
267 property var _busyDialog: null
268
269@@ -382,7 +378,6 @@
270 property bool showFavourites: true
271 property alias favouritesIsSelected: contactsModel.onlyFavorites
272 property bool contactsLoaded: false
273- highlightedContact: root.highlightedContact
274
275 function getSectionText(index) {
276 var tag = listModel.contacts[index].tag.tag
277
278=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
279--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2015-10-26 13:18:11 +0000
280+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2015-11-19 14:41:33 +0000
281@@ -145,11 +145,11 @@
282 property list<Action> rightSideActions
283
284 /*!
285- \qmlproperty Contact highlightedContact
286+ \qmlproperty highlightSelected
287
288- This property holds a reference to the Contact that should be highlighted
289+ This property holds if the current contact should be highlighted or not
290 */
291- property Contact highlightedContact: null
292+ property bool highlightSelected: false
293
294 /* internal */
295 property var _currentSwipedItem: null
296@@ -269,7 +269,7 @@
297 flicking: contactListView.flicking
298 width: parent.width
299 selected: (contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate))
300- || (contactListView.highlightedContact && contactListView.highlightedContact.contactId == contact.contactId)
301+ || (contactListView.highlightSelected && (contactListView.currentIndex == index))
302 selectionMode: contactListView.isInSelectionMode
303 defaultAvatarUrl: contactListView.defaultAvatarImageUrl
304 isCurrentItem: ListView.isCurrentItem
305
306=== removed file 'src/imports/VCardImportDialog.qml'
307--- src/imports/VCardImportDialog.qml 2015-10-26 13:18:11 +0000
308+++ src/imports/VCardImportDialog.qml 1970-01-01 00:00:00 +0000
309@@ -1,94 +0,0 @@
310-/*
311- * Copyright (C) 2014 Canonical, Ltd.
312- *
313- * This program is free software; you can redistribute it and/or modify
314- * it under the terms of the GNU General Public License as published by
315- * the Free Software Foundation; version 3.
316- *
317- * This program is distributed in the hope that it will be useful,
318- * but WITHOUT ANY WARRANTY; without even the implied warranty of
319- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
320- * GNU General Public License for more details.
321- *
322- * You should have received a copy of the GNU General Public License
323- * along with this program. If not, see <http://www.gnu.org/licenses/>.
324- */
325-
326-import QtQuick 2.4
327-import QtContacts 5.0
328-import Ubuntu.Components 1.3
329-import Ubuntu.Components.Popups 1.3 as Popups
330-
331-Item {
332- id: root
333-
334- property alias model: modelConnections.target
335- property var vcards: []
336- property var importedVcards: []
337- property var importErrors: []
338- property var dialog: null
339-
340- signal finished()
341-
342- function importVCards(model, vcards)
343- {
344- if (dialog || vcards.length === 0) {
345- return
346- }
347-
348- root.model = model
349- root.vcards = vcards
350- dialog = Popups.PopupUtils.open(importDialogComponent, root)
351-
352- for(var i=0, iMax=vcards.length; i < iMax; i++) {
353- var vcardUrl = vcards[i]
354- model.importContacts(vcardUrl)
355- }
356- }
357-
358- Connections {
359- id: modelConnections
360-
361- onImportCompleted: {
362- var imported = root.importedVcards
363- var importErrors = root.importErrors
364- imported.push(url)
365- if (error !== ContactModel.ImportNoError) {
366- root.importErrors.push(error)
367- console.error("Fail to import vcard:" + error)
368- }
369- root.importedVcards = imported
370- root.importErrors = importErrors
371- }
372- }
373-
374- Component {
375- id: importDialogComponent
376-
377- Popups.Dialog {
378- id: importDialog
379-
380- title: i18n.tr("Import vCards")
381- text: root.importedVcards.length === 0 ? i18n.tr("Importing...") : i18n.tr("%1 vCards imported").arg(root.importedVcards.length)
382-
383- Button {
384- anchors {
385- left: parent.left
386- right: parent.right
387- margins: units.gu(1)
388- }
389- text: i18n.tr("Close")
390- enabled: (root.importedVcards.length === root.vcards.length)
391- onClicked: {
392- root.dialog = null
393- Popups.PopupUtils.close(importDialog)
394- }
395- }
396-
397- Component.onDestruction: root.destroy()
398- }
399- }
400-}
401-
402-
403-

Subscribers

People subscribed via source and target branches