From d303456798d41dff61e5f4d3806c23a03df87c71 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Thu, 11 May 2017 11:48:05 -0400
Subject: [PATCH] add Ring::Role::URI data role
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Calls and ContactMethods will support this role in case the user
would like to explicitly get the URI and not the registered name.

Change-Id: I920509a1c07c8b372110e2e97e9e335df57a0565
Reviewed-by: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
---
 src/call.cpp          | 2 ++
 src/contactmethod.cpp | 1 +
 src/itemdataroles.h   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/call.cpp b/src/call.cpp
index e13752e3..087ab14c 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -2184,6 +2184,8 @@ QVariant Call::roleData(int role) const
       case static_cast<int>(Ring::Role::Number):
       case static_cast<int>(Call::Role::Number):
          return peerContactMethod()->getBestId();
+      case static_cast<int>(Ring::Role::URI):
+         return peerContactMethod()->uri();
       case Qt::DecorationRole:
          return GlobalInstances::pixmapManipulator().decorationRole(this);
       case static_cast<int>(Call::Role::Direction):
diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp
index 96ff35e4..b588574b 100644
--- a/src/contactmethod.cpp
+++ b/src/contactmethod.cpp
@@ -552,6 +552,7 @@ QVariant ContactMethod::roleData(int role) const
       case Qt::ToolTipRole:
          cat = presenceMessage();
          break;
+      case static_cast<int>(Ring::Role::URI):
       case static_cast<int>(Role::Uri):
          cat = uri();
          break;
diff --git a/src/itemdataroles.h b/src/itemdataroles.h
index c3dd1343..3b5331ea 100644
--- a/src/itemdataroles.h
+++ b/src/itemdataroles.h
@@ -48,6 +48,7 @@ enum class Role
     DropState          ,
     IsPresent          ,
     UnreadTextMessageCount,
+    URI                ,
     UserRole           = Qt::UserRole + 100  // this should always be the last role in the list
 };
 
-- 
GitLab