From 708aa7a2edc366a5c66e8b26a3c3c7e1612968d4 Mon Sep 17 00:00:00 2001 From: Matt Vogt Date: Sun, 8 Dec 2013 19:56:12 -0800 Subject: [PATCH] [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. --- src/seasidecache.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/seasidecache.cpp b/src/seasidecache.cpp index 0e4750e..370f73c 100644 --- a/src/seasidecache.cpp +++ b/src/seasidecache.cpp @@ -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().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().label(); + if (!displayLabel.isEmpty()) { + return displayLabel; + } + foreach (const QContactOnlineAccount& account, contact.details()) { if (!account.accountUri().isEmpty()) { return account.accountUri();