Skip to content

Commit

Permalink
[qtcontacts-sqlite] Don't use custom display label as the first avail…
Browse files Browse the repository at this point in the history
…able display label option. Fixes JB#51831

The custom display label may not always be updated when the contact
name details are changed. So, prefer to generate the display label
from the contact name details if available, and use the custom display
label as a fallback option rather than the first option.
  • Loading branch information
blammit committed Oct 30, 2020
1 parent 9267656 commit 39c868d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/engine/contactsengine.cpp
Expand Up @@ -2033,11 +2033,6 @@ QString ContactsEngine::synthesizedDisplayLabel(const QContact &contact, QContac

QContactName name = contact.detail<QContactName>();

// If a custom label has been set, return that
const QString customLabel = name.value<QString>(QContactName::FieldCustomLabel);
if (!customLabel.isEmpty())
return customLabel;

QString displayLabel;

if (!name.firstName().isEmpty())
Expand All @@ -2053,6 +2048,11 @@ QString ContactsEngine::synthesizedDisplayLabel(const QContact &contact, QContac
return displayLabel;
}

// If a custom label has been set, return that
const QString customLabel = name.value<QString>(QContactName::FieldCustomLabel);
if (!customLabel.isEmpty())
return customLabel;

foreach (const QContactNickname& nickname, contact.details<QContactNickname>()) {
if (!nickname.nickname().isEmpty()) {
return nickname.nickname();
Expand Down

0 comments on commit 39c868d

Please sign in to comment.