Commit 708aa7a2 authored by mvogt's avatar mvogt

[libcontacts] Use backend display label in preference to address detail

When generating a display label for a contact, use the display label
provided by the backend in preference to any of the direct address
elements in the contact.
parent 380fa722
......@@ -1089,12 +1089,6 @@ QString SeasideCache::generateDisplayLabel(const QContact &contact, DisplayLabel
return displayLabel;
}
// If no label was determined from any of the available detail, fallback to the backend's label
displayLabel = contact.detail<QContactDisplayLabel>().label();
if (!displayLabel.isEmpty()) {
return displayLabel;
}
return "(Unnamed)"; // TODO: localisation
}
......@@ -1119,6 +1113,13 @@ QString SeasideCache::generateDisplayLabelFromNonNameDetails(const QContact &con
}
}
// 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();
if (!displayLabel.isEmpty()) {
return displayLabel;
}
foreach (const QContactOnlineAccount& account, contact.details<QContactOnlineAccount>()) {
if (!account.accountUri().isEmpty()) {
return account.accountUri();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment