Merge lp:~renatofilho/address-book-service/fix-1548783 into lp:address-book-service

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Arthur Mello
Approved revision: no longer in the source branch.
Merged at revision: 204
Proposed branch: lp:~renatofilho/address-book-service/fix-1548783
Merge into: lp:address-book-service
Diff against target: 86 lines (+30/-14)
2 files modified
lib/qindividual.cpp (+18/-2)
tests/unittest/qcontacts-test.cpp (+12/-12)
To merge this branch: bzr merge lp:~renatofilho/address-book-service/fix-1548783
Reviewer Review Type Date Requested Status
Arthur Mello (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+293808@code.launchpad.net

Commit message

Use middle name value on display name.

To post a comment you must log in.
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)
Revision history for this message
Arthur Mello (artmello) wrote :

lgtm

review: Approve
204. By Renato Araujo Oliveira Filho

Use middle name value on display name. Fixes: #1375933, #1548783
Approved by: Arthur Mello, PS Jenkins bot

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/qindividual.cpp'
--- lib/qindividual.cpp 2015-10-29 13:34:18 +0000
+++ lib/qindividual.cpp 2016-05-04 21:28:44 +0000
@@ -1705,8 +1705,24 @@
1705 if (fallbackLabel.isEmpty()) {1705 if (fallbackLabel.isEmpty()) {
1706 QContactName name = contact.detail<QContactName>();1706 QContactName name = contact.detail<QContactName>();
1707 if (!name.isEmpty()) {1707 if (!name.isEmpty()) {
1708 QString fullName = QString("%1 %2").arg(name.firstName()).arg(name.lastName());1708 QStringList names;
1709 fallbackLabel = fullName.trimmed();1709 if (!name.prefix().isEmpty()) {
1710 names << name.prefix();
1711 }
1712 if (!name.firstName().isEmpty()) {
1713 names << name.firstName();
1714 }
1715 if (!name.middleName().isEmpty()) {
1716 names << name.middleName();
1717 }
1718 if (!name.lastName().isEmpty()) {
1719 names << name.lastName();
1720 }
1721 if (!name.suffix().isEmpty()) {
1722 names << name.suffix();
1723 }
1724
1725 fallbackLabel = names.join(" ").trimmed();
1710 }1726 }
1711 }1727 }
17121728
17131729
=== modified file 'tests/unittest/qcontacts-test.cpp'
--- tests/unittest/qcontacts-test.cpp 2015-10-27 15:15:33 +0000
+++ tests/unittest/qcontacts-test.cpp 2016-05-04 21:28:44 +0000
@@ -366,8 +366,8 @@
366 QList<QContact> contacts = m_manager->contacts(ids);366 QList<QContact> contacts = m_manager->contacts(ids);
367367
368 QCOMPARE(contacts[0].details<QContactTag>().size(), 1);368 QCOMPARE(contacts[0].details<QContactTag>().size(), 1);
369 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("Fulano Tal"));369 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("Fulano de Tal"));
370 QCOMPARE(contacts[0].detail<QContactTag>().tag(), QStringLiteral("FULANO TAL"));370 QCOMPARE(contacts[0].detail<QContactTag>().tag(), QStringLiteral("FULANO DE TAL"));
371371
372 // Change contact name372 // Change contact name
373 name = contact.detail<QContactName>();373 name = contact.detail<QContactName>();
@@ -377,8 +377,8 @@
377377
378 contacts = m_manager->contacts(ids);378 contacts = m_manager->contacts(ids);
379 QCOMPARE(contacts[0].details<QContactTag>().size(), 1);379 QCOMPARE(contacts[0].details<QContactTag>().size(), 1);
380 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("xFulano Tal"));380 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("xFulano de Tal"));
381 QCOMPARE(contacts[0].detail<QContactTag>().tag(), QStringLiteral("XFULANO TAL"));381 QCOMPARE(contacts[0].detail<QContactTag>().tag(), QStringLiteral("XFULANO DE TAL"));
382 }382 }
383383
384 void testContactChangeOrder()384 void testContactChangeOrder()
@@ -427,10 +427,10 @@
427 QContactFilter filter;427 QContactFilter filter;
428 QList<QContact> contacts = m_manager->contacts(filter);428 QList<QContact> contacts = m_manager->contacts(filter);
429429
430 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("A Tal"));430 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("A de Tal"));
431 QCOMPARE(contacts[1].detail<QContactDisplayLabel>().label(), QStringLiteral("B Tal"));431 QCOMPARE(contacts[1].detail<QContactDisplayLabel>().label(), QStringLiteral("B de Tal"));
432 QCOMPARE(contacts[2].detail<QContactDisplayLabel>().label(), QStringLiteral("C Tal"));432 QCOMPARE(contacts[2].detail<QContactDisplayLabel>().label(), QStringLiteral("C de Tal"));
433 QCOMPARE(contacts[3].detail<QContactDisplayLabel>().label(), QStringLiteral("D Tal"));433 QCOMPARE(contacts[3].detail<QContactDisplayLabel>().label(), QStringLiteral("D de Tal"));
434434
435 // Update contact B name435 // Update contact B name
436 contactB = contacts[1];436 contactB = contacts[1];
@@ -443,10 +443,10 @@
443 contacts = m_manager->contacts(filter);443 contacts = m_manager->contacts(filter);
444444
445 // check new order445 // check new order
446 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("A Tal"));446 QCOMPARE(contacts[0].detail<QContactDisplayLabel>().label(), QStringLiteral("A de Tal"));
447 QCOMPARE(contacts[1].detail<QContactDisplayLabel>().label(), QStringLiteral("C Tal"));447 QCOMPARE(contacts[1].detail<QContactDisplayLabel>().label(), QStringLiteral("C de Tal"));
448 QCOMPARE(contacts[2].detail<QContactDisplayLabel>().label(), QStringLiteral("D Tal"));448 QCOMPARE(contacts[2].detail<QContactDisplayLabel>().label(), QStringLiteral("D de Tal"));
449 QCOMPARE(contacts[3].detail<QContactDisplayLabel>().label(), QStringLiteral("X Tal"));449 QCOMPARE(contacts[3].detail<QContactDisplayLabel>().label(), QStringLiteral("X de Tal"));
450 }450 }
451451
452 /*452 /*

Subscribers

People subscribed via source and target branches