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
1=== modified file 'src/imports/ContactEdit/ContactDetailAvatarEditor.qml'
2--- src/imports/ContactEdit/ContactDetailAvatarEditor.qml 2013-07-25 20:58:38 +0000
3+++ src/imports/ContactEdit/ContactDetailAvatarEditor.qml 2013-08-07 18:59:25 +0000
4@@ -23,6 +23,11 @@
5 ContactDetailBase {
6 id: root
7
8+ function save() {
9+ //TODO: not implemented
10+ return false
11+ }
12+
13 detail: contact ? contact.avatar : null
14 implicitHeight: units.gu(17)
15
16
17=== modified file 'src/imports/ContactEdit/ContactEditor.qml'
18--- src/imports/ContactEdit/ContactEditor.qml 2013-08-02 17:40:44 +0000
19+++ src/imports/ContactEdit/ContactEditor.qml 2013-08-07 18:59:25 +0000
20@@ -38,6 +38,22 @@
21 }
22 }
23
24+ // new contact and there is only two details (name, avatar)
25+ // name and avatar, are not removable details, because of that the contact will have at least 2 details
26+ if ((contact.contactId === "qtcontacts:::") &&
27+ (contact.contactDetails.length === 2)) {
28+
29+ // if name is empty this means that the contact is empty
30+ var nameDetail = contact.detail(ContactDetail.Name)
31+ if (nameDetail &&
32+ (nameDetail.firstName && nameDetail.firstName != "") ||
33+ (nameDetail.lastName && nameDetail.lastName != "")) {
34+ // save contact
35+ } else {
36+ changed = false
37+ }
38+ }
39+
40 if (changed) {
41 model.saveContact(contact)
42 } else {

Subscribers

People subscribed via source and target branches