From 2a27c45d2ad87faddf3571b981d19f467cf0b7b4 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Wed, 9 Sep 2015 12:19:04 -0400
Subject: [PATCH] Call & ContactMethod: use the URI if the name is empty

Issue: #80206
Change-Id: I227fa47d29a33926c55236adca3b9a4b38caf0d6
---
 src/call.cpp          | 5 +----
 src/contactmethod.cpp | 8 +++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/call.cpp b/src/call.cpp
index 6dd022b7..bb8c7e00 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -2001,10 +2001,7 @@ QVariant Call::roleData(int role) const
             return tr("Conference");
          else if (lifeCycleState() == Call::LifeCycleState::CREATION)
             return dialNumber();
-         else if (d_ptr->m_PeerName.isEmpty())
-            return ct?ct->formattedName():peerContactMethod()?peerContactMethod()->uri():dialNumber();
-         else
-            return formattedName();
+         return formattedName();
       case Qt::ToolTipRole:
          return tr("Account: ") + (account()?account()->alias():QString());
       case Qt::EditRole:
diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp
index b8c09bf2..22292d45 100644
--- a/src/contactmethod.cpp
+++ b/src/contactmethod.cpp
@@ -462,7 +462,13 @@ QVariant ContactMethod::roleData(int role) const
    QVariant cat;
    switch (role) {
       case static_cast<int>(Call::Role::Name):
-         cat = contact()?contact()->formattedName():primaryName();
+         /* the formatted name could be empty either because the name of the contact is actually
+          * empty, or because the PersonPlaceHolder was never matched to a Person, in either case
+          * we prefer to display the URI in this case */
+         if (contact() and !contact()->formattedName().isEmpty())
+            cat = contact()->formattedName();
+         else
+            cat = primaryName();
          break;
       case Qt::ToolTipRole:
          cat = presenceMessage();
-- 
GitLab