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
=== modified file 'src/imports/ABContactListPage.qml'
--- src/imports/ABContactListPage.qml 2015-10-26 13:18:11 +0000
+++ src/imports/ABContactListPage.qml 2015-11-19 14:41:33 +0000
@@ -89,7 +89,11 @@
8989
90 function showContact(contact)90 function showContact(contact)
91 {91 {
92 mainPage.state = "default";92 // go back to normal state if not searching
93 if ((state !== "searching") &&
94 (state !== "vcardImported")) {
95 mainPage.state = "default";
96 }
93 openViewPage({model: contactList.listModel,97 openViewPage({model: contactList.listModel,
94 contact: contact});98 contact: contact});
95 }99 }
@@ -109,13 +113,10 @@
109113
110 function importContact(urls)114 function importContact(urls)
111 {115 {
112 if (urls.length > 0) {116 for(var i=0, iMax=urls.length; i < iMax; i++) {
113 var importDialog = Qt.createQmlObject("VCardImportDialog{}",117 var url = urls[i]
114 mainPage,118 if (url && url != "")
115 "VCardImportDialog")119 contactList.listModel.importContacts(url)
116 if (importDialog) {
117 importDialog.importVCards(contactList.listModel, urls)
118 }
119 }120 }
120 }121 }
121122
@@ -129,6 +130,11 @@
129130
130 function moveListToContact(contact)131 function moveListToContact(contact)
131 {132 {
133 // skipt it if searching
134 if (state === "searching") {
135 return
136 }
137
132 contactIndex = contact138 contactIndex = contact
133 mainPage.state = "default"139 mainPage.state = "default"
134 // this means a new contact was created140 // this means a new contact was created
@@ -176,15 +182,11 @@
176 filterTerm: searchField.text182 filterTerm: searchField.text
177 multiSelectionEnabled: true183 multiSelectionEnabled: true
178 multipleSelection: (mainPage.pickMode && mainPage.pickMultipleContacts) || !mainPage.pickMode184 multipleSelection: (mainPage.pickMode && mainPage.pickMultipleContacts) || !mainPage.pickMode
179 highlightedContact: contactViewPage ? contactViewPage.contact :185 highlightSelected: pageStack.columns > 1
180 contactEditorPage ? contactEditorPage.contact : null
181
182 onAddContactClicked: mainPage.createContactWithPhoneNumber(label)186 onAddContactClicked: mainPage.createContactWithPhoneNumber(label)
183 onAddNewContactClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd)187 onAddNewContactClicked: mainPage.createContactWithPhoneNumber(mainPage.newPhoneToAdd)
184188
185 onContactClicked: {189 onContactClicked: mainPage.showContact(contact)
186 showContact(contact);
187 }
188 onIsInSelectionModeChanged: mainPage.state = isInSelectionMode ? "selection" : "default"190 onIsInSelectionModeChanged: mainPage.state = isInSelectionMode ? "selection" : "default"
189 onSelectionCanceled: {191 onSelectionCanceled: {
190 if (pickMode) {192 if (pickMode) {
@@ -209,10 +211,15 @@
209 right: parent.right211 right: parent.right
210 rightMargin: units.gu(2)212 rightMargin: units.gu(2)
211 }213 }
212 visible: mainPage.searching214 focus: false
215 visible: false
213 onTextChanged: contactList.currentIndex = -1216 onTextChanged: contactList.currentIndex = -1
214 inputMethodHints: Qt.ImhNoPredictiveText217 inputMethodHints: Qt.ImhNoPredictiveText
215 placeholderText: i18n.tr("Search...")218 placeholderText: i18n.tr("Search...")
219 onFocusChanged: {
220 if (visible && focus)
221 searchField.forceActiveFocus()
222 }
216 }223 }
217224
218 Connections {225 Connections {
@@ -289,6 +296,10 @@
289 target: searchField296 target: searchField
290 text: ""297 text: ""
291 }298 }
299 PropertyChanges {
300 target: contactList
301 filter: null
302 }
292 },303 },
293 PageHeadState {304 PageHeadState {
294 id: searchingState305 id: searchingState
@@ -305,6 +316,11 @@
305 }316 }
306317
307 PropertyChanges {318 PropertyChanges {
319 target: bottomEdge
320 enabled: false
321 }
322
323 PropertyChanges {
308 target: mainPage.head324 target: mainPage.head
309 backAction: searchingState.backAction325 backAction: searchingState.backAction
310 contents: searchField326 contents: searchField
@@ -314,6 +330,12 @@
314 target: searchField330 target: searchField
315 text: ""331 text: ""
316 }332 }
333
334 PropertyChanges {
335 target: searchField
336 visible: true
337 focus: true
338 }
317 },339 },
318 PageHeadState {340 PageHeadState {
319 id: selectionState341 id: selectionState
@@ -418,12 +440,50 @@
418 target: bottomEdge440 target: bottomEdge
419 enabled: false441 enabled: false
420 }442 }
443 },
444 PageHeadState {
445 id: varctImportedState
446
447 name: "vcardImported"
448 backAction: Action {
449 iconName: "back"
450 text: i18n.tr("Back")
451 onTriggered: {
452 contactList.forceActiveFocus()
453 mainPage.state = "default"
454 importedIdsFilter.ids = []
455 }
456 }
457 PropertyChanges {
458 target: mainPage.head
459 backAction: varctImportedState.backAction
460 }
461 PropertyChanges {
462 target: bottomEdge
463 enabled: false
464 }
465 PropertyChanges {
466 target: contactList
467 filter: importedIdsFilter
468 }
469 PropertyChanges {
470 target: mainPage
471 title: i18n.tr("Imported contacts")
472 }
421 }473 }
422 ]474 ]
475
423 onActiveChanged: {476 onActiveChanged: {
424 if (active && contactList.showAddNewButton) {477 if (active && contactList.showAddNewButton) {
425 contactList.positionViewAtBeginning()478 contactList.positionViewAtBeginning()
426 }479 }
480 if (active && (state === "searching")) {
481 searchField.forceActiveFocus()
482 }
483 }
484
485 IdFilter {
486 id: importedIdsFilter
427 }487 }
428488
429 KeyboardRectangle {489 KeyboardRectangle {
@@ -478,16 +538,6 @@
478 }538 }
479 }539 }
480540
481 Connections {
482 target: mainPage.contactModel
483 onContactsChanged: {
484 if (contactIndex) {
485 contactList.positionViewAtContact(mainPage.contactIndex)
486 mainPage.contactIndex = null
487 }
488 }
489 }
490
491 ContactExporter {541 ContactExporter {
492 id: contactExporter542 id: contactExporter
493543
@@ -538,7 +588,7 @@
538588
539 Component.onCompleted: {589 Component.onCompleted: {
540 application.elapsed()590 application.elapsed()
541 if ((typeof(TEST_DATA) !== "undefined") && (TEST_DATA !== "")) {591 if ((typeof(TEST_DATA) !== "undefined") && (TEST_DATA != "")) {
542 contactList.listModel.importContacts("file://" + TEST_DATA)592 contactList.listModel.importContacts("file://" + TEST_DATA)
543 }593 }
544594
@@ -647,6 +697,27 @@
647 }697 }
648698
649 Connections {699 Connections {
700 target: mainPage.contactModel
701 onContactsChanged: {
702 if (contactIndex) {
703 contactList.positionViewAtContact(mainPage.contactIndex)
704 mainPage.contactIndex = null
705 }
706 }
707 onImportCompleted: {
708 if (error !== ContactModel.ImportNoError) {
709 console.error("Fail to import vcard:" + error)
710 } else {
711 var importedIds = ids
712 importedIds.concat(importedIdsFilter.ids)
713 importedIdsFilter.ids = importedIds
714 console.debug("Imported ids:" + importedIds)
715 mainPage.state = "vcardImported"
716 }
717 }
718 }
719
720 Connections {
650 target: mainPage.contactViewPage721 target: mainPage.contactViewPage
651 onEditContact: {722 onEditContact: {
652 openEditPage(editPageProperties, mainPage.contactViewPage);723 openEditPage(editPageProperties, mainPage.contactViewPage);
653724
=== modified file 'src/imports/BottomEdge.qml'
--- src/imports/BottomEdge.qml 2015-10-23 14:32:47 +0000
+++ src/imports/BottomEdge.qml 2015-11-19 14:41:33 +0000
@@ -89,10 +89,10 @@
89 id: bottomEdgeLoader89 id: bottomEdgeLoader
90 sourceComponent: bottomEdge.contentComponent90 sourceComponent: bottomEdge.contentComponent
91 asynchronous: true91 asynchronous: true
92 active: bottomEdge.enabled
92 }93 }
93 }94 }
9495
95
96 BottomEdgeHint {96 BottomEdgeHint {
97 id: bottomEdgeHint97 id: bottomEdgeHint
9898
9999
=== modified file 'src/imports/CMakeLists.txt'
--- src/imports/CMakeLists.txt 2015-10-16 13:37:25 +0000
+++ src/imports/CMakeLists.txt 2015-11-19 14:41:33 +0000
@@ -6,7 +6,6 @@
6 ABContactViewPage.qml6 ABContactViewPage.qml
7 ContentHubProxy.qml7 ContentHubProxy.qml
8 MainWindow.qml8 MainWindow.qml
9 VCardImportDialog.qml
10 BottomEdgeShadow.qml9 BottomEdgeShadow.qml
11 BottomEdge.qml10 BottomEdge.qml
12)11)
1312
=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml 2015-10-28 01:07:59 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2015-11-19 14:41:33 +0000
@@ -248,12 +248,8 @@
248 This property holds the vertical velocity of the list248 This property holds the vertical velocity of the list
249 */249 */
250 readonly property real verticalVelocity: view.verticalVelocity250 readonly property real verticalVelocity: view.verticalVelocity
251 /*!
252 \qmlproperty Contact highlightedContact
253251
254 This property holds a reference to the Contact that should be highlighted252 property alias highlightSelected: view.highlightSelected
255 */
256 property Contact highlightedContact: null
257253
258 property var _busyDialog: null254 property var _busyDialog: null
259255
@@ -382,7 +378,6 @@
382 property bool showFavourites: true378 property bool showFavourites: true
383 property alias favouritesIsSelected: contactsModel.onlyFavorites379 property alias favouritesIsSelected: contactsModel.onlyFavorites
384 property bool contactsLoaded: false380 property bool contactsLoaded: false
385 highlightedContact: root.highlightedContact
386381
387 function getSectionText(index) {382 function getSectionText(index) {
388 var tag = listModel.contacts[index].tag.tag383 var tag = listModel.contacts[index].tag.tag
389384
=== modified file 'src/imports/Ubuntu/Contacts/ContactSimpleListView.qml'
--- src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2015-10-26 13:18:11 +0000
+++ src/imports/Ubuntu/Contacts/ContactSimpleListView.qml 2015-11-19 14:41:33 +0000
@@ -145,11 +145,11 @@
145 property list<Action> rightSideActions145 property list<Action> rightSideActions
146146
147 /*!147 /*!
148 \qmlproperty Contact highlightedContact148 \qmlproperty highlightSelected
149149
150 This property holds a reference to the Contact that should be highlighted150 This property holds if the current contact should be highlighted or not
151 */151 */
152 property Contact highlightedContact: null152 property bool highlightSelected: false
153153
154 /* internal */154 /* internal */
155 property var _currentSwipedItem: null155 property var _currentSwipedItem: null
@@ -269,7 +269,7 @@
269 flicking: contactListView.flicking269 flicking: contactListView.flicking
270 width: parent.width270 width: parent.width
271 selected: (contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate))271 selected: (contactListView.multiSelectionEnabled && contactListView.isSelected(contactDelegate))
272 || (contactListView.highlightedContact && contactListView.highlightedContact.contactId == contact.contactId)272 || (contactListView.highlightSelected && (contactListView.currentIndex == index))
273 selectionMode: contactListView.isInSelectionMode273 selectionMode: contactListView.isInSelectionMode
274 defaultAvatarUrl: contactListView.defaultAvatarImageUrl274 defaultAvatarUrl: contactListView.defaultAvatarImageUrl
275 isCurrentItem: ListView.isCurrentItem275 isCurrentItem: ListView.isCurrentItem
276276
=== removed file 'src/imports/VCardImportDialog.qml'
--- src/imports/VCardImportDialog.qml 2015-10-26 13:18:11 +0000
+++ src/imports/VCardImportDialog.qml 1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
1/*
2 * Copyright (C) 2014 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.4
18import QtContacts 5.0
19import Ubuntu.Components 1.3
20import Ubuntu.Components.Popups 1.3 as Popups
21
22Item {
23 id: root
24
25 property alias model: modelConnections.target
26 property var vcards: []
27 property var importedVcards: []
28 property var importErrors: []
29 property var dialog: null
30
31 signal finished()
32
33 function importVCards(model, vcards)
34 {
35 if (dialog || vcards.length === 0) {
36 return
37 }
38
39 root.model = model
40 root.vcards = vcards
41 dialog = Popups.PopupUtils.open(importDialogComponent, root)
42
43 for(var i=0, iMax=vcards.length; i < iMax; i++) {
44 var vcardUrl = vcards[i]
45 model.importContacts(vcardUrl)
46 }
47 }
48
49 Connections {
50 id: modelConnections
51
52 onImportCompleted: {
53 var imported = root.importedVcards
54 var importErrors = root.importErrors
55 imported.push(url)
56 if (error !== ContactModel.ImportNoError) {
57 root.importErrors.push(error)
58 console.error("Fail to import vcard:" + error)
59 }
60 root.importedVcards = imported
61 root.importErrors = importErrors
62 }
63 }
64
65 Component {
66 id: importDialogComponent
67
68 Popups.Dialog {
69 id: importDialog
70
71 title: i18n.tr("Import vCards")
72 text: root.importedVcards.length === 0 ? i18n.tr("Importing...") : i18n.tr("%1 vCards imported").arg(root.importedVcards.length)
73
74 Button {
75 anchors {
76 left: parent.left
77 right: parent.right
78 margins: units.gu(1)
79 }
80 text: i18n.tr("Close")
81 enabled: (root.importedVcards.length === root.vcards.length)
82 onClicked: {
83 root.dialog = null
84 Popups.PopupUtils.close(importDialog)
85 }
86 }
87
88 Component.onDestruction: root.destroy()
89 }
90 }
91}
92
93
94

Subscribers

People subscribed via source and target branches