Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #82 from matthewvogt/organization-name
Browse files Browse the repository at this point in the history
[libcontacts] Prefer organization name to contact details in display label
  • Loading branch information
matthewvogt committed Jun 13, 2014
2 parents e442c84 + ec3863f commit 972990d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/seasidecache.cpp
Expand Up @@ -1138,6 +1138,12 @@ QString SeasideCache::generateDisplayLabelFromNonNameDetails(const QContact &con
}
}

// If this contact has organization details but no name, it probably represents that organization directly
QContactOrganization company = contact.detail<QContactOrganization>();
if (!company.name().isEmpty()) {
return company.name();
}

// If none of the detail fields provides a label, fallback to the backend's label string, in
// preference to using any of the addressing details directly
const QString displayLabel = contact.detail<QContactDisplayLabel>().label();
Expand All @@ -1157,11 +1163,6 @@ QString SeasideCache::generateDisplayLabelFromNonNameDetails(const QContact &con
}
}

QContactOrganization company = contact.detail<QContactOrganization>();
if (!company.name().isEmpty()) {
return company.name();
}

foreach (const QContactPhoneNumber& phone, contact.details<QContactPhoneNumber>()) {
if (!phone.number().isEmpty())
return phone.number();
Expand Down

0 comments on commit 972990d

Please sign in to comment.