Merge lp:~renatofilho/address-book-app/fix-1204564 into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 46
Merged at revision: 46
Proposed branch: lp:~renatofilho/address-book-app/fix-1204564
Merge into: lp:address-book-app
Diff against target: 42 lines (+21/-0)
2 files modified
src/imports/ContactEdit/ContactDetailAvatarEditor.qml (+5/-0)
src/imports/ContactEdit/ContactEditor.qml (+16/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1204564
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+179032@code.launchpad.net

Commit message

Does not save a empty contact.

To post a comment you must log in.
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 :

This patch works fine. If you try to save an empty contact, it will indeed be ignored.
I am just wondering if we could disable the save button in case all the fields are blank instead of accepting the action and do nothing. The user would be forced to cancel, and the result of such action would be more clear.

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

This behavior needs to be discussed with designers.
Let's approve this for now and change it later if necessary.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/imports/ContactEdit/ContactDetailAvatarEditor.qml'
--- src/imports/ContactEdit/ContactDetailAvatarEditor.qml 2013-07-25 20:58:38 +0000
+++ src/imports/ContactEdit/ContactDetailAvatarEditor.qml 2013-08-07 18:59:25 +0000
@@ -23,6 +23,11 @@
23ContactDetailBase {23ContactDetailBase {
24 id: root24 id: root
2525
26 function save() {
27 //TODO: not implemented
28 return false
29 }
30
26 detail: contact ? contact.avatar : null31 detail: contact ? contact.avatar : null
27 implicitHeight: units.gu(17)32 implicitHeight: units.gu(17)
2833
2934
=== modified file 'src/imports/ContactEdit/ContactEditor.qml'
--- src/imports/ContactEdit/ContactEditor.qml 2013-08-02 17:40:44 +0000
+++ src/imports/ContactEdit/ContactEditor.qml 2013-08-07 18:59:25 +0000
@@ -38,6 +38,22 @@
38 }38 }
39 }39 }
4040
41 // new contact and there is only two details (name, avatar)
42 // name and avatar, are not removable details, because of that the contact will have at least 2 details
43 if ((contact.contactId === "qtcontacts:::") &&
44 (contact.contactDetails.length === 2)) {
45
46 // if name is empty this means that the contact is empty
47 var nameDetail = contact.detail(ContactDetail.Name)
48 if (nameDetail &&
49 (nameDetail.firstName && nameDetail.firstName != "") ||
50 (nameDetail.lastName && nameDetail.lastName != "")) {
51 // save contact
52 } else {
53 changed = false
54 }
55 }
56
41 if (changed) {57 if (changed) {
42 model.saveContact(contact)58 model.saveContact(contact)
43 } else {59 } else {

Subscribers

People subscribed via source and target branches