From 97a67db228f3b215adb5de7d094f0148649d0224 Mon Sep 17 00:00:00 2001 From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com> Date: Thu, 11 May 2017 12:05:12 -0400 Subject: [PATCH] rename getBestId to bestId MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is to follow LRC/Qt naming convention. Getters don't begin with the word "get". Note that getBestId() has been kept so as not to break API, but marked as deprecated so that we can quickly update the clients. Change-Id: Ifcf1d66763b70b5ef4f1b67d39b40892263b5359 Reviewed-by: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> --- src/call.cpp | 2 +- src/contactmethod.cpp | 14 ++++++++++---- src/contactmethod.h | 5 +++-- src/pendingcontactrequestmodel.cpp | 2 +- src/person.cpp | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/call.cpp b/src/call.cpp index 087ab14c..df465210 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 b588574b..b7bcb583 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 bedf33b6..f53d31c0 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 c8f5603c..a04caade 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 6e34e2f3..f2dee319 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), -- GitLab