diff --git a/src/call.cpp b/src/call.cpp index 087ab14c98b3f9a18f212b835708c26bd2b78a94..df465210182a28b240ed6ff18c79ce6ef5144fb1 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -2183,7 +2183,7 @@ QVariant Call::roleData(int role) const return dialNumber(); case static_cast<int>(Ring::Role::Number): case static_cast<int>(Call::Role::Number): - return peerContactMethod()->getBestId(); + return peerContactMethod()->bestId(); case static_cast<int>(Ring::Role::URI): return peerContactMethod()->uri(); case Qt::DecorationRole: diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp index b588574bdd30937a2229965e7427305eceaaaf87..b7bcb5838b95da593f3c961697c2f85f98ed37eb 100644 --- a/src/contactmethod.cpp +++ b/src/contactmethod.cpp @@ -432,11 +432,17 @@ QString ContactMethod::registeredName() const return d_ptr->m_RegisteredName.isEmpty()? QString() : d_ptr->m_RegisteredName; } -/// Best bet for this contact identity -/// returns the registered name if present, otherwise returns the uri +/// Returns the registered name if available, otherwise returns the uri +/// Deprecated for not following LRC naming convention, please use bestId() instead QString ContactMethod::getBestId() const { - return d_ptr->m_RegisteredName.isEmpty() ? d_ptr->m_Uri : d_ptr->m_RegisteredName; + return bestId(); +} + +/// Returns the registered name if available, otherwise returns the uri +QString ContactMethod::bestId() const +{ + return registeredName().isEmpty() ? uri() : registeredName(); } /** @@ -560,7 +566,7 @@ QVariant ContactMethod::roleData(int role) const case Qt::EditRole: case static_cast<int>(Ring::Role::Number): case static_cast<int>(Call::Role::Number): - cat = getBestId(); + cat = bestId(); break; case Qt::DecorationRole: return GlobalInstances::pixmapManipulator().decorationRole(this); diff --git a/src/contactmethod.h b/src/contactmethod.h index bedf33b682a8e096011635b9218daccf53baa482..f53d31c04753ba6b1826642786bc385be294731f 100644 --- a/src/contactmethod.h +++ b/src/contactmethod.h @@ -89,7 +89,7 @@ public: Q_PROPERTY(bool isReachable READ isReachable ) Q_PROPERTY(Certificate* certificate READ certificate ) Q_PROPERTY(QString registeredName READ registeredName NOTIFY registeredNameSet ) - Q_PROPERTY(QString getBestId READ getBestId ) + Q_PROPERTY(QString bestId READ bestId ) // Q_PROPERTY(QHash<QString,int> alternativeNames READ alternativeNames ) @@ -132,7 +132,8 @@ public: bool isReachable () const; Certificate* certificate () const; QString registeredName () const; - QString getBestId () const; + Q_DECL_DEPRECATED QString getBestId () const; + QString bestId () const; bool isDuplicate () const; /* diff --git a/src/pendingcontactrequestmodel.cpp b/src/pendingcontactrequestmodel.cpp index c8f5603cfa11605013a52f712681960ff7438870..a04caade87087bb3343e106f7d5325367c97560e 100644 --- a/src/pendingcontactrequestmodel.cpp +++ b/src/pendingcontactrequestmodel.cpp @@ -51,7 +51,7 @@ QVariant PendingContactRequestModel::data( const QModelIndex& index, int role ) case Columns::PEER_ID: switch(role) { case Qt::DisplayRole: - return d_ptr->m_lRequests[index.row()]->peer()->phoneNumbers()[0]->getBestId(); + return d_ptr->m_lRequests[index.row()]->peer()->phoneNumbers()[0]->bestId(); } break; case Columns::TIME: diff --git a/src/person.cpp b/src/person.cpp index 6e34e2f3dbf79a5ddac5096cae10145d0fe362c2..f2dee319039666e7ef0532093d49ec156a4b57b5 100644 --- a/src/person.cpp +++ b/src/person.cpp @@ -203,7 +203,7 @@ PersonPrivate::getLastIdUsed() return (a->lastUsed() < b->lastUsed()); }); - return (*lastPhoneNumberUsed) ? (*lastPhoneNumberUsed)->getBestId() : QString(); + return (*lastPhoneNumberUsed) ? (*lastPhoneNumberUsed)->bestId() : QString(); } PersonPrivate::PersonPrivate(Person* contact) : QObject(nullptr),