diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b017afe4529885ead48c89e1994f5431c05b737..a080359d401a6e96c50d2a208df72fdec62eb986 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ SET( libringclient_LIB_SRCS src/uri.cpp src/account.cpp src/person.cpp - src/phonenumber.cpp + src/contactmethod.cpp src/numbercategory.cpp src/collectionextensioninterface.cpp src/video/rate.cpp @@ -266,7 +266,7 @@ SET( libringclient_LIB_HDRS src/contactproxymodel.h src/useractionmodel.h src/presencestatusmodel.h - src/phonenumber.h + src/contactmethod.h src/phonedirectorymodel.h src/historytimecategorymodel.h src/numbercategorymodel.h diff --git a/src/account.cpp b/src/account.cpp index b6c7d6479062c2f53066a570a16290922e7dce46..c9316f6ef1554ff19a48e04e307dacf66aef74b7 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -44,7 +44,7 @@ #include "audio/codecmodel.h" #include "video/codecmodel2.h" #include "ringtonemodel.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "phonedirectorymodel.h" #include "presencestatusmodel.h" #include "uri.h" @@ -111,7 +111,7 @@ Account* AccountPrivate::buildNewAccountFromAlias(const QString& alias) Account* a = new Account(); a->d_ptr->m_hAccountDetails.clear(); a->d_ptr->m_hAccountDetails[DRing::Account::ConfProperties::ENABLED] = "false"; - a->d_ptr->m_pAccountNumber = const_cast<PhoneNumber*>(PhoneNumber::BLANK()); + a->d_ptr->m_pAccountNumber = const_cast<ContactMethod*>(ContactMethod::BLANK()); MapStringString tmp = configurationManager.getAccountTemplate(); QMutableMapIterator<QString, QString> iter(tmp); while (iter.hasNext()) { @@ -1499,7 +1499,7 @@ void AccountPrivate::reload() disconnect(m_pAccountNumber,SIGNAL(presentChanged(bool)),this,SLOT(slotPresentChanged(bool))); } m_pAccountNumber = PhoneDirectoryModel::instance()->getNumber(currentUri,q_ptr); - m_pAccountNumber->setType(PhoneNumber::Type::ACCOUNT); + m_pAccountNumber->setType(ContactMethod::Type::ACCOUNT); connect(m_pAccountNumber,SIGNAL(presenceMessageChanged(QString)),this,SLOT(slotPresenceMessageChanged(QString))); connect(m_pAccountNumber,SIGNAL(presentChanged(bool)),this,SLOT(slotPresentChanged(bool))); } diff --git a/src/account.h b/src/account.h index d3249c4eb389d9ae112aafe3efd70acc8db6d78a..14277c564dc319671051d4de9e7e04d4187a4ac6 100644 --- a/src/account.h +++ b/src/account.h @@ -33,7 +33,7 @@ class QString; #include "typedefs.h" class CredentialModel ; class RingToneModel ; -class PhoneNumber ; +class ContactMethod ; class SecurityValidationModel; class Certificate ; class CipherModel ; diff --git a/src/bookmarkmodel.cpp b/src/bookmarkmodel.cpp index 7d017274f4d28475c0dffdc26813666903159898..0acfa5d7e926f91cb4a7a5b4fb9ae6b28dbc03e5 100644 --- a/src/bookmarkmodel.cpp +++ b/src/bookmarkmodel.cpp @@ -25,7 +25,7 @@ #include "historymodel.h" #include "dbus/presencemanager.h" #include "phonedirectorymodel.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "callmodel.h" #include "call.h" #include "person.h" @@ -64,8 +64,8 @@ public: QVariant commonCallInfo(NumberTreeBackend* call, int role = Qt::DisplayRole) const; QString category(NumberTreeBackend* number) const; bool displayFrequentlyUsed() const; - QVector<PhoneNumber*> bookmarkList () const; - static QVector<PhoneNumber*> serialisedToList(const QStringList& list); + QVector<ContactMethod*> bookmarkList () const; + static QVector<ContactMethod*> serialisedToList(const QStringList& list); private Q_SLOTS: void slotRequest(const QString& uri); @@ -85,11 +85,11 @@ class NumberTreeBackend : public CategorizedCompositeNode { friend class BookmarkModel; public: - NumberTreeBackend(PhoneNumber* number); + NumberTreeBackend(ContactMethod* number); virtual ~NumberTreeBackend(); virtual QObject* getSelf() const { return nullptr; } - PhoneNumber* m_pNumber; + ContactMethod* m_pNumber; BookmarkTopLevelItem* m_pParent; int m_Index; BookmarkItemNode* m_pNode; @@ -99,9 +99,9 @@ class BookmarkItemNode : public QObject //TODO remove this once Qt4 support is d { Q_OBJECT public: - BookmarkItemNode(BookmarkModel* m, PhoneNumber* n, NumberTreeBackend* backend); + BookmarkItemNode(BookmarkModel* m, ContactMethod* n, NumberTreeBackend* backend); private: - PhoneNumber* m_pNumber; + ContactMethod* m_pNumber; NumberTreeBackend* m_pBackend; BookmarkModel* m_pModel; private Q_SLOTS: @@ -115,7 +115,7 @@ BookmarkModelPrivate::BookmarkModelPrivate(BookmarkModel* parent) : QObject(pare } -NumberTreeBackend::NumberTreeBackend(PhoneNumber* number): CategorizedCompositeNode(CategorizedCompositeNode::Type::BOOKMARK), +NumberTreeBackend::NumberTreeBackend(ContactMethod* number): CategorizedCompositeNode(CategorizedCompositeNode::Type::BOOKMARK), m_pNumber(number),m_pParent(nullptr),m_pNode(nullptr),m_Index(-1){ Q_ASSERT(number != nullptr); } @@ -124,7 +124,7 @@ NumberTreeBackend::~NumberTreeBackend() { if (m_pNode) delete m_pNode; } -BookmarkItemNode::BookmarkItemNode(BookmarkModel* m, PhoneNumber* n, NumberTreeBackend* backend) : +BookmarkItemNode::BookmarkItemNode(BookmarkModel* m, ContactMethod* n, NumberTreeBackend* backend) : m_pNumber(n),m_pBackend(backend),m_pModel(m){ connect(n,SIGNAL(changed()),this,SLOT(slotNumberChanged())); } @@ -182,10 +182,10 @@ void BookmarkModel::reloadCategories() item->m_Row = d_ptr->m_lCategoryCounter.size(); item->m_MostPopular = true; d_ptr->m_lCategoryCounter << item; - const QVector<PhoneNumber*> cl = PhoneDirectoryModel::instance()->getNumbersByPopularity(); + const QVector<ContactMethod*> cl = PhoneDirectoryModel::instance()->getNumbersByPopularity(); for (int i=0;i<((cl.size()>=10)?10:cl.size());i++) { - PhoneNumber* n = cl[i]; + ContactMethod* n = cl[i]; NumberTreeBackend* bm = new NumberTreeBackend(n); bm->m_pParent = item; bm->m_Index = item->m_lChildren.size(); @@ -196,7 +196,7 @@ void BookmarkModel::reloadCategories() } - foreach(PhoneNumber* bookmark, d_ptr->bookmarkList()) { + foreach(ContactMethod* bookmark, d_ptr->bookmarkList()) { NumberTreeBackend* bm = new NumberTreeBackend(bookmark); const QString val = d_ptr->category(bm); if (!d_ptr->m_hCategories[val]) { @@ -374,7 +374,7 @@ QVariant BookmarkModelPrivate::commonCallInfo(NumberTreeBackend* number, int rol cat = number->m_pNumber->presenceMessage(); break; case Call::Role::Number: - cat = number->m_pNumber->uri();//call->getPeerPhoneNumber(); + cat = number->m_pNumber->uri();//call->getPeerContactMethod(); break; case Call::Role::Direction2: cat = 4;//call->getHistoryState(); @@ -398,7 +398,7 @@ QVariant BookmarkModelPrivate::commonCallInfo(NumberTreeBackend* number, int rol cat = "N/A";//timeToHistoryCategory(QDateTime::fromTime_t(call->getStartTimeStamp().toUInt()).date()); break; case Call::Role::PhoneNu: - return QVariant::fromValue(const_cast<PhoneNumber*>(number->m_pNumber)); + return QVariant::fromValue(const_cast<ContactMethod*>(number->m_pNumber)); case Call::Role::IsBookmark: return true; case Call::Role::Filter: @@ -432,11 +432,11 @@ void BookmarkModelPrivate::slotRequest(const QString& uri) -QVector<PhoneNumber*> BookmarkModelPrivate::serialisedToList(const QStringList& list) +QVector<ContactMethod*> BookmarkModelPrivate::serialisedToList(const QStringList& list) { - QVector<PhoneNumber*> numbers; + QVector<ContactMethod*> numbers; foreach(const QString& item,list) { - PhoneNumber* nb = PhoneDirectoryModel::instance()->fromHash(item); + ContactMethod* nb = PhoneDirectoryModel::instance()->fromHash(item); if (nb) { nb->setTracked(true); nb->setUid(item); @@ -451,9 +451,9 @@ bool BookmarkModelPrivate::displayFrequentlyUsed() const return true; } -QVector<PhoneNumber*> BookmarkModelPrivate::bookmarkList() const +QVector<ContactMethod*> BookmarkModelPrivate::bookmarkList() const { - return (q_ptr->backends().size() > 0) ? q_ptr->backends()[0]->items<PhoneNumber>() : QVector<PhoneNumber*>(); + return (q_ptr->backends().size() > 0) ? q_ptr->backends()[0]->items<ContactMethod>() : QVector<ContactMethod*>(); } BookmarkTopLevelItem::BookmarkTopLevelItem(QString name) @@ -484,16 +484,16 @@ bool BookmarkModel::removeRows( int row, int count, const QModelIndex & parent) return false; } -void BookmarkModel::addBookmark(PhoneNumber* number) +void BookmarkModel::addBookmark(ContactMethod* number) { Q_UNUSED(number) if (backends().size()) - backends()[0]->editor<PhoneNumber>()->append(number); + backends()[0]->editor<ContactMethod>()->append(number); else qWarning() << "No bookmark backend is set"; } -void BookmarkModel::removeBookmark(PhoneNumber* number) +void BookmarkModel::removeBookmark(ContactMethod* number) { Q_UNUSED(number) } @@ -501,7 +501,7 @@ void BookmarkModel::removeBookmark(PhoneNumber* number) void BookmarkModel::remove(const QModelIndex& idx) { Q_UNUSED(idx) -// PhoneNumber* nb = getNumber(idx); +// ContactMethod* nb = getNumber(idx); // if (nb) { // removeRows(idx.row(),1,idx.parent()); // removeBookmark(nb); @@ -510,7 +510,7 @@ void BookmarkModel::remove(const QModelIndex& idx) // } } -PhoneNumber* BookmarkModel::getNumber(const QModelIndex& idx) +ContactMethod* BookmarkModel::getNumber(const QModelIndex& idx) { if (idx.isValid()) { if (idx.parent().isValid() && idx.parent().row() < d_ptr->m_lCategoryCounter.size()) { @@ -547,14 +547,14 @@ void BookmarkModelPrivate::slotIndexChanged(const QModelIndex& idx) // } -bool BookmarkModel::addItemCallback(PhoneNumber* item) +bool BookmarkModel::addItemCallback(ContactMethod* item) { Q_UNUSED(item) reloadCategories(); //TODO this is far from optimal return true; } -bool BookmarkModel::removeItemCallback(PhoneNumber* item) +bool BookmarkModel::removeItemCallback(ContactMethod* item) { Q_UNUSED(item) return false; @@ -590,7 +590,7 @@ bool BookmarkModel::clearAllBackends() const // void BookmarkModel::addBackend(CollectionInterface* backend, LoadOptions options) // { // d_ptr->m_lBackends << backend; -// connect(backend,SIGNAL(newBookmarkAdded(PhoneNumber*)),this,SLOT(reloadCategories())); +// connect(backend,SIGNAL(newBookmarkAdded(ContactMethod*)),this,SLOT(reloadCategories())); // if (options & LoadOptions::FORCE_ENABLED) // backend->load(); // } diff --git a/src/bookmarkmodel.h b/src/bookmarkmodel.h index 10e1506e92553e22f1e7fa6809500fdf73ffc531..37195d84e997b3f87482c5ddb75fa4d63bd36ce4 100644 --- a/src/bookmarkmodel.h +++ b/src/bookmarkmodel.h @@ -27,7 +27,7 @@ #include "collectionmanagerinterface.h" #include "collectioninterface.h" #include "typedefs.h" -#include "phonenumber.h" +#include "contactmethod.h" // #include "person.h" // #include "call.h" class PersonBackend; @@ -36,7 +36,7 @@ class NumberTreeBackend; class BookmarkModelPrivate; class CollectionInterface2; -class LIB_EXPORT BookmarkModel : public QAbstractItemModel, public CollectionManagerInterface<PhoneNumber> +class LIB_EXPORT BookmarkModel : public QAbstractItemModel, public CollectionManagerInterface<ContactMethod> { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" @@ -70,12 +70,12 @@ public: //Management void remove (const QModelIndex& idx ); - void addBookmark (PhoneNumber* number ); - void removeBookmark(PhoneNumber* number ); + void addBookmark (ContactMethod* number ); + void removeBookmark(ContactMethod* number ); //Getters int acceptedPayloadTypes(); - PhoneNumber* getNumber(const QModelIndex& idx); + ContactMethod* getNumber(const QModelIndex& idx); //Singleton static BookmarkModel* instance(); @@ -88,8 +88,8 @@ private: //Backend interface virtual void backendAddedCallback(CollectionInterface* backend) override; - virtual bool addItemCallback(PhoneNumber* item) override; - virtual bool removeItemCallback(PhoneNumber* item) override; + virtual bool addItemCallback(ContactMethod* item) override; + virtual bool removeItemCallback(ContactMethod* item) override; public Q_SLOTS: void reloadCategories(); diff --git a/src/call.cpp b/src/call.cpp index 6cc6131a397bc0126252582d478d7a194a19b747..dd96dd6f3d076e5a0d5db37c014981cfb976a195 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -43,7 +43,7 @@ #include "callmodel.h" #include "numbercategory.h" #include "phonedirectorymodel.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "video/renderer.h" #include "tlsmethodmodel.h" #include "audio/settings.h" @@ -218,7 +218,7 @@ QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::Action& c) CallPrivate::CallPrivate(Call* parent) : QObject(parent),q_ptr(parent), m_pStopTimeStamp(0), m_pImModel(nullptr),m_pTimer(nullptr),m_Recording(false),m_Account(nullptr), -m_PeerName(),m_pPeerPhoneNumber(nullptr),m_HistoryConst(HistoryTimeCategoryModel::HistoryConst::Never), +m_PeerName(),m_pPeerContactMethod(nullptr),m_HistoryConst(HistoryTimeCategoryModel::HistoryConst::Never), m_CallId(),m_pStartTimeStamp(0),m_pDialNumber(nullptr),m_pTransferNumber(nullptr), m_History(false),m_Missed(false),m_Direction(Call::Direction::OUTGOING),m_Type(Call::Type::CALL), m_pUserActionModel(new UserActionModel(parent)) @@ -226,7 +226,7 @@ m_pUserActionModel(new UserActionModel(parent)) } ///Constructor -Call::Call(Call::State startState, const QString& callId, const QString& peerName, PhoneNumber* number, Account* account) +Call::Call(Call::State startState, const QString& callId, const QString& peerName, ContactMethod* number, Account* account) : ItemBase<QObject>(CallModel::instance()),d_ptr(new CallPrivate(this)) { Q_ASSERT(!callId.isEmpty()); @@ -235,7 +235,7 @@ Call::Call(Call::State startState, const QString& callId, const QString& peerNam d_ptr->m_Type = Call::Type::CALL; d_ptr->m_Account = account; d_ptr->m_PeerName = peerName; - d_ptr->m_pPeerPhoneNumber = number; + d_ptr->m_pPeerContactMethod = number; d_ptr->m_CallId = callId; setObjectName("Call:"+callId); @@ -301,7 +301,7 @@ Call* CallPrivate::buildExistingCall(const QString& callId) const QString account = details[ CallPrivate::DetailsMapFields::ACCOUNT_ID ]; Call::State startState = startStateFromDaemonCallState(details[CallPrivate::DetailsMapFields::STATE], details[CallPrivate::DetailsMapFields::TYPE]); Account* acc = AccountModel::instance()->getById(account.toAscii()); - PhoneNumber* nb = PhoneDirectoryModel::instance()->getNumber(peerNumber,acc); + ContactMethod* nb = PhoneDirectoryModel::instance()->getNumber(peerNumber,acc); Call* call = new Call(startState, callId, peerName, nb, acc); call->d_ptr->m_Recording = callManager.getIsRecording(callId); call->d_ptr->m_HistoryState = historyStateFromType(details[Call::HistoryMapFields::STATE]); @@ -316,8 +316,8 @@ Call* CallPrivate::buildExistingCall(const QString& callId) call->d_ptr->initTimer(); - if (call->peerPhoneNumber()) { - call->peerPhoneNumber()->addCall(call); + if (call->peerContactMethod()) { + call->peerContactMethod()->addCall(call); } return call; @@ -346,12 +346,12 @@ Call* CallPrivate::buildIncomingCall(const QString& callId) const QString account = details[ CallPrivate::DetailsMapFields::ACCOUNT_ID ]; const QString peerName = details[ CallPrivate::DetailsMapFields::PEER_NAME ]; Account* acc = AccountModel::instance()->getById(account.toAscii()); - PhoneNumber* nb = PhoneDirectoryModel::instance()->getNumber(from,acc); + ContactMethod* nb = PhoneDirectoryModel::instance()->getNumber(from,acc); Call* call = new Call(Call::State::INCOMING, callId, peerName, nb, acc); call->d_ptr->m_HistoryState = Call::LegacyHistoryState::MISSED; call->d_ptr->m_Direction = Call::Direction::INCOMING; - if (call->peerPhoneNumber()) { - call->peerPhoneNumber()->addCall(call); + if (call->peerContactMethod()) { + call->peerContactMethod()->addCall(call); } return call; } //buildIncomingCall @@ -366,13 +366,13 @@ Call* CallPrivate::buildRingingCall(const QString & callId) const QString account = details[ CallPrivate::DetailsMapFields::ACCOUNT_ID ]; const QString peerName = details[ CallPrivate::DetailsMapFields::PEER_NAME ]; Account* acc = AccountModel::instance()->getById(account.toAscii()); - PhoneNumber* nb = PhoneDirectoryModel::instance()->getNumber(from,acc); + ContactMethod* nb = PhoneDirectoryModel::instance()->getNumber(from,acc); Call* call = new Call(Call::State::RINGING, callId, peerName, nb, acc); call->d_ptr->m_HistoryState = Call::LegacyHistoryState::OUTGOING; call->d_ptr->m_Direction = Call::Direction::OUTGOING; - if (call->peerPhoneNumber()) { - call->peerPhoneNumber()->addCall(call); + if (call->peerContactMethod()) { + call->peerContactMethod()->addCall(call); } return call; } //buildRingingCall @@ -412,7 +412,7 @@ Call* Call::buildHistoryCall(const QMap<QString,QString>& hc) ct = PersonModel::instance()->getPlaceHolder(contactUid.toAscii()); Account* acc = AccountModel::instance()->getById(accId); - PhoneNumber* nb = PhoneDirectoryModel::instance()->getNumber(number,ct,acc); + ContactMethod* nb = PhoneDirectoryModel::instance()->getNumber(number,ct,acc); Call* call = new Call(Call::State::OVER, callId, (name == "empty")?QString():name, nb, acc ); @@ -449,14 +449,14 @@ Call* Call::buildHistoryCall(const QMap<QString,QString>& hc) call->setObjectName("History:"+call->d_ptr->m_CallId); - if (call->peerPhoneNumber()) { - call->peerPhoneNumber()->addCall(call); + if (call->peerContactMethod()) { + call->peerContactMethod()->addCall(call); //Reload the glow and number colors - connect(call->peerPhoneNumber(),SIGNAL(presentChanged(bool)),call->d_ptr,SLOT(updated())); + connect(call->peerContactMethod(),SIGNAL(presentChanged(bool)),call->d_ptr,SLOT(updated())); //Change the display name and picture - connect(call->peerPhoneNumber(),SIGNAL(rebased(PhoneNumber*)),call->d_ptr,SLOT(updated())); + connect(call->peerContactMethod(),SIGNAL(rebased(ContactMethod*)),call->d_ptr,SLOT(updated())); } return call; @@ -621,7 +621,7 @@ const QString Call::dialNumber() const { if (d_ptr->m_CurrentState != Call::State::DIALING) return QString(); if (!d_ptr->m_pDialNumber) { - d_ptr->m_pDialNumber = new TemporaryPhoneNumber(); + d_ptr->m_pDialNumber = new TemporaryContactMethod(); } return d_ptr->m_pDialNumber->uri(); } @@ -632,17 +632,17 @@ const QString Call::id() const return d_ptr->m_CallId; } -PhoneNumber* Call::peerPhoneNumber() const +ContactMethod* Call::peerContactMethod() const { if (d_ptr->m_CurrentState == Call::State::DIALING) { if (!d_ptr->m_pTransferNumber) { - d_ptr->m_pTransferNumber = new TemporaryPhoneNumber(d_ptr->m_pPeerPhoneNumber); + d_ptr->m_pTransferNumber = new TemporaryContactMethod(d_ptr->m_pPeerContactMethod); } if (!d_ptr->m_pDialNumber) - d_ptr->m_pDialNumber = new TemporaryPhoneNumber(d_ptr->m_pPeerPhoneNumber); + d_ptr->m_pDialNumber = new TemporaryContactMethod(d_ptr->m_pPeerContactMethod); return d_ptr->m_pDialNumber; } - return d_ptr->m_pPeerPhoneNumber?d_ptr->m_pPeerPhoneNumber:const_cast<PhoneNumber*>(PhoneNumber::BLANK()); + return d_ptr->m_pPeerContactMethod?d_ptr->m_pPeerContactMethod:const_cast<ContactMethod*>(ContactMethod::BLANK()); } ///Get the peer name @@ -656,14 +656,14 @@ const QString Call::formattedName() const { if (type() == Call::Type::CONFERENCE) return tr("Conference"); - else if (!peerPhoneNumber()) + else if (!peerContactMethod()) return "Error"; - else if (peerPhoneNumber()->contact() && !peerPhoneNumber()->contact()->formattedName().isEmpty()) - return peerPhoneNumber()->contact()->formattedName(); + else if (peerContactMethod()->contact() && !peerContactMethod()->contact()->formattedName().isEmpty()) + return peerContactMethod()->contact()->formattedName(); else if (!peerName().isEmpty()) return d_ptr->m_PeerName; - else if (peerPhoneNumber()) - return peerPhoneNumber()->uri(); + else if (peerContactMethod()) + return peerContactMethod()->uri(); else return tr("Unknown"); } @@ -798,7 +798,7 @@ Video::Renderer* Call::videoRenderer() const void Call::setTransferNumber(const QString& number) { if (!d_ptr->m_pTransferNumber) { - d_ptr->m_pTransferNumber = new TemporaryPhoneNumber(); + d_ptr->m_pTransferNumber = new TemporaryContactMethod(); } d_ptr->m_pTransferNumber->setUri(number); } @@ -813,7 +813,7 @@ void Call::setDialNumber(const QString& number) } if (!d_ptr->m_pDialNumber) { - d_ptr->m_pDialNumber = new TemporaryPhoneNumber(); + d_ptr->m_pDialNumber = new TemporaryContactMethod(); } d_ptr->m_pDialNumber->setUri(number); @@ -823,10 +823,10 @@ void Call::setDialNumber(const QString& number) } ///Set the dial number from a full phone number -void Call::setDialNumber(const PhoneNumber* number) +void Call::setDialNumber(const ContactMethod* number) { if (d_ptr->m_CurrentState == Call::State::DIALING && !d_ptr->m_pDialNumber) { - d_ptr->m_pDialNumber = new TemporaryPhoneNumber(number); + d_ptr->m_pDialNumber = new TemporaryContactMethod(number); } if (d_ptr->m_pDialNumber && number) d_ptr->m_pDialNumber->setUri(number->uri()); @@ -937,8 +937,8 @@ Call::State CallPrivate::stateChanged(const QString& newStateName) emit q_ptr->stateChanged(); } if (m_CurrentState != Call::State::DIALING && m_pDialNumber) { - if (!m_pPeerPhoneNumber) - m_pPeerPhoneNumber = PhoneDirectoryModel::instance()->fromTemporary(m_pDialNumber); + if (!m_pPeerContactMethod) + m_pPeerContactMethod = PhoneDirectoryModel::instance()->fromTemporary(m_pDialNumber); m_pDialNumber->deleteLater(); m_pDialNumber = nullptr; } @@ -1245,25 +1245,25 @@ void CallPrivate::call() } //Normal case else if(m_Account) { - qDebug() << "Calling " << q_ptr->peerPhoneNumber()->uri() << " with account " << m_Account << ". callId : " << m_CallId << "ConfId:" << q_ptr->id(); + qDebug() << "Calling " << q_ptr->peerContactMethod()->uri() << " with account " << m_Account << ". callId : " << m_CallId << "ConfId:" << q_ptr->id(); - this->m_pPeerPhoneNumber = PhoneDirectoryModel::instance()->getNumber(m_pDialNumber->uri(),q_ptr->account()); + this->m_pPeerContactMethod = PhoneDirectoryModel::instance()->getNumber(m_pDialNumber->uri(),q_ptr->account()); //Warning: m_pDialNumber can become nullptr when linking directly callManager.placeCall(m_Account->id(), m_CallId, m_pDialNumber->uri()); if (PersonModel::instance()->hasBackends()) { - if (q_ptr->peerPhoneNumber()->contact()) - m_PeerName = q_ptr->peerPhoneNumber()->contact()->formattedName(); + if (q_ptr->peerContactMethod()->contact()) + m_PeerName = q_ptr->peerContactMethod()->contact()->formattedName(); } - connect(q_ptr->peerPhoneNumber(),SIGNAL(presentChanged(bool)),this,SLOT(updated())); + connect(q_ptr->peerContactMethod(),SIGNAL(presentChanged(bool)),this,SLOT(updated())); time_t curTime; ::time(&curTime); setStartTimeStamp(curTime); this->m_HistoryState = Call::LegacyHistoryState::OUTGOING; m_Direction = Call::Direction::OUTGOING; - if (q_ptr->peerPhoneNumber()) { - q_ptr->peerPhoneNumber()->addCall(q_ptr); + if (q_ptr->peerContactMethod()) { + q_ptr->peerContactMethod()->addCall(q_ptr); } if (m_pDialNumber) emit q_ptr->dialNumberChanged(QString()); @@ -1324,8 +1324,8 @@ void CallPrivate::start() emit q_ptr->changed(); emit q_ptr->changed(q_ptr); if (m_pDialNumber) { - if (!m_pPeerPhoneNumber) - m_pPeerPhoneNumber = PhoneDirectoryModel::instance()->fromTemporary(m_pDialNumber); + if (!m_pPeerContactMethod) + m_pPeerContactMethod = PhoneDirectoryModel::instance()->fromTemporary(m_pDialNumber); m_pDialNumber->deleteLater(); m_pDialNumber = nullptr; } @@ -1404,7 +1404,7 @@ void CallPrivate::warning() ///Input text on the call item void Call::appendText(const QString& str) { - TemporaryPhoneNumber* editNumber = nullptr; + TemporaryContactMethod* editNumber = nullptr; switch (d_ptr->m_CurrentState) { case Call::State::TRANSFERRED : @@ -1437,7 +1437,7 @@ void Call::appendText(const QString& str) emit dialNumberChanged(editNumber->uri()); } else - qDebug() << "TemporaryPhoneNumber not defined"; + qDebug() << "TemporaryContactMethod not defined"; emit changed(); @@ -1447,7 +1447,7 @@ void Call::appendText(const QString& str) ///Remove the last character void Call::backspaceItemText() { - TemporaryPhoneNumber* editNumber = nullptr; + TemporaryContactMethod* editNumber = nullptr; switch (d_ptr->m_CurrentState) { case Call::State::TRANSFERRED : @@ -1486,13 +1486,13 @@ void Call::backspaceItemText() } } else - qDebug() << "TemporaryPhoneNumber not defined"; + qDebug() << "TemporaryContactMethod not defined"; } ///Reset the string a dialing or transfer call void Call::reset() { - TemporaryPhoneNumber* editNumber = nullptr; + TemporaryContactMethod* editNumber = nullptr; switch (d_ptr->m_CurrentState) { case Call::State::TRANSFERRED : @@ -1602,7 +1602,7 @@ void CallPrivate::initTimer() ///Common source for model data roles QVariant Call::roleData(int role) const { - const Person* ct = peerPhoneNumber()?peerPhoneNumber()->contact():nullptr; + const Person* ct = peerContactMethod()?peerContactMethod()->contact():nullptr; switch (role) { case Call::Role::Name: case Qt::DisplayRole: @@ -1611,7 +1611,7 @@ QVariant Call::roleData(int role) const else if (state() == Call::State::DIALING) return dialNumber(); else if (d_ptr->m_PeerName.isEmpty()) - return ct?ct->formattedName():peerPhoneNumber()?peerPhoneNumber()->uri():dialNumber(); + return ct?ct->formattedName():peerContactMethod()?peerContactMethod()->uri():dialNumber(); else return formattedName(); break; @@ -1621,7 +1621,7 @@ QVariant Call::roleData(int role) const case Qt::EditRole: return dialNumber(); case Call::Role::Number: - return peerPhoneNumber()->uri(); + return peerContactMethod()->uri(); break; case Call::Role::Direction2: return static_cast<int>(d_ptr->m_Direction); //TODO Qt5, use the Q_ENUM @@ -1673,7 +1673,7 @@ QVariant Call::roleData(int role) const return QVariant::fromValue(const_cast<Call*>(this)); break; case Call::Role::PhoneNu: - return QVariant::fromValue(peerPhoneNumber()); + return QVariant::fromValue(peerContactMethod()); break; case Call::Role::PhotoPtr: return ct?ct->photo():QVariant(); @@ -1691,17 +1691,17 @@ QVariant Call::roleData(int role) const case Call::Role::IsRecording: return isRecording(); case Call::Role::IsPresent: - return peerPhoneNumber()->isPresent(); + return peerContactMethod()->isPresent(); case Call::Role::IsTracked: - return peerPhoneNumber()->isTracked(); + return peerContactMethod()->isTracked(); case Call::Role::SupportPresence: - return peerPhoneNumber()->supportPresence(); + return peerContactMethod()->supportPresence(); case Call::Role::CategoryIcon: - return peerPhoneNumber()->category()->icon(peerPhoneNumber()->isTracked(),peerPhoneNumber()->isPresent()); + return peerContactMethod()->category()->icon(peerContactMethod()->isTracked(),peerContactMethod()->isPresent()); case Call::Role::CallCount: - return peerPhoneNumber()->callCount(); + return peerContactMethod()->callCount(); case Call::Role::TotalSpentTime: - return peerPhoneNumber()->totalSpentTime(); + return peerContactMethod()->totalSpentTime(); case Call::Role::DropState: return property("dropState"); break; diff --git a/src/call.h b/src/call.h index 83fa377d3551326a587c3a7eb9444c733a68cb21..4f54122c225d8e53e95d4259e4a1b51cb61794be 100644 --- a/src/call.h +++ b/src/call.h @@ -34,8 +34,8 @@ class QTimer; class Account; class InstantMessagingModel; class UserActionModel; -class PhoneNumber; -class TemporaryPhoneNumber; +class ContactMethod; +class TemporaryContactMethod; class CollectionInterface; namespace Video { class Renderer; @@ -250,7 +250,7 @@ public: Q_PROPERTY( Call::LegacyHistoryState historyState READ historyState ) //Read/write properties - Q_PROPERTY( PhoneNumber* peerPhoneNumber READ peerPhoneNumber ) + Q_PROPERTY( ContactMethod* peerContactMethod READ peerContactMethod ) Q_PROPERTY( QString peerName READ peerName WRITE setPeerName ) Q_PROPERTY( QString transferNumber READ transferNumber WRITE setTransferNumber ) Q_PROPERTY( QString recordingPath READ recordingPath WRITE setRecordingPath ) @@ -265,7 +265,7 @@ public: //Getters Call::State state () const; const QString id () const; - PhoneNumber* peerPhoneNumber () const; + ContactMethod* peerContactMethod () const; const QString peerName () const; Call::LegacyHistoryState historyState () const; bool isRecording () const; @@ -297,7 +297,7 @@ public: //Setters void setTransferNumber ( const QString& number ); void setDialNumber ( const QString& number ); - void setDialNumber ( const PhoneNumber* number ); + void setDialNumber ( const ContactMethod* number ); void setRecordingPath ( const QString& path ); void setPeerName ( const QString& name ); void setAccount ( Account* account ); @@ -314,7 +314,7 @@ public: private: explicit Call(const QString& confId, const QString& account); ~Call(); - Call(Call::State startState, const QString& callId, const QString& peerName = QString(), PhoneNumber* number = nullptr, Account* account = nullptr); //TODO MOVE TO PRIVATE + Call(Call::State startState, const QString& callId, const QString& peerName = QString(), ContactMethod* number = nullptr, Account* account = nullptr); //TODO MOVE TO PRIVATE CallPrivate* d_ptr; Q_DECLARE_PRIVATE(Call) diff --git a/src/callmodel.cpp b/src/callmodel.cpp index 39ca38da9b03423e7b4a4c868a59f7f0aea0796d..608fdcd8fca1923fe27085f940d27b36dbfad68c 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -27,7 +27,7 @@ #include "call.h" #include "uri.h" #include "phonedirectorymodel.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "accountmodel.h" #include "dbus/metatypes.h" #include "dbus/callmanager.h" @@ -529,7 +529,7 @@ void CallModel::attendedTransfer(Call* toTransfer, Call* target) } //attendedTransfer ///Transfer this call to "target" number -void CallModel::transfer(Call* toTransfer, const PhoneNumber* target) +void CallModel::transfer(Call* toTransfer, const ContactMethod* target) { qDebug() << "Transferring call " << toTransfer->id() << "to" << target->uri(); toTransfer->setTransferNumber ( target->uri() ); @@ -830,7 +830,7 @@ QMimeData* CallModel::mimeData(const QModelIndexList& indexes) const mData->setData(RingMimes::PLAIN_TEXT , text.toUtf8()); Call* call = getCall(idx); if (call) - mData->setData(RingMimes::PHONENUMBER, call->peerPhoneNumber()->toHash().toUtf8()); + mData->setData(RingMimes::PHONENUMBER, call->peerContactMethod()->toHash().toUtf8()); qDebug() << "Setting mime" << idx.data(Call::Role::Id).toString(); mData->setData(RingMimes::CALLID , idx.data(Call::Role::Id).toString().toUtf8()); return mData; @@ -920,11 +920,11 @@ bool CallModel::dropMimeData(const QMimeData* mimedata, Qt::DropAction action, i } } else if (mimedata->hasFormat(RingMimes::PHONENUMBER)) { - const QByteArray encodedPhoneNumber = mimedata->data( RingMimes::PHONENUMBER ); + const QByteArray encodedContactMethod = mimedata->data( RingMimes::PHONENUMBER ); Call* target = getCall(targetIdx); - qDebug() << "Phone number" << encodedPhoneNumber << "on call" << target; + qDebug() << "Phone number" << encodedContactMethod << "on call" << target; Call* newCall = dialingCall(QString(),target->account()); - PhoneNumber* nb = PhoneDirectoryModel::instance()->fromHash(encodedPhoneNumber); + ContactMethod* nb = PhoneDirectoryModel::instance()->fromHash(encodedContactMethod); newCall->setDialNumber(nb); newCall->performAction(Call::Action::ACCEPT); createConferenceFromCall(newCall,target); @@ -933,8 +933,8 @@ bool CallModel::dropMimeData(const QMimeData* mimedata, Qt::DropAction action, i const QByteArray encodedPerson = mimedata->data(RingMimes::CONTACT); Call* target = getCall(targetIdx); qDebug() << "Contact" << encodedPerson << "on call" << target; - if (PhoneNumberSelector::defaultDelegate()) { - const PhoneNumber* number = PhoneNumberSelector::defaultDelegate()->getNumber( + if (ContactMethodSelector::defaultDelegate()) { + const ContactMethod* number = ContactMethodSelector::defaultDelegate()->getNumber( PersonModel::instance()->getPersonByUid(encodedPerson)); if (!number->uri().isEmpty()) { Call* newCall = dialingCall(); diff --git a/src/callmodel.h b/src/callmodel.h index 3f8e11b265710b90b380658f04d812b89f82cc0f..6854e66671f3d7b07eedafc090b436a1c8704048 100644 --- a/src/callmodel.h +++ b/src/callmodel.h @@ -27,7 +27,7 @@ #include "call.h" class Account; struct InternalStruct; -class PhoneNumber; +class ContactMethod; class CallModelPrivate; //Typedef @@ -64,7 +64,7 @@ class LIB_EXPORT CallModel : public QAbstractItemModel //Call related Q_INVOKABLE Call* dialingCall ( const QString& peerName=QString(), Account* account=nullptr ); Q_INVOKABLE void attendedTransfer ( Call* toTransfer , Call* target ); - Q_INVOKABLE void transfer ( Call* toTransfer , const PhoneNumber* target ); + Q_INVOKABLE void transfer ( Call* toTransfer , const ContactMethod* target ); QModelIndex getIndex ( Call* call ); //Conference related diff --git a/src/collectioneditor.h b/src/collectioneditor.h index 2cf32b9eeaca2780b012b6a33c43bac53f8a2f77..247bf38caa2598cfbfd1a43b0547d0b8911fa08c 100644 --- a/src/collectioneditor.h +++ b/src/collectioneditor.h @@ -22,7 +22,7 @@ #include <typedefs.h> //Ring -class PhoneNumber; +class ContactMethod; class LIB_EXPORT CollectionEditorBase { public: @@ -67,7 +67,7 @@ public: virtual bool addNew ( T* item ) = 0; ///Add a new phone number to an existing item - virtual bool addPhoneNumber( T* item , PhoneNumber* number ); + virtual bool addContactMethod( T* item , ContactMethod* number ); private: /** diff --git a/src/collectioneditor.hpp b/src/collectioneditor.hpp index 9c379bf146fe4b1c447cd1b815ab8caff1168f13..f440d2690f9bd58815c0704f759800889a64a49a 100644 --- a/src/collectioneditor.hpp +++ b/src/collectioneditor.hpp @@ -54,7 +54,7 @@ template <class T> bool CollectionEditor<T>::batchSave(const QList<T*> contacts) } template <class T> -bool CollectionEditor<T>::addPhoneNumber( T* item , PhoneNumber* number ) +bool CollectionEditor<T>::addContactMethod( T* item , ContactMethod* number ) { Q_UNUSED(item) Q_UNUSED(number) diff --git a/src/collectioninterface.cpp b/src/collectioninterface.cpp index f6a8ba2e02387fa14b4d070e821167f8b01c48cf..d6b536da5ee80bdbfbb8c220b7bcc0d401001fb6 100644 --- a/src/collectioninterface.cpp +++ b/src/collectioninterface.cpp @@ -23,7 +23,7 @@ //Ring library #include "person.h" #include "call.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "collectioneditor.h" #include "itembase.h" diff --git a/src/phonenumber.cpp b/src/contactmethod.cpp similarity index 72% rename from src/phonenumber.cpp rename to src/contactmethod.cpp index d3d60ed82818798867d02f1aebf96a865fad2935..03912fc49ea335884e232ded052bc7d5b9d794f3 100644 --- a/src/phonenumber.cpp +++ b/src/contactmethod.cpp @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ -#include "phonenumber.h" +#include "contactmethod.h" #include "phonedirectorymodel.h" #include "person.h" #include "account.h" @@ -27,18 +27,18 @@ //Private #include "private/phonedirectorymodel_p.h" -QHash<int,Call*> PhoneNumber::m_shMostUsed = QHash<int,Call*>(); +QHash<int,Call*> ContactMethod::m_shMostUsed = QHash<int,Call*>(); -const PhoneNumber* PhoneNumber::m_spBlank = nullptr; +const ContactMethod* ContactMethod::m_spBlank = nullptr; -class PhoneNumberPrivate { +class ContactMethodPrivate { public: - PhoneNumberPrivate(const URI& number, NumberCategory* cat, PhoneNumber::Type st); + ContactMethodPrivate(const URI& number, NumberCategory* cat, ContactMethod::Type st); NumberCategory* m_pCategory ; bool m_Present ; QString m_PresentMessage ; bool m_Tracked ; - Person* m_pPerson ; + Person* m_pPerson ; Account* m_pAccount ; time_t m_LastUsed ; QList<Call*> m_lCalls ; @@ -55,11 +55,11 @@ public: QString m_Uid ; QString m_PrimaryName_cache; URI m_Uri ; - PhoneNumber::Type m_Type ; + ContactMethod::Type m_Type ; QList<URI> m_lOtherURIs ; //Parents - QList<PhoneNumber*> m_lParents; + QList<ContactMethod*> m_lParents; //Emit proxies void callAdded(Call* call); @@ -68,62 +68,62 @@ public: void presenceMessageChanged(const QString&); void trackedChanged(bool); void primaryNameChanged(const QString& name); - void rebased(PhoneNumber* other); + void rebased(ContactMethod* other); }; -void PhoneNumberPrivate::callAdded(Call* call) +void ContactMethodPrivate::callAdded(Call* call) { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->callAdded(call); } -void PhoneNumberPrivate::changed() +void ContactMethodPrivate::changed() { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->changed(); } -void PhoneNumberPrivate::presentChanged(bool s) +void ContactMethodPrivate::presentChanged(bool s) { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->presentChanged(s); } -void PhoneNumberPrivate::presenceMessageChanged(const QString& status) +void ContactMethodPrivate::presenceMessageChanged(const QString& status) { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->presenceMessageChanged(status); } -void PhoneNumberPrivate::trackedChanged(bool t) +void ContactMethodPrivate::trackedChanged(bool t) { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->trackedChanged(t); } -void PhoneNumberPrivate::primaryNameChanged(const QString& name) +void ContactMethodPrivate::primaryNameChanged(const QString& name) { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->primaryNameChanged(name); } -void PhoneNumberPrivate::rebased(PhoneNumber* other) +void ContactMethodPrivate::rebased(ContactMethod* other) { - foreach (PhoneNumber* n, m_lParents) + foreach (ContactMethod* n, m_lParents) emit n->rebased(other); } -const PhoneNumber* PhoneNumber::BLANK() +const ContactMethod* ContactMethod::BLANK() { if (!m_spBlank) { - m_spBlank = new PhoneNumber(QString(),NumberCategoryModel::other()); - const_cast<PhoneNumber*>(m_spBlank)->d_ptr->m_Type = PhoneNumber::Type::BLANK; + m_spBlank = new ContactMethod(QString(),NumberCategoryModel::other()); + const_cast<ContactMethod*>(m_spBlank)->d_ptr->m_Type = ContactMethod::Type::BLANK; } return m_spBlank; } -PhoneNumberPrivate::PhoneNumberPrivate(const URI& uri, NumberCategory* cat, PhoneNumber::Type st) : +ContactMethodPrivate::ContactMethodPrivate(const URI& uri, NumberCategory* cat, ContactMethod::Type st) : m_Uri(uri),m_pCategory(cat),m_Tracked(false),m_Present(false),m_LastUsed(0), m_Type(st),m_PopularityIndex(-1),m_pPerson(nullptr),m_pAccount(nullptr), m_LastWeekCount(0),m_LastTrimCount(0),m_HaveCalled(false),m_IsBookmark(false),m_TotalSeconds(0), @@ -131,8 +131,8 @@ PhoneNumberPrivate::PhoneNumberPrivate(const URI& uri, NumberCategory* cat, Phon {} ///Constructor -PhoneNumber::PhoneNumber(const URI& number, NumberCategory* cat, Type st) : ItemBase<QObject>(PhoneDirectoryModel::instance()), -d_ptr(new PhoneNumberPrivate(number,cat,st)) +ContactMethod::ContactMethod(const URI& number, NumberCategory* cat, Type st) : ItemBase<QObject>(PhoneDirectoryModel::instance()), +d_ptr(new ContactMethodPrivate(number,cat,st)) { setObjectName(d_ptr->m_Uri); d_ptr->m_hasType = cat != NumberCategoryModel::other(); @@ -142,7 +142,7 @@ d_ptr(new PhoneNumberPrivate(number,cat,st)) d_ptr->m_lParents << this; } -PhoneNumber::~PhoneNumber() +ContactMethod::~ContactMethod() { d_ptr->m_lParents.removeAll(this); // if (!d_ptr->m_lParents.size()) @@ -150,66 +150,66 @@ PhoneNumber::~PhoneNumber() } ///Return if this number presence is being tracked -bool PhoneNumber::isTracked() const +bool ContactMethod::isTracked() const { //If the number doesn't support it, ignore the flag return supportPresence() && d_ptr->m_Tracked; } ///Is this number present -bool PhoneNumber::isPresent() const +bool ContactMethod::isPresent() const { return d_ptr->m_Tracked && d_ptr->m_Present; } ///This number presence status string -QString PhoneNumber::presenceMessage() const +QString ContactMethod::presenceMessage() const { return d_ptr->m_PresentMessage; } ///Return the number -URI PhoneNumber::uri() const { +URI ContactMethod::uri() const { return d_ptr->m_Uri ; } ///This phone number has a type -bool PhoneNumber::hasType() const +bool ContactMethod::hasType() const { return d_ptr->m_hasType; } ///Protected getter to get the number index -int PhoneNumber::index() const +int ContactMethod::index() const { return d_ptr->m_Index; } ///Return the phone number type -NumberCategory* PhoneNumber::category() const { +NumberCategory* ContactMethod::category() const { return d_ptr->m_pCategory ; } ///Return this number associated account, if any -Account* PhoneNumber::account() const +Account* ContactMethod::account() const { return d_ptr->m_pAccount; } ///Return this number associated contact, if any -Person* PhoneNumber::contact() const +Person* ContactMethod::contact() const { return d_ptr->m_pPerson; } ///Return when this number was last used -time_t PhoneNumber::lastUsed() const +time_t ContactMethod::lastUsed() const { return d_ptr->m_LastUsed; } ///Set this number default account -void PhoneNumber::setAccount(Account* account) +void ContactMethod::setAccount(Account* account) { d_ptr->m_pAccount = account; if (d_ptr->m_pAccount) @@ -218,10 +218,10 @@ void PhoneNumber::setAccount(Account* account) } ///Set this number contact -void PhoneNumber::setPerson(Person* contact) +void ContactMethod::setPerson(Person* contact) { d_ptr->m_pPerson = contact; - if (contact && d_ptr->m_Type != PhoneNumber::Type::TEMPORARY) { + if (contact && d_ptr->m_Type != ContactMethod::Type::TEMPORARY) { PhoneDirectoryModel::instance()->d_ptr->indexNumber(this,d_ptr->m_hNames.keys()+QStringList(contact->formattedName())); d_ptr->m_PrimaryName_cache = contact->formattedName(); d_ptr->primaryNameChanged(d_ptr->m_PrimaryName_cache); @@ -231,24 +231,24 @@ void PhoneNumber::setPerson(Person* contact) } ///Protected setter to set if there is a type -void PhoneNumber::setHasType(bool value) +void ContactMethod::setHasType(bool value) { d_ptr->m_hasType = value; } ///Protected setter to set the PhoneDirectoryModel index -void PhoneNumber::setIndex(int value) +void ContactMethod::setIndex(int value) { d_ptr->m_Index = value; } ///Protected setter to change the popularity index -void PhoneNumber::setPopularityIndex(int value) +void ContactMethod::setPopularityIndex(int value) { d_ptr->m_PopularityIndex = value; } -void PhoneNumber::setCategory(NumberCategory* cat) +void ContactMethod::setCategory(NumberCategory* cat) { if (cat == d_ptr->m_pCategory) return; if (d_ptr->m_hasType) @@ -260,23 +260,23 @@ void PhoneNumber::setCategory(NumberCategory* cat) d_ptr->changed(); } -void PhoneNumber::setBookmarked(bool bookmarked ) +void ContactMethod::setBookmarked(bool bookmarked ) { d_ptr->m_IsBookmark = bookmarked; } ///Force an Uid on this number (instead of hash) -void PhoneNumber::setUid(const QString& uri) +void ContactMethod::setUid(const QString& uri) { d_ptr->m_Uid = uri; } ///Attempt to change the number type -bool PhoneNumber::setType(PhoneNumber::Type t) +bool ContactMethod::setType(ContactMethod::Type t) { - if (d_ptr->m_Type == PhoneNumber::Type::BLANK) + if (d_ptr->m_Type == ContactMethod::Type::BLANK) return false; - if (account() && t == PhoneNumber::Type::ACCOUNT) { + if (account() && t == ContactMethod::Type::ACCOUNT) { if (account()->supportPresenceSubscribe()) { d_ptr->m_Tracked = true; //The daemon will init the tracker itself d_ptr->trackedChanged(true); @@ -288,7 +288,7 @@ bool PhoneNumber::setType(PhoneNumber::Type t) } ///Set if this number is tracking presence information -void PhoneNumber::setTracked(bool track) +void ContactMethod::setTracked(bool track) { if (track != d_ptr->m_Tracked) { //Subscribe only once //You can't subscribe without account @@ -301,7 +301,7 @@ void PhoneNumber::setTracked(bool track) } ///Allow phonedirectorymodel to change presence status -void PhoneNumber::setPresent(bool present) +void ContactMethod::setPresent(bool present) { if (d_ptr->m_Present != present) { d_ptr->m_Present = present; @@ -309,7 +309,7 @@ void PhoneNumber::setPresent(bool present) } } -void PhoneNumber::setPresenceMessage(const QString& message) +void ContactMethod::setPresenceMessage(const QString& message) { if (d_ptr->m_PresentMessage != message) { d_ptr->m_PresentMessage = message; @@ -318,34 +318,34 @@ void PhoneNumber::setPresenceMessage(const QString& message) } ///Return the current type of the number -PhoneNumber::Type PhoneNumber::type() const +ContactMethod::Type ContactMethod::type() const { return d_ptr->m_Type; } ///Return the number of calls from this number -int PhoneNumber::callCount() const +int ContactMethod::callCount() const { return d_ptr->m_lCalls.size(); } -uint PhoneNumber::weekCount() const +uint ContactMethod::weekCount() const { return d_ptr->m_LastWeekCount; } -uint PhoneNumber::trimCount() const +uint ContactMethod::trimCount() const { return d_ptr->m_LastTrimCount; } -bool PhoneNumber::haveCalled() const +bool ContactMethod::haveCalled() const { return d_ptr->m_HaveCalled; } ///Best bet for this person real name -QString PhoneNumber::primaryName() const +QString ContactMethod::primaryName() const { //Compute the primary name if (d_ptr->m_PrimaryName_cache.isEmpty()) { @@ -363,8 +363,8 @@ QString PhoneNumber::primaryName() const } ret = toReturn; } - const_cast<PhoneNumber*>(this)->d_ptr->m_PrimaryName_cache = ret; - const_cast<PhoneNumber*>(this)->d_ptr->primaryNameChanged(d_ptr->m_PrimaryName_cache); + const_cast<ContactMethod*>(this)->d_ptr->m_PrimaryName_cache = ret; + const_cast<ContactMethod*>(this)->d_ptr->primaryNameChanged(d_ptr->m_PrimaryName_cache); } //Fallback: Use the URI if (d_ptr->m_PrimaryName_cache.isEmpty()) { @@ -376,13 +376,13 @@ QString PhoneNumber::primaryName() const } ///Is this number bookmarked -bool PhoneNumber::isBookmarked() const +bool ContactMethod::isBookmarked() const { return d_ptr->m_IsBookmark; } ///If this number could (theoretically) support presence status -bool PhoneNumber::supportPresence() const +bool ContactMethod::supportPresence() const { //Without an account, presence is impossible if (!d_ptr->m_pAccount) @@ -396,45 +396,45 @@ bool PhoneNumber::supportPresence() const } ///Proxy accessor to the category icon -QVariant PhoneNumber::icon() const +QVariant ContactMethod::icon() const { return category()->icon(isTracked(),isPresent()); } ///The number of seconds spent with the URI (from history) -int PhoneNumber::totalSpentTime() const +int ContactMethod::totalSpentTime() const { return d_ptr->m_TotalSeconds; } ///Return this number unique identifier (hash) -QString PhoneNumber::uid() const +QString ContactMethod::uid() const { return d_ptr->m_Uid.isEmpty()?toHash():d_ptr->m_Uid; } ///Return all calls from this number -QList<Call*> PhoneNumber::calls() const +QList<Call*> ContactMethod::calls() const { return d_ptr->m_lCalls; } ///Return the phonenumber position in the popularity index -int PhoneNumber::popularityIndex() const +int ContactMethod::popularityIndex() const { return d_ptr->m_PopularityIndex; } -QHash<QString,int> PhoneNumber::alternativeNames() const +QHash<QString,int> ContactMethod::alternativeNames() const { return d_ptr->m_hNames; } ///Add a call to the call list, notify listener -void PhoneNumber::addCall(Call* call) +void ContactMethod::addCall(Call* call) { if (!call) return; - d_ptr->m_Type = PhoneNumber::Type::USED; + d_ptr->m_Type = ContactMethod::Type::USED; d_ptr->m_lCalls << call; d_ptr->m_TotalSeconds += call->stopTimeStamp() - call->startTimeStamp(); time_t now; @@ -454,7 +454,7 @@ void PhoneNumber::addCall(Call* call) } ///Generate an unique representation of this number -QString PhoneNumber::toHash() const +QString ContactMethod::toHash() const { return QString("%1///%2///%3").arg(uri()).arg(account()?account()->id():QString()).arg(contact()?contact()->uid():QString()); } @@ -462,11 +462,11 @@ QString PhoneNumber::toHash() const ///Increment name counter and update indexes -void PhoneNumber::incrementAlternativeName(const QString& name) +void ContactMethod::incrementAlternativeName(const QString& name) { const bool needReIndexing = !d_ptr->m_hNames[name]; d_ptr->m_hNames[name]++; - if (needReIndexing && d_ptr->m_Type != PhoneNumber::Type::TEMPORARY) { + if (needReIndexing && d_ptr->m_Type != ContactMethod::Type::TEMPORARY) { PhoneDirectoryModel::instance()->d_ptr->indexNumber(this,d_ptr->m_hNames.keys()+(d_ptr->m_pPerson?(QStringList(d_ptr->m_pPerson->formattedName())):QStringList())); //Invalid m_PrimaryName_cache if (!d_ptr->m_pPerson) @@ -474,33 +474,33 @@ void PhoneNumber::incrementAlternativeName(const QString& name) } } -void PhoneNumber::accountDestroyed(QObject* o) +void ContactMethod::accountDestroyed(QObject* o) { if (o == d_ptr->m_pAccount) d_ptr->m_pAccount = nullptr; } /** - * When the PhoneNumber contact is merged with another one, the phone number + * When the ContactMethod contact is merged with another one, the phone number * data might be replaced, like the preferred name. */ -void PhoneNumber::contactRebased(Person* other) +void ContactMethod::contactRebased(Person* other) { d_ptr->m_PrimaryName_cache = other->formattedName(); d_ptr->primaryNameChanged(d_ptr->m_PrimaryName_cache); d_ptr->changed(); - //It is a "partial" rebase, so the PhoneNumber data stay the same + //It is a "partial" rebase, so the ContactMethod data stay the same d_ptr->rebased(this); } /** * Merge two phone number to share the same data. This avoid having to change - * pointers all over the place. The PhoneNumber objects remain intact, the + * pointers all over the place. The ContactMethod objects remain intact, the * PhoneDirectoryModel will replace the old references, but existing ones will * keep working. */ -bool PhoneNumber::merge(PhoneNumber* other) +bool ContactMethod::merge(ContactMethod* other) { if ((!other) || other == this || other->d_ptr == d_ptr) @@ -516,7 +516,7 @@ bool PhoneNumber::merge(PhoneNumber* other) //TODO Handle presence - QSharedPointer<PhoneNumberPrivate> currentD = d_ptr; + QSharedPointer<ContactMethodPrivate> currentD = d_ptr; //Replace the D-Pointer this->d_ptr= other->d_ptr; @@ -540,22 +540,22 @@ bool PhoneNumber::merge(PhoneNumber* other) return true; } -bool PhoneNumber::operator==(PhoneNumber* other) +bool ContactMethod::operator==(ContactMethod* other) { return other && this->d_ptr== other->d_ptr; } -bool PhoneNumber::operator==(const PhoneNumber* other) const +bool ContactMethod::operator==(const ContactMethod* other) const { return other && this->d_ptr== other->d_ptr; } -bool PhoneNumber::operator==(PhoneNumber& other) +bool ContactMethod::operator==(ContactMethod& other) { return &other && this->d_ptr== other.d_ptr; } -bool PhoneNumber::operator==(const PhoneNumber& other) const +bool ContactMethod::operator==(const ContactMethod& other) const { return &other && this->d_ptr== other.d_ptr; } @@ -566,15 +566,15 @@ bool PhoneNumber::operator==(const PhoneNumber& other) const * * ***********************************************************************************/ -void TemporaryPhoneNumber::setUri(const QString& uri) +void TemporaryContactMethod::setUri(const QString& uri) { d_ptr->m_Uri = uri; d_ptr->changed(); } ///Constructor -TemporaryPhoneNumber::TemporaryPhoneNumber(const PhoneNumber* number) : - PhoneNumber(QString(),NumberCategoryModel::other(),PhoneNumber::Type::TEMPORARY) +TemporaryContactMethod::TemporaryContactMethod(const ContactMethod* number) : + ContactMethod(QString(),NumberCategoryModel::other(),ContactMethod::Type::TEMPORARY) { if (number) { setPerson(number->contact()); diff --git a/src/phonenumber.h b/src/contactmethod.h similarity index 87% rename from src/phonenumber.h rename to src/contactmethod.h index 0c42567ccc4ffee0bcec3f4d83c4f6b34f831a36..94707d9b5454afe0b3d2c9cef4605c627f668f8d 100644 --- a/src/phonenumber.h +++ b/src/contactmethod.h @@ -33,13 +33,13 @@ class Account; class Person; class Call; -class PhoneNumberPrivate; -class TemporaryPhoneNumber; +class ContactMethodPrivate; +class TemporaryContactMethod; class NumberCategory; -///PhoneNumber: represent a phone number -class LIB_EXPORT PhoneNumber : public ItemBase<QObject> +///ContactMethod: represent a phone number +class LIB_EXPORT ContactMethod : public ItemBase<QObject> { Q_OBJECT public: @@ -89,7 +89,7 @@ public: Account* account () const; Person* contact () const; time_t lastUsed () const; - PhoneNumber::Type type () const; + ContactMethod::Type type () const; int callCount () const; uint weekCount () const; uint trimCount () const; @@ -111,35 +111,35 @@ public: void setCategory(NumberCategory* cat ); void setBookmarked(bool bookmarked ); void setUid(const QString& uri ); - bool setType(PhoneNumber::Type t ); + bool setType(ContactMethod::Type t ); //Mutator Q_INVOKABLE void addCall(Call* call); Q_INVOKABLE void incrementAlternativeName(const QString& name); //Static - static const PhoneNumber* BLANK(); + static const ContactMethod* BLANK(); //Helper QString toHash() const; //Operator - bool operator==(PhoneNumber* other); - bool operator==(const PhoneNumber* other) const; - bool operator==(PhoneNumber& other); - bool operator==(const PhoneNumber& other) const; + bool operator==(ContactMethod* other); + bool operator==(const ContactMethod* other) const; + bool operator==(ContactMethod& other); + bool operator==(const ContactMethod& other) const; protected: //Constructor - PhoneNumber(const URI& uri, NumberCategory* cat, Type st = Type::UNUSED); - virtual ~PhoneNumber(); + ContactMethod(const URI& uri, NumberCategory* cat, Type st = Type::UNUSED); + virtual ~ContactMethod(); //Private setters void setPresent(bool present); void setPresenceMessage(const QString& message); //PhoneDirectoryModel mutator - bool merge(PhoneNumber* other); + bool merge(ContactMethod* other); //Getter bool hasType() const; @@ -151,21 +151,21 @@ protected: void setPopularityIndex(int value); //Many phone numbers can have the same "d" if they were merged - QSharedPointer<PhoneNumberPrivate> d_ptr; + QSharedPointer<ContactMethodPrivate> d_ptr; private: - friend class PhoneNumberPrivate; + friend class ContactMethodPrivate; //Static attributes static QHash<int,Call*> m_shMostUsed ; - static const PhoneNumber* m_spBlank ; + static const ContactMethod* m_spBlank ; private Q_SLOTS: void accountDestroyed(QObject* o); void contactRebased(Person* other); Q_SIGNALS: - ///A new call have used this PhoneNumber + ///A new call have used this ContactMethod void callAdded ( Call* call ); ///A property associated with this number has changed void changed ( ); @@ -187,16 +187,16 @@ Q_SIGNALS: * this happen when new information cues prove that number * with previously ambiguous data */ - void rebased ( PhoneNumber* other ); + void rebased ( ContactMethod* other ); }; -Q_DECLARE_METATYPE(PhoneNumber*) +Q_DECLARE_METATYPE(ContactMethod*) -///@class TemporaryPhoneNumber: An incomplete phone number -class LIB_EXPORT TemporaryPhoneNumber : public PhoneNumber { +///@class TemporaryContactMethod: An incomplete phone number +class LIB_EXPORT TemporaryContactMethod : public ContactMethod { Q_OBJECT public: - explicit TemporaryPhoneNumber(const PhoneNumber* number = nullptr); + explicit TemporaryContactMethod(const ContactMethod* number = nullptr); void setUri(const QString& uri); }; diff --git a/src/contactproxymodel.cpp b/src/contactproxymodel.cpp index 51a08f5d7ee1a5e4673a97a6333b79bf0500b33b..0fc82317724214f3ffe9dcd8c2cae56a32b7baf8 100644 --- a/src/contactproxymodel.cpp +++ b/src/contactproxymodel.cpp @@ -26,7 +26,7 @@ //Ring #include "callmodel.h" #include "historymodel.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "phonedirectorymodel.h" #include "historytimecategorymodel.h" #include "person.h" @@ -46,8 +46,8 @@ private: private Q_SLOTS: void slotContactChanged(); void slotStatusChanged(); - void slotPhoneNumberCountChanged(int,int); - void slotPhoneNumberCountAboutToChange(int,int); + void slotContactMethodCountChanged(int,int); + void slotContactMethodCountAboutToChange(int,int); }; class ContactTopLevelItem : public CategorizedCompositeNode { @@ -139,8 +139,8 @@ ContactTreeBinder::ContactTreeBinder(ContactProxyModel* m,ContactTreeNode* n) : QObject(),m_pTreeNode(n),m_pModel(m) { connect(n->m_pContact,SIGNAL(changed()),this,SLOT(slotContactChanged())); - connect(n->m_pContact,SIGNAL(phoneNumberCountChanged(int,int)),this,SLOT(slotPhoneNumberCountChanged(int,int))); - connect(n->m_pContact,SIGNAL(phoneNumberCountAboutToChange(int,int)),this,SLOT(slotPhoneNumberCountAboutToChange(int,int))); + connect(n->m_pContact,SIGNAL(phoneNumberCountChanged(int,int)),this,SLOT(slotContactMethodCountChanged(int,int))); + connect(n->m_pContact,SIGNAL(phoneNumberCountAboutToChange(int,int)),this,SLOT(slotContactMethodCountAboutToChange(int,int))); } @@ -158,7 +158,7 @@ void ContactTreeBinder::slotStatusChanged() } -void ContactTreeBinder::slotPhoneNumberCountChanged(int count, int oldCount) +void ContactTreeBinder::slotContactMethodCountChanged(int count, int oldCount) { const QModelIndex idx = m_pModel->index(m_pTreeNode->m_Index,0,m_pModel->index(m_pTreeNode->m_pParent3->m_Index,0)); if (count > oldCount) { @@ -169,7 +169,7 @@ void ContactTreeBinder::slotPhoneNumberCountChanged(int count, int oldCount) emit m_pModel->dataChanged(idx,idx); } -void ContactTreeBinder::slotPhoneNumberCountAboutToChange(int count, int oldCount) +void ContactTreeBinder::slotContactMethodCountAboutToChange(int count, int oldCount) { const QModelIndex idx = m_pModel->index(m_pTreeNode->m_Index,0,m_pModel->index(m_pTreeNode->m_pParent3->m_Index,0)); if (count < oldCount) { @@ -381,8 +381,8 @@ bool ContactProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction actio } } break; case CategorizedCompositeNode::Type::NUMBER: { - const Person::PhoneNumbers nbs = *static_cast<Person::PhoneNumbers*>(modelItem); - const PhoneNumber* nb = nbs[row]; + const Person::ContactMethods nbs = *static_cast<Person::ContactMethods*>(modelItem); + const ContactMethod* nb = nbs[row]; if (nb) { call->setTransferNumber(nb->uri()); CallModel::instance()->transfer(call,nb); @@ -473,7 +473,7 @@ QModelIndex ContactProxyModel::index( int row, int column, const QModelIndex& pa const ContactTreeNode* ctn = (ContactTreeNode*)parentNode; const Person* ct = (Person*)ctn->getSelf() ; if (ct->phoneNumbers().size()>row) { - const_cast<Person::PhoneNumbers*>(&ct->phoneNumbers())->setParentNode((CategorizedCompositeNode*)ctn); + const_cast<Person::ContactMethods*>(&ct->phoneNumbers())->setParentNode((CategorizedCompositeNode*)ctn); return createIndex(row,column,(void*)&ct->phoneNumbers()); } } @@ -517,8 +517,8 @@ QMimeData* ContactProxyModel::mimeData(const QModelIndexList &indexes) const case CategorizedCompositeNode::Type::NUMBER: { //Phone number const QString text = data(index, Qt::DisplayRole).toString(); - const Person::PhoneNumbers nbs = *static_cast<Person::PhoneNumbers*>(index.internalPointer()); - const PhoneNumber* nb = nbs[index.row()]; + const Person::ContactMethods nbs = *static_cast<Person::ContactMethods*>(index.internalPointer()); + const ContactMethod* nb = nbs[index.row()]; mimeData->setData(RingMimes::PLAIN_TEXT , text.toUtf8()); mimeData->setData(RingMimes::PHONENUMBER, nb->toHash().toUtf8()); return mimeData; diff --git a/src/delegates/phonenumberselectordelegate.cpp b/src/delegates/phonenumberselectordelegate.cpp index d3f49d061e7b9bbc2aefe2ae1385c031d86e6daa..d1ba5839b0cc68c653f54c7341350cacadc228d8 100644 --- a/src/delegates/phonenumberselectordelegate.cpp +++ b/src/delegates/phonenumberselectordelegate.cpp @@ -18,14 +18,14 @@ #include "phonenumberselectordelegate.h" //Interface only -PhoneNumberSelector* PhoneNumberSelector::m_spDefaultDelegate = nullptr; +ContactMethodSelector* ContactMethodSelector::m_spDefaultDelegate = nullptr; -void PhoneNumberSelector::setDefaultDelegate(PhoneNumberSelector* v) +void ContactMethodSelector::setDefaultDelegate(ContactMethodSelector* v) { m_spDefaultDelegate = v; } -PhoneNumberSelector* PhoneNumberSelector::defaultDelegate() +ContactMethodSelector* ContactMethodSelector::defaultDelegate() { return m_spDefaultDelegate; } diff --git a/src/delegates/phonenumberselectordelegate.h b/src/delegates/phonenumberselectordelegate.h index 340606eb528f3495f4de085e1800adc1c682a504..7fd50194f7eb80f2afc6980925e71e926f0c1671 100644 --- a/src/delegates/phonenumberselectordelegate.h +++ b/src/delegates/phonenumberselectordelegate.h @@ -22,19 +22,19 @@ #include "../typedefs.h" #include "../person.h" -class PhoneNumber; +class ContactMethod; class Person; ///Common point visitor for UI specific contact dialog -class LIB_EXPORT PhoneNumberSelector { +class LIB_EXPORT ContactMethodSelector { public: - virtual ~PhoneNumberSelector() {} - virtual PhoneNumber* getNumber(const Person* nb) = 0; - static PhoneNumberSelector* defaultDelegate(); + virtual ~ContactMethodSelector() {} + virtual ContactMethod* getNumber(const Person* nb) = 0; + static ContactMethodSelector* defaultDelegate(); protected: - static void setDefaultDelegate(PhoneNumberSelector* v); + static void setDefaultDelegate(ContactMethodSelector* v); private: - static PhoneNumberSelector* m_spDefaultDelegate; + static ContactMethodSelector* m_spDefaultDelegate; }; #endif diff --git a/src/delegates/pixmapmanipulationdelegate.cpp b/src/delegates/pixmapmanipulationdelegate.cpp index 20b1270c5448b01fd5cfcb0182d9012c3ce4e7cd..770cd7c392830d77a7b89b91ff6113c305ee1bc1 100644 --- a/src/delegates/pixmapmanipulationdelegate.cpp +++ b/src/delegates/pixmapmanipulationdelegate.cpp @@ -50,7 +50,7 @@ QVariant PixmapManipulationDelegate::callPhoto(Call* c, const QSize& size, bool return QVariant(); } -QVariant PixmapManipulationDelegate::callPhoto(const PhoneNumber* c, const QSize& size, bool displayPresence) +QVariant PixmapManipulationDelegate::callPhoto(const ContactMethod* c, const QSize& size, bool displayPresence) { Q_UNUSED(c) Q_UNUSED(size) diff --git a/src/delegates/pixmapmanipulationdelegate.h b/src/delegates/pixmapmanipulationdelegate.h index a3c5543ff5aed26f0414d742b2880710746320e7..471421e98ef4cdfbbcca9b3ec366ef918d131d0b 100644 --- a/src/delegates/pixmapmanipulationdelegate.h +++ b/src/delegates/pixmapmanipulationdelegate.h @@ -25,7 +25,7 @@ //Ring class Person ; -class PhoneNumber; +class ContactMethod; class Call ; /** @@ -44,7 +44,7 @@ public: virtual ~PixmapManipulationDelegate() {} virtual QVariant contactPhoto(Person* c, const QSize& size, bool displayPresence = true); virtual QVariant callPhoto(Call* c, const QSize& size, bool displayPresence = true); - virtual QVariant callPhoto(const PhoneNumber* n, const QSize& size, bool displayPresence = true); + virtual QVariant callPhoto(const ContactMethod* n, const QSize& size, bool displayPresence = true); virtual QVariant numberCategoryIcon(const QVariant& p, const QSize& size, bool displayPresence = false, bool isPresent = false); virtual QVariant serurityIssueIcon(const QModelIndex& index); virtual QByteArray toByteArray(const QVariant& pxm); diff --git a/src/extensions/presencecollectionextension.cpp b/src/extensions/presencecollectionextension.cpp index 066597595b0985cb8e857cea458fe750e161f482..2f34478a5bfdd410ac79f186776136721364f8fc 100644 --- a/src/extensions/presencecollectionextension.cpp +++ b/src/extensions/presencecollectionextension.cpp @@ -17,7 +17,7 @@ ***************************************************************************/ #include "presencecollectionextension.h" #include "collectioninterface.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "person.h" #include "presencestatusmodel.h" @@ -52,7 +52,7 @@ bool PresenceCollectionExtension::setData(CollectionInterface* backend, const QM switch(value.toInt()){ case Qt::Checked: foreach(Person* c, backend->items<Person>()) { - foreach(PhoneNumber* n,c->phoneNumbers()) { + foreach(ContactMethod* n,c->phoneNumbers()) { n->setTracked(true); } } @@ -61,7 +61,7 @@ bool PresenceCollectionExtension::setData(CollectionInterface* backend, const QM break; case Qt::Unchecked: foreach(Person* c, backend->items<Person>()) { - foreach(PhoneNumber* n,c->phoneNumbers()) { + foreach(ContactMethod* n,c->phoneNumbers()) { n->setTracked(false); } } diff --git a/src/historymodel.cpp b/src/historymodel.cpp index 960de72ef83da99e48a4e45260fcc5f48ea883c7..7cefccff57a5583ad1fc9d01ae0020d49193b9b6 100644 --- a/src/historymodel.cpp +++ b/src/historymodel.cpp @@ -30,7 +30,7 @@ #include "dbus/configurationmanager.h" #include "call.h" #include "person.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "callmodel.h" #include "collectioneditor.h" #include "historytimecategorymodel.h" @@ -552,7 +552,7 @@ QMimeData* HistoryModel::mimeData(const QModelIndexList &indexes) const const QString text = data(idx, Call::Role::Number).toString(); mimeData2->setData(RingMimes::PLAIN_TEXT , text.toUtf8()); const Call* call = (Call*)((CategorizedCompositeNode*)(idx.internalPointer()))->getSelf(); - mimeData2->setData(RingMimes::PHONENUMBER, call->peerPhoneNumber()->toHash().toUtf8()); + mimeData2->setData(RingMimes::PHONENUMBER, call->peerContactMethod()->toHash().toUtf8()); CategorizedCompositeNode* node = static_cast<CategorizedCompositeNode*>(idx.internalPointer()); if (node->type() == CategorizedCompositeNode::Type::CALL) mimeData2->setData(RingMimes::HISTORYID , static_cast<Call*>(node->getSelf())->id().toUtf8()); @@ -569,7 +569,7 @@ bool HistoryModel::dropMimeData(const QMimeData *mime, Qt::DropAction action, in Q_UNUSED(column) Q_UNUSED(action) setData(parentIdx,-1,Call::Role::DropState); - QByteArray encodedPhoneNumber = mime->data( RingMimes::PHONENUMBER ); + QByteArray encodedContactMethod = mime->data( RingMimes::PHONENUMBER ); QByteArray encodedPerson = mime->data( RingMimes::CONTACT ); if (parentIdx.isValid() && mime->hasFormat( RingMimes::CALLID)) { @@ -580,7 +580,7 @@ bool HistoryModel::dropMimeData(const QMimeData *mime, Qt::DropAction action, in if (idx.isValid()) { const Call* target = (Call*)((CategorizedCompositeNode*)(idx.internalPointer()))->getSelf(); if (target) { - CallModel::instance()->transfer(call,target->peerPhoneNumber()); + CallModel::instance()->transfer(call,target->peerContactMethod()); return true; } } diff --git a/src/hookmanager.cpp b/src/hookmanager.cpp index d159e464a02af27f8425f7e2c821ec8474d6d58b..565ba843caaa635a7461f7fe5c72a52690a558d5 100644 --- a/src/hookmanager.cpp +++ b/src/hookmanager.cpp @@ -41,7 +41,7 @@ public: QString m_Command ; bool m_Iax2Enabled ; bool m_SipEnabled ; - bool m_PhoneNumberEnabled; + bool m_ContactMethodEnabled; }; HookManager* HookManager::m_spInstance = nullptr; @@ -55,7 +55,7 @@ HookManager::HookManager() : QObject(QCoreApplication::instance()),d_ptr(new Hoo d_ptr->m_Command = hooks[HookManagerPrivate::Names::URLHOOK_COMMAND ]; d_ptr->m_Iax2Enabled = hooks[HookManagerPrivate::Names::URLHOOK_IAX2_ENABLED ]=="true"?true:false; d_ptr->m_SipEnabled = hooks[HookManagerPrivate::Names::URLHOOK_SIP_ENABLED ]=="true"?true:false; - d_ptr->m_PhoneNumberEnabled = hooks[HookManagerPrivate::Names::PHONE_NUMBER_HOOK_ENABLED ]=="true"?true:false; + d_ptr->m_ContactMethodEnabled = hooks[HookManagerPrivate::Names::PHONE_NUMBER_HOOK_ENABLED ]=="true"?true:false; } @@ -73,7 +73,7 @@ void HookManagerPrivate::save() hooks[HookManagerPrivate::Names::URLHOOK_COMMAND ] = m_Command; hooks[HookManagerPrivate::Names::URLHOOK_IAX2_ENABLED ] = m_Iax2Enabled?"true":"false"; hooks[HookManagerPrivate::Names::URLHOOK_SIP_ENABLED ] = m_SipEnabled?"true":"false"; - hooks[HookManagerPrivate::Names::PHONE_NUMBER_HOOK_ENABLED ] = m_PhoneNumberEnabled?"true":"false"; + hooks[HookManagerPrivate::Names::PHONE_NUMBER_HOOK_ENABLED ] = m_ContactMethodEnabled?"true":"false"; configurationManager.setHookSettings(hooks); } @@ -109,9 +109,9 @@ bool HookManager::isSipEnabled() const return d_ptr->m_SipEnabled; } -bool HookManager::isPhoneNumberEnabled() const +bool HookManager::isContactMethodEnabled() const { - return d_ptr->m_PhoneNumberEnabled; + return d_ptr->m_ContactMethodEnabled; } void HookManager::setPrefix(const QString& prefix) @@ -144,8 +144,8 @@ void HookManager::setSipEnabled(bool enabled) d_ptr->save(); } -void HookManager::setPhoneNumberEnabled(bool enabled) +void HookManager::setContactMethodEnabled(bool enabled) { - d_ptr->m_PhoneNumberEnabled = enabled; + d_ptr->m_ContactMethodEnabled = enabled; d_ptr->save(); } diff --git a/src/hookmanager.h b/src/hookmanager.h index 8754d33363286c5c1137bc09db893b085f1aad9a..f73b66676d770cb2931ea52e6f970c8fcfbc2b08 100644 --- a/src/hookmanager.h +++ b/src/hookmanager.h @@ -37,7 +37,7 @@ public: Q_PROPERTY(QString command READ command WRITE setCommand ) Q_PROPERTY(bool iax2Enabled READ isIax2Enabled WRITE setIax2Enabled ) Q_PROPERTY(bool sipEnabled READ isSipEnabled WRITE setSipEnabled ) - Q_PROPERTY(bool phoneNumberEnabled READ isPhoneNumberEnabled WRITE setPhoneNumberEnabled ) + Q_PROPERTY(bool phoneNumberEnabled READ isContactMethodEnabled WRITE setContactMethodEnabled ) //Getters QString prefix () const; @@ -45,7 +45,7 @@ public: QString command () const; bool isIax2Enabled () const; bool isSipEnabled () const; - bool isPhoneNumberEnabled() const; + bool isContactMethodEnabled() const; //Setters void setPrefix (const QString& prefix ); @@ -53,7 +53,7 @@ public: void setCommand (const QString& command); void setIax2Enabled (bool enabled ); void setSipEnabled (bool enabled ); - void setPhoneNumberEnabled (bool enabled ); + void setContactMethodEnabled (bool enabled ); private: explicit HookManager(); diff --git a/src/instantmessagingmodel.cpp b/src/instantmessagingmodel.cpp index 518dccc6ac1bd1571b9961c1d2db0c2686304880..d96fdb6e218b7918b30a17b7fc403163aca17859 100644 --- a/src/instantmessagingmodel.cpp +++ b/src/instantmessagingmodel.cpp @@ -21,7 +21,7 @@ #include "dbus/callmanager.h" #include "call.h" #include "person.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "private/instantmessagingmodel_p.h" InstantMessagingModelPrivate::InstantMessagingModelPrivate(InstantMessagingModel* parent) : QObject(parent), q_ptr(parent) @@ -66,14 +66,14 @@ QVariant InstantMessagingModel::data( const QModelIndex& idx, int role) const return static_cast<int>(MessageRole::INCOMMING_IM); break; case InstantMessagingModel::Role::CONTACT: - if (d_ptr->m_pCall->peerPhoneNumber()->contact()) { + if (d_ptr->m_pCall->peerContactMethod()->contact()) { return QVariant(); } break; case InstantMessagingModel::Role::IMAGE: { if (d_ptr->m_lImages.find(idx) != d_ptr->m_lImages.end()) return d_ptr->m_lImages[idx]; - const Person* c = d_ptr->m_pCall->peerPhoneNumber()->contact(); + const Person* c = d_ptr->m_pCall->peerContactMethod()->contact(); if (c && c->photo().isValid()) { return c->photo(); } diff --git a/src/lastusednumbermodel.cpp b/src/lastusednumbermodel.cpp index 1d688acf56446eeae57e316b64ed5b3c079773a3..562f9945cbf792d4d789d4b6ecb717fedfc387a6 100644 --- a/src/lastusednumbermodel.cpp +++ b/src/lastusednumbermodel.cpp @@ -18,16 +18,16 @@ #include "lastusednumbermodel.h" #include "call.h" #include "uri.h" -#include "phonenumber.h" +#include "contactmethod.h" LastUsedNumberModel* LastUsedNumberModel::m_spInstance = nullptr; -struct ChainedPhoneNumber { - ChainedPhoneNumber(PhoneNumber* n) : m_pPrevious(nullptr),m_pNext(nullptr),m_pSelf(n){} - ChainedPhoneNumber* m_pPrevious; - ChainedPhoneNumber* m_pNext; - PhoneNumber* m_pSelf; +struct ChainedContactMethod { + ChainedContactMethod(ContactMethod* n) : m_pPrevious(nullptr),m_pNext(nullptr),m_pSelf(n){} + ChainedContactMethod* m_pPrevious; + ChainedContactMethod* m_pNext; + ContactMethod* m_pSelf; }; class LastUsedNumberModelPrivate @@ -39,10 +39,10 @@ public: constexpr static const int MAX_ITEM = 15; //Attributes - ChainedPhoneNumber* m_pFirstNode; - QHash<PhoneNumber*,ChainedPhoneNumber*> m_hNumbers; + ChainedContactMethod* m_pFirstNode; + QHash<ContactMethod*,ChainedContactMethod*> m_hNumbers; bool m_IsValid; - ChainedPhoneNumber* m_lLastNumbers[MAX_ITEM]; + ChainedContactMethod* m_lLastNumbers[MAX_ITEM]; }; LastUsedNumberModelPrivate::LastUsedNumberModelPrivate():m_pFirstNode(nullptr),m_IsValid(false) @@ -70,15 +70,15 @@ LastUsedNumberModel* LastUsedNumberModel::instance() ///Push 'call' phoneNumber on the top of the stack void LastUsedNumberModel::addCall(Call* call) { - PhoneNumber* number = call->peerPhoneNumber(); - ChainedPhoneNumber* node = d_ptr->m_hNumbers[number]; + ContactMethod* number = call->peerContactMethod(); + ChainedContactMethod* node = d_ptr->m_hNumbers[number]; if (!number || ( node && d_ptr->m_pFirstNode == node) ) { //TODO enable threaded numbers now return; } if (!node) { - node = new ChainedPhoneNumber(number); + node = new ChainedContactMethod(number); d_ptr->m_hNumbers[number] = node; } else { @@ -102,7 +102,7 @@ QVariant LastUsedNumberModel::data( const QModelIndex& index, int role) const if (!index.isValid()) return QVariant(); if (!d_ptr->m_IsValid) { - ChainedPhoneNumber* current = d_ptr->m_pFirstNode; + ChainedContactMethod* current = d_ptr->m_pFirstNode; for (int i=0;i<LastUsedNumberModelPrivate::MAX_ITEM;i++) { //Can only grow, no need to clear d_ptr->m_lLastNumbers[i] = current; current = current->m_pNext; diff --git a/src/lastusednumbermodel.h b/src/lastusednumbermodel.h index 0909cdfe25630b74e320640cddc1061346ae4d9d..484d6810d625888608d64767996dad8f687b2fc7 100644 --- a/src/lastusednumbermodel.h +++ b/src/lastusednumbermodel.h @@ -23,7 +23,7 @@ #include <QtCore/QAbstractListModel> class Call; -class PhoneNumber; +class ContactMethod; class LastUsedNumberModelPrivate; diff --git a/src/numbercategory.h b/src/numbercategory.h index 473e45a00ecc5e55192920c3bb645767b5fbad84..d9057e5c397730890155f5a6b96fafbbda6317d8 100644 --- a/src/numbercategory.h +++ b/src/numbercategory.h @@ -26,7 +26,7 @@ class QPixmap; class NumberCategoryPrivate; /** - * This class represent a PhoneNumber category. Categories usually + * This class represent a ContactMethod category. Categories usually * come from the contact provider, but can be added dynamically too */ class LIB_EXPORT NumberCategory : public QObject { diff --git a/src/numbercategorymodel.cpp b/src/numbercategorymodel.cpp index 7e127f7b75b7bf1416584f258cd057ee1ece844a..0d2c7845e9ad6987a6dff8565b5cdba4d5873500 100644 --- a/src/numbercategorymodel.cpp +++ b/src/numbercategorymodel.cpp @@ -17,7 +17,7 @@ ***************************************************************************/ #include "numbercategorymodel.h" #include "delegates/numbercategorydelegate.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "numbercategory.h" NumberCategoryModel* NumberCategoryModel::m_spInstance = nullptr; @@ -141,7 +141,7 @@ QModelIndex NumberCategoryModel::nameToIndex(const QString& name) const } ///Be sure the category exist, increment the counter -void NumberCategoryModel::registerNumber(PhoneNumber* number) +void NumberCategoryModel::registerNumber(ContactMethod* number) { NumberCategoryModelPrivate::InternalTypeRepresentation* rep = d_ptr->m_hByName[number->category()->name()]; if (!rep) { @@ -151,7 +151,7 @@ void NumberCategoryModel::registerNumber(PhoneNumber* number) rep->counter++; } -void NumberCategoryModel::unregisterNumber(PhoneNumber* number) +void NumberCategoryModel::unregisterNumber(ContactMethod* number) { NumberCategoryModelPrivate::InternalTypeRepresentation* rep = d_ptr->m_hByName[number->category()->name()]; if (rep) diff --git a/src/numbercategorymodel.h b/src/numbercategorymodel.h index be42589d8cf90fdb969fed9893c6fcf02164035b..4a5f7ddcf270ceb11804a9d8df6a843677a6c7aa 100644 --- a/src/numbercategorymodel.h +++ b/src/numbercategorymodel.h @@ -23,7 +23,7 @@ #include <QtCore/QVector> class NumberCategoryDelegate; -class PhoneNumber; +class ContactMethod; class NumberCategory; class NumberCategoryModelPrivate; @@ -55,8 +55,8 @@ public: static NumberCategory* other(); //Mutator - void registerNumber (PhoneNumber* number); - void unregisterNumber(PhoneNumber* number); + void registerNumber (ContactMethod* number); + void unregisterNumber(ContactMethod* number); private: explicit NumberCategoryModel(QObject* parent = nullptr); diff --git a/src/numbercompletionmodel.cpp b/src/numbercompletionmodel.cpp index 979086b949d1f7fcf6a437f49428d2aad855a745..580a49fa6c2ef8b449c684923aa23b53454544b5 100644 --- a/src/numbercompletionmodel.cpp +++ b/src/numbercompletionmodel.cpp @@ -25,7 +25,7 @@ //Ring #include "phonedirectorymodel.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "call.h" #include "uri.h" #include "numbercategory.h" @@ -54,13 +54,13 @@ public: void updateModel(); //Helper - void locateNameRange (const QString& prefix, QSet<PhoneNumber*>& set); - void locateNumberRange(const QString& prefix, QSet<PhoneNumber*>& set); - uint getWeight(PhoneNumber* number); - void getRange(QMap<QString,NumberWrapper*> map, const QString& prefix, QSet<PhoneNumber*>& set) const; + void locateNameRange (const QString& prefix, QSet<ContactMethod*>& set); + void locateNumberRange(const QString& prefix, QSet<ContactMethod*>& set); + uint getWeight(ContactMethod* number); + void getRange(QMap<QString,NumberWrapper*> map, const QString& prefix, QSet<ContactMethod*>& set) const; //Attributes - QMultiMap<int,PhoneNumber*> m_hNumbers ; + QMultiMap<int,ContactMethod*> m_hNumbers ; QString m_Prefix ; Call* m_pCall ; bool m_Enabled ; @@ -89,8 +89,8 @@ NumberCompletionModel::~NumberCompletionModel() QVariant NumberCompletionModel::data(const QModelIndex& index, int role ) const { if (!index.isValid()) return QVariant(); - const QMap<int,PhoneNumber*>::iterator i = d_ptr->m_hNumbers.end()-1-index.row(); - const PhoneNumber* n = i.value(); + const QMap<int,ContactMethod*>::iterator i = d_ptr->m_hNumbers.end()-1-index.row(); + const ContactMethod* n = i.value(); const int weight = i.key (); bool needAcc = (role>=100 || role == Qt::UserRole) && n->account() && n->account() != AccountModel::instance()->currentAccount() @@ -213,7 +213,7 @@ Call* NumberCompletionModel::call() const return d_ptr->m_pCall; } -PhoneNumber* NumberCompletionModel::number(const QModelIndex& idx) const +ContactMethod* NumberCompletionModel::number(const QModelIndex& idx) const { if (idx.isValid()) { return (d_ptr->m_hNumbers.end()-1-idx.row()).value(); @@ -223,14 +223,14 @@ PhoneNumber* NumberCompletionModel::number(const QModelIndex& idx) const void NumberCompletionModelPrivate::updateModel() { - QSet<PhoneNumber*> numbers; + QSet<ContactMethod*> numbers; q_ptr->beginResetModel(); m_hNumbers.clear(); if (!m_Prefix.isEmpty()) { locateNameRange ( m_Prefix, numbers ); locateNumberRange( m_Prefix, numbers ); - foreach(PhoneNumber* n,numbers) { + foreach(ContactMethod* n,numbers) { if (m_UseUnregisteredAccount || ((n->account() && n->account()->isRegistered()) || !n->account())) m_hNumbers.insert(getWeight(n),n); } @@ -239,7 +239,7 @@ void NumberCompletionModelPrivate::updateModel() emit q_ptr->layoutChanged(); } -void NumberCompletionModelPrivate::getRange(QMap<QString,NumberWrapper*> map, const QString& prefix, QSet<PhoneNumber*>& set) const +void NumberCompletionModelPrivate::getRange(QMap<QString,NumberWrapper*> map, const QString& prefix, QSet<ContactMethod*>& set) const { if (prefix.isEmpty()) return; @@ -295,7 +295,7 @@ void NumberCompletionModelPrivate::getRange(QMap<QString,NumberWrapper*> map, co iBeg = map.end(); } while(iBeg != iEnd) { - foreach(PhoneNumber* n,iBeg.value()->numbers) { + foreach(ContactMethod* n,iBeg.value()->numbers) { if (n) { set << n; } @@ -304,17 +304,17 @@ void NumberCompletionModelPrivate::getRange(QMap<QString,NumberWrapper*> map, co } } -void NumberCompletionModelPrivate::locateNameRange(const QString& prefix, QSet<PhoneNumber*>& set) +void NumberCompletionModelPrivate::locateNameRange(const QString& prefix, QSet<ContactMethod*>& set) { getRange(PhoneDirectoryModel::instance()->d_ptr->m_lSortedNames,prefix,set); } -void NumberCompletionModelPrivate::locateNumberRange(const QString& prefix, QSet<PhoneNumber*>& set) +void NumberCompletionModelPrivate::locateNumberRange(const QString& prefix, QSet<ContactMethod*>& set) { getRange(PhoneDirectoryModel::instance()->d_ptr->m_hSortedNumbers,prefix,set); } -uint NumberCompletionModelPrivate::getWeight(PhoneNumber* number) +uint NumberCompletionModelPrivate::getWeight(ContactMethod* number) { Q_UNUSED(number) uint weight = 1; diff --git a/src/numbercompletionmodel.h b/src/numbercompletionmodel.h index e5af8aea82f7928674c539fcbe73f7c87ffecf10..72dd3e06aa5a84ea80496f4ebb0829224c36f735 100644 --- a/src/numbercompletionmodel.h +++ b/src/numbercompletionmodel.h @@ -23,7 +23,7 @@ #include "phonedirectorymodel.h" //Ring -class PhoneNumber; +class ContactMethod; class Call; //Private @@ -60,7 +60,7 @@ public: //Getters Call* call() const; - PhoneNumber* number(const QModelIndex& idx) const; + ContactMethod* number(const QModelIndex& idx) const; bool isUsingUnregisteredAccounts(); QString prefix() const; diff --git a/src/person.cpp b/src/person.cpp index ca7ad471d01fa53bccf050f06c5d65235d5ac1af..4aa57a079db6907e967ecde274f87012a448730f 100644 --- a/src/person.cpp +++ b/src/person.cpp @@ -21,7 +21,7 @@ #include "person.h" //Ring library -#include "phonenumber.h" +#include "contactmethod.h" #include "collectioninterface.h" #include "transitionalpersonbackend.h" #include "account.h" @@ -122,7 +122,7 @@ public: QString m_Group ; QString m_Department ; bool m_DisplayPhoto ; - Person::PhoneNumbers m_Numbers ; + Person::ContactMethods m_Numbers ; bool m_Active ; bool m_isPlaceHolder ; QList<Person::Address*> m_lAddresses ; @@ -138,7 +138,7 @@ public: //As a single D-Pointer can have multiple parent (when merged), all emit need //to use a proxy to make sure everybody is notified - void presenceChanged( PhoneNumber* ); + void presenceChanged( ContactMethod* ); void statusChanged ( bool ); void changed ( ); void phoneNumberCountChanged(int,int); @@ -151,7 +151,7 @@ QString PersonPrivate::filterString() return m_CachedFilterString; //Also filter by phone numbers, accents are negligible - foreach(const PhoneNumber* n , m_Numbers) { + foreach(const ContactMethod* n , m_Numbers) { m_CachedFilterString += n->uri(); } @@ -173,7 +173,7 @@ void PersonPrivate::changed() } } -void PersonPrivate::presenceChanged( PhoneNumber* n ) +void PersonPrivate::presenceChanged( ContactMethod* n ) { foreach (Person* c,m_lParents) { emit c->presenceChanged(n); @@ -210,17 +210,17 @@ PersonPrivate::~PersonPrivate() { } -Person::PhoneNumbers::PhoneNumbers(Person* parent) : QVector<PhoneNumber*>(),CategorizedCompositeNode(CategorizedCompositeNode::Type::NUMBER), +Person::ContactMethods::ContactMethods(Person* parent) : QVector<ContactMethod*>(),CategorizedCompositeNode(CategorizedCompositeNode::Type::NUMBER), m_pParent2(parent) { } -Person::PhoneNumbers::PhoneNumbers(Person* parent, const QVector<PhoneNumber*>& list) -: QVector<PhoneNumber*>(list),CategorizedCompositeNode(CategorizedCompositeNode::Type::NUMBER),m_pParent2(parent) +Person::ContactMethods::ContactMethods(Person* parent, const QVector<ContactMethod*>& list) +: QVector<ContactMethod*>(list),CategorizedCompositeNode(CategorizedCompositeNode::Type::NUMBER),m_pParent2(parent) { } -Person* Person::PhoneNumbers::contact() const +Person* Person::ContactMethods::contact() const { return m_pParent2; } @@ -246,7 +246,7 @@ Person::~Person() } ///Get the phone number list -const Person::PhoneNumbers& Person::phoneNumbers() const +const Person::ContactMethods& Person::phoneNumbers() const { return d_ptr->m_Numbers; } @@ -311,15 +311,15 @@ const QString& Person::department() const } ///Set the phone number (type and number) -void Person::setPhoneNumbers(PhoneNumbers numbers) +void Person::setContactMethods(ContactMethods numbers) { const int oldCount(d_ptr->m_Numbers.size()),newCount(numbers.size()); - foreach(PhoneNumber* n, d_ptr->m_Numbers) + foreach(ContactMethod* n, d_ptr->m_Numbers) disconnect(n,SIGNAL(presentChanged(bool)),this,SLOT(slotPresenceChanged())); d_ptr->m_Numbers = numbers; if (newCount < oldCount) //Rows need to be removed from models first d_ptr->phoneNumberCountAboutToChange(newCount,oldCount); - foreach(PhoneNumber* n, d_ptr->m_Numbers) + foreach(ContactMethod* n, d_ptr->m_Numbers) connect(n,SIGNAL(presentChanged(bool)),this,SLOT(slotPresenceChanged())); if (newCount > oldCount) //Need to be updated after the data to prevent invalid memory access d_ptr->phoneNumberCountChanged(newCount,oldCount); @@ -406,20 +406,20 @@ void Person::setActive( bool active) d_ptr->changed(); } -///Return if one of the PhoneNumber is present +///Return if one of the ContactMethod is present bool Person::isPresent() const { - foreach(const PhoneNumber* n,d_ptr->m_Numbers) { + foreach(const ContactMethod* n,d_ptr->m_Numbers) { if (n->isPresent()) return true; } return false; } -///Return if one of the PhoneNumber is tracked +///Return if one of the ContactMethod is tracked bool Person::isTracked() const { - foreach(const PhoneNumber* n,d_ptr->m_Numbers) { + foreach(const ContactMethod* n,d_ptr->m_Numbers) { if (n->isTracked()) return true; } @@ -432,10 +432,10 @@ bool Person::isActive() const return d_ptr->m_Active; } -///Return if one of the PhoneNumber support presence +///Return if one of the ContactMethod support presence bool Person::supportPresence() const { - foreach(const PhoneNumber* n,d_ptr->m_Numbers) { + foreach(const ContactMethod* n,d_ptr->m_Numbers) { if (n->supportPresence()) return true; } @@ -443,11 +443,11 @@ bool Person::supportPresence() const } -QObject* Person::PhoneNumbers::getSelf() const { +QObject* Person::ContactMethods::getSelf() const { return m_pParent2; } -time_t Person::PhoneNumbers::lastUsedTimeStamp() const +time_t Person::ContactMethods::lastUsedTimeStamp() const { time_t t = 0; for (int i=0;i<size();i++) { @@ -538,8 +538,8 @@ const QByteArray Person::toVCard(QList<Account*> accounts) const maker->addEmail("PREF", preferredEmail()); - foreach (PhoneNumber* phone , phoneNumbers()) { - maker->addPhoneNumber(phone->category()->name(), phone->uri()); + foreach (ContactMethod* phone , phoneNumbers()) { + maker->addContactMethod(phone->category()->name(), phone->uri()); } foreach (Address* addr , d_ptr->m_lAddresses) { diff --git a/src/person.h b/src/person.h index 9136e61dd3a4ac45bcc620ed7fc97dbb13702796..e08f2a6e0a9e857f03c95670ad44d9d10e1416e2 100644 --- a/src/person.h +++ b/src/person.h @@ -26,7 +26,7 @@ #include <itembase.h> //Ring -class PhoneNumber; +class ContactMethod; class PersonPrivate; class AddressPrivate; class Account; @@ -71,11 +71,11 @@ public: }; - class PhoneNumbers : public QVector<PhoneNumber*>, public CategorizedCompositeNode { //TODO private + class ContactMethods : public QVector<ContactMethod*>, public CategorizedCompositeNode { //TODO private public: virtual QObject* getSelf() const __attribute__ ((const)); - explicit PhoneNumbers(Person* parent); - PhoneNumbers(Person* parent, const QVector<PhoneNumber*>& list); + explicit ContactMethods(Person* parent); + ContactMethods(Person* parent, const QVector<ContactMethod*>& list); Person* contact() const; time_t lastUsedTimeStamp() const; private: @@ -83,7 +83,7 @@ public: }; //Properties - Q_PROPERTY( PhoneNumbers phoneNumbers READ phoneNumbers WRITE setPhoneNumbers ) + Q_PROPERTY( ContactMethods phoneNumbers READ phoneNumbers WRITE setContactMethods ) Q_PROPERTY( QString nickName READ nickName WRITE setNickName ) Q_PROPERTY( QString firstName READ firstName WRITE setFirstName ) Q_PROPERTY( QString secondName READ secondName WRITE setFamilyName ) @@ -112,7 +112,7 @@ public: virtual ~Person(); //Getters - const PhoneNumbers& phoneNumbers() const; + const ContactMethods& phoneNumbers() const; const QString& nickName () const; const QString& firstName () const; const QString& secondName () const; @@ -134,7 +134,7 @@ public: bool supportPresence () const; //Setters - void setPhoneNumbers ( PhoneNumbers ); + void setContactMethods ( ContactMethods ); void setFormattedName ( const QString& name ); void setNickName ( const QString& name ); void setFirstName ( const QString& name ); @@ -155,7 +155,7 @@ private Q_SLOTS: void slotPresenceChanged(); //TODO remove Q_SIGNALS: - void presenceChanged( PhoneNumber* ); + void presenceChanged( ContactMethod* ); void statusChanged ( bool ); void changed ( ); void phoneNumberCountChanged(int,int); diff --git a/src/personmodel.cpp b/src/personmodel.cpp index dcdec06a66c8782cc7190206b5cf8f90a7fb673a..fa5b6b7af7dfde5d2b0839329b9c8dc520396084 100644 --- a/src/personmodel.cpp +++ b/src/personmodel.cpp @@ -23,7 +23,7 @@ #include "person.h" #include "call.h" #include "uri.h" -#include "phonenumber.h" +#include "contactmethod.h" #include "collectioninterface.h" #include "collectionmodel.h" #include "collectioneditor.h" @@ -162,7 +162,7 @@ QModelIndex PersonModel::parent( const QModelIndex& idx) const return QModelIndex(); CategorizedCompositeNode* modelItem = (CategorizedCompositeNode*)idx.internalPointer(); if (modelItem && modelItem->type() == CategorizedCompositeNode::Type::NUMBER) { - int idx2 = d_ptr->m_lPersons.indexOf(((Person::PhoneNumbers*)modelItem)->contact()); + int idx2 = d_ptr->m_lPersons.indexOf(((Person::ContactMethods*)modelItem)->contact()); if (idx2 != -1) { return PersonModel::index(idx2,0,QModelIndex()); } diff --git a/src/phonedirectorymodel.cpp b/src/phonedirectorymodel.cpp index 55b6330b6b7b0b425a791b3bf9a53df8fd9fb713..32e947d539640cc04988a0583a5d748ba3103095 100644 --- a/src/phonedirectorymodel.cpp +++ b/src/phonedirectorymodel.cpp @@ -21,7 +21,7 @@ #include <QtCore/QCoreApplication> //Ring -#include "phonenumber.h" +#include "contactmethod.h" #include "call.h" #include "uri.h" #include "account.h" @@ -88,7 +88,7 @@ PhoneDirectoryModel* PhoneDirectoryModel::instance() QVariant PhoneDirectoryModel::data(const QModelIndex& index, int role ) const { if (!index.isValid() || index.row() >= d_ptr->m_lNumbers.size()) return QVariant(); - const PhoneNumber* number = d_ptr->m_lNumbers[index.row()]; + const ContactMethod* number = d_ptr->m_lNumbers[index.row()]; switch (static_cast<PhoneDirectoryModelPrivate::Columns>(index.column())) { case PhoneDirectoryModelPrivate::Columns::URI: switch (role) { @@ -260,7 +260,7 @@ Qt::ItemFlags PhoneDirectoryModel::flags(const QModelIndex& index ) const { Q_UNUSED(index) - const PhoneNumber* number = d_ptr->m_lNumbers[index.row()]; + const ContactMethod* number = d_ptr->m_lNumbers[index.row()]; const bool enabled = !((index.column() == static_cast<int>(PhoneDirectoryModelPrivate::Columns::TRACKED) || static_cast<int>(PhoneDirectoryModelPrivate::Columns::PRESENT)) && number->account() && (!number->account()->supportPresenceSubscribe())); @@ -273,7 +273,7 @@ Qt::ItemFlags PhoneDirectoryModel::flags(const QModelIndex& index ) const ///This model is read and for debug purpose bool PhoneDirectoryModel::setData(const QModelIndex& index, const QVariant &value, int role ) { - PhoneNumber* number = d_ptr->m_lNumbers[index.row()]; + ContactMethod* number = d_ptr->m_lNumbers[index.row()]; if (static_cast<PhoneDirectoryModelPrivate::Columns>(index.column())==PhoneDirectoryModelPrivate::Columns::TRACKED) { if (role == Qt::CheckStateRole && number) { number->setTracked(value.toBool()); @@ -298,7 +298,7 @@ QVariant PhoneDirectoryModel::headerData(int section, Qt::Orientation orientatio * correctly with their alternate URIs. In case there is an obvious duplication, * it will try to merge both numbers. */ -void PhoneDirectoryModelPrivate::setAccount(PhoneNumber* number, Account* account ) { +void PhoneDirectoryModelPrivate::setAccount(ContactMethod* number, Account* account ) { const URI& strippedUri = number->uri(); const bool hasAtSign = strippedUri.hasHostname(); number->setAccount(account); @@ -317,7 +317,7 @@ void PhoneDirectoryModelPrivate::setAccount(PhoneNumber* number, Account* accoun } else { //After all this, it is possible the number is now a duplicate - foreach(PhoneNumber* n, wrap->numbers) { + foreach(ContactMethod* n, wrap->numbers) { if (n != number && n->account() && n->account() == number->account()) { number->merge(n); } @@ -333,19 +333,19 @@ void PhoneDirectoryModelPrivate::setAccount(PhoneNumber* number, Account* accoun * It will also try to attach an account to existing numbers. This is not 100% reliable, but * it is correct often enough to do it. */ -PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Account* account, const QString& type) +ContactMethod* PhoneDirectoryModel::getNumber(const QString& uri, Account* account, const QString& type) { return getNumber(uri,nullptr,account,type); } ///Add new information to existing numbers and try to merge -PhoneNumber* PhoneDirectoryModelPrivate::fillDetails(NumberWrapper* wrap, const URI& strippedUri, Account* account, Person* contact, const QString& type) +ContactMethod* PhoneDirectoryModelPrivate::fillDetails(NumberWrapper* wrap, const URI& strippedUri, Account* account, Person* contact, const QString& type) { //TODO pick the best URI //TODO the account hostname change corner case //TODO search for account that has the same hostname as the URI if (wrap) { - foreach(PhoneNumber* number, wrap->numbers) { + foreach(ContactMethod* number, wrap->numbers) { //BEGIN Check if contact can be set @@ -414,12 +414,12 @@ PhoneNumber* PhoneDirectoryModelPrivate::fillDetails(NumberWrapper* wrap, const } ///Return/create a number when no information is available -PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, const QString& type) +ContactMethod* PhoneDirectoryModel::getNumber(const QString& uri, const QString& type) { const URI strippedUri(uri); NumberWrapper* wrap = d_ptr->m_hDirectory[strippedUri]; if (wrap) { - PhoneNumber* nb = wrap->numbers[0]; + ContactMethod* nb = wrap->numbers[0]; if ((!nb->hasType()) && (!type.isEmpty())) { nb->setCategory(NumberCategoryModel::instance()->getCategory(type)); } @@ -427,7 +427,7 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, const QString& t } //Too bad, lets create one - PhoneNumber* number = new PhoneNumber(strippedUri,NumberCategoryModel::instance()->getCategory(type)); + ContactMethod* number = new ContactMethod(strippedUri,NumberCategoryModel::instance()->getCategory(type)); number->setIndex(d_ptr->m_lNumbers.size()); d_ptr->m_lNumbers << number; connect(number,SIGNAL(callAdded(Call*)),d_ptr.data(),SLOT(slotCallAdded(Call*))); @@ -446,7 +446,7 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, const QString& t } ///Create a number when a more information is available duplicated ones -PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, Account* account, const QString& type) +ContactMethod* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, Account* account, const QString& type) { //Remove extra data such as "<sip:" from the main URI const URI strippedUri(uri); @@ -466,18 +466,18 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, } //Check - PhoneNumber* confirmedCandidate = d_ptr->fillDetails(wrap,strippedUri,account,contact,type); + ContactMethod* confirmedCandidate = d_ptr->fillDetails(wrap,strippedUri,account,contact,type); //URIs can be represented in multiple way, check if a more verbose version //already exist - PhoneNumber* confirmedCandidate2 = nullptr; + ContactMethod* confirmedCandidate2 = nullptr; - //Try to use a PhoneNumber with a contact when possible, work only after the + //Try to use a ContactMethod with a contact when possible, work only after the //contact are loaded if (confirmedCandidate && confirmedCandidate->contact()) confirmedCandidate2 = d_ptr->fillDetails(wrap2,strippedUri,account,contact,type); - PhoneNumber* confirmedCandidate3 = nullptr; + ContactMethod* confirmedCandidate3 = nullptr; //Else, try to see if the hostname correspond to the account and flush it //This have to be done after the parent if as the above give "better" @@ -486,7 +486,7 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, if (hasAtSign && account && strippedUri.hostname() == account->hostname()) { wrap3 = d_ptr->m_hDirectory[strippedUri.userinfo()]; if (wrap3) { - foreach(PhoneNumber* number, wrap3->numbers) { + foreach(ContactMethod* number, wrap3->numbers) { if (number->account() == account) { if (contact && ((!number->contact()) || (contact->uid() == number->contact()->uid()))) number->setPerson(contact); //TODO Check all cases from fillDetails() @@ -498,7 +498,7 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, } } - //If multiple PhoneNumber are confirmed, then they are the same, merge them + //If multiple ContactMethod are confirmed, then they are the same, merge them if (confirmedCandidate3 && (confirmedCandidate || confirmedCandidate2)) { confirmedCandidate3->merge(confirmedCandidate?confirmedCandidate:confirmedCandidate2); } @@ -520,7 +520,7 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, //No better candidates were found than the original assumption, use it if (wrap) { - foreach(PhoneNumber* number, wrap->numbers) { + foreach(ContactMethod* number, wrap->numbers) { if (((!account) || number->account() == account) && ((!contact) || ((*contact) == number->contact()) || (!number->contact()))) { //Assume this is valid until a smarter solution is implemented to merge both //For a short time, a placeholder contact and a contact can coexist, drop the placeholder @@ -533,7 +533,7 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, } //Create the number - PhoneNumber* number = new PhoneNumber(strippedUri,NumberCategoryModel::instance()->getCategory(type)); + ContactMethod* number = new ContactMethod(strippedUri,NumberCategoryModel::instance()->getCategory(type)); number->setAccount(account); number->setIndex( d_ptr->m_lNumbers.size()); if (contact) @@ -565,12 +565,12 @@ PhoneNumber* PhoneDirectoryModel::getNumber(const QString& uri, Person* contact, return number; } -PhoneNumber* PhoneDirectoryModel::fromTemporary(const TemporaryPhoneNumber* number) +ContactMethod* PhoneDirectoryModel::fromTemporary(const TemporaryContactMethod* number) { return getNumber(number->uri(),number->contact(),number->account()); } -PhoneNumber* PhoneDirectoryModel::fromHash(const QString& hash) +ContactMethod* PhoneDirectoryModel::fromHash(const QString& hash) { const QStringList fields = hash.split("///"); if (fields.size() == 3) { @@ -587,7 +587,7 @@ PhoneNumber* PhoneDirectoryModel::fromHash(const QString& hash) return nullptr; } -QVector<PhoneNumber*> PhoneDirectoryModel::getNumbersByPopularity() const +QVector<ContactMethod*> PhoneDirectoryModel::getNumbersByPopularity() const { return d_ptr->m_lPopularityIndex; } @@ -595,14 +595,14 @@ QVector<PhoneNumber*> PhoneDirectoryModel::getNumbersByPopularity() const void PhoneDirectoryModelPrivate::slotCallAdded(Call* call) { Q_UNUSED(call) - PhoneNumber* number = qobject_cast<PhoneNumber*>(sender()); + ContactMethod* number = qobject_cast<ContactMethod*>(sender()); if (number) { int currentIndex = number->popularityIndex(); //The number is already in the top 10 and just passed the "index-1" one if (currentIndex > 0 && m_lPopularityIndex[currentIndex-1]->callCount() < number->callCount()) { do { - PhoneNumber* tmp = m_lPopularityIndex[currentIndex-1]; + ContactMethod* tmp = m_lPopularityIndex[currentIndex-1]; m_lPopularityIndex[currentIndex-1] = number; m_lPopularityIndex[currentIndex ] = tmp ; tmp->setPopularityIndex(tmp->popularityIndex()+1); @@ -619,7 +619,7 @@ void PhoneDirectoryModelPrivate::slotCallAdded(Call* call) } //The top 10 is full, but this number just made it to the top 10 else if (currentIndex == -1 && m_lPopularityIndex.size() >= 10 && m_lPopularityIndex[9] != number && m_lPopularityIndex[9]->callCount() < number->callCount()) { - PhoneNumber* tmp = m_lPopularityIndex[9]; + ContactMethod* tmp = m_lPopularityIndex[9]; tmp->setPopularityIndex(-1); m_lPopularityIndex[9] = number; number->setPopularityIndex(9); @@ -636,7 +636,7 @@ void PhoneDirectoryModelPrivate::slotCallAdded(Call* call) void PhoneDirectoryModelPrivate::slotChanged() { - PhoneNumber* number = qobject_cast<PhoneNumber*>(sender()); + ContactMethod* number = qobject_cast<ContactMethod*>(sender()); if (number) { const int idx = number->index(); #ifndef NDEBUG @@ -650,14 +650,14 @@ void PhoneDirectoryModelPrivate::slotChanged() void PhoneDirectoryModelPrivate::slotNewBuddySubscription(const QString& accountId, const QString& uri, bool status, const QString& message) { qDebug() << "New presence buddy" << uri << status << message; - PhoneNumber* number = q_ptr->getNumber(uri,AccountModel::instance()->getById(accountId.toAscii())); + ContactMethod* number = q_ptr->getNumber(uri,AccountModel::instance()->getById(accountId.toAscii())); number->setPresent(status); number->setPresenceMessage(message); emit number->changed(); } ///Make sure the indexes are still valid for those names -void PhoneDirectoryModelPrivate::indexNumber(PhoneNumber* number, const QStringList &names) +void PhoneDirectoryModelPrivate::indexNumber(ContactMethod* number, const QStringList &names) { foreach(const QString& name, names) { const QString lower = name.toLower(); diff --git a/src/phonedirectorymodel.h b/src/phonedirectorymodel.h index 7d80be0f8cc849edbcb13e29c64f5f4600b47f99..483db4645ae0954e4df3875a2e1aa6596a4ed626 100644 --- a/src/phonedirectorymodel.h +++ b/src/phonedirectorymodel.h @@ -25,11 +25,11 @@ //Ring #include "uri.h" -class PhoneNumber ; +class ContactMethod ; class Person ; class Account ; class Call ; -class TemporaryPhoneNumber; +class TemporaryContactMethod; //Private class PhoneDirectoryModelPrivate; @@ -45,7 +45,7 @@ class LIB_EXPORT PhoneDirectoryModel : public QAbstractTableModel { friend class AutoCompletionTest; //Phone number need to update the indexes as they change - friend class PhoneNumber; + friend class ContactMethod; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" @@ -68,11 +68,11 @@ public: static PhoneDirectoryModel* instance(); //Factory - Q_INVOKABLE PhoneNumber* getNumber(const QString& uri, const QString& type = QString()); - Q_INVOKABLE PhoneNumber* getNumber(const QString& uri, Account* account, const QString& type = QString()); - Q_INVOKABLE PhoneNumber* getNumber(const QString& uri, Person* contact, Account* account = nullptr, const QString& type = QString()); - Q_INVOKABLE PhoneNumber* fromHash (const QString& hash); - Q_INVOKABLE PhoneNumber* fromTemporary(const TemporaryPhoneNumber* number); + Q_INVOKABLE ContactMethod* getNumber(const QString& uri, const QString& type = QString()); + Q_INVOKABLE ContactMethod* getNumber(const QString& uri, Account* account, const QString& type = QString()); + Q_INVOKABLE ContactMethod* getNumber(const QString& uri, Person* contact, Account* account = nullptr, const QString& type = QString()); + Q_INVOKABLE ContactMethod* fromHash (const QString& hash); + Q_INVOKABLE ContactMethod* fromTemporary(const TemporaryContactMethod* number); //Getter int count() const; @@ -82,7 +82,7 @@ public: void setCallWithAccount(bool value); //Static - QVector<PhoneNumber*> getNumbersByPopularity() const; + QVector<ContactMethod*> getNumbersByPopularity() const; private: //Constructor diff --git a/src/private/account_p.h b/src/private/account_p.h index 3969a0091dc5585526ef241fcd6cf5f806c51611..0276e0c61f94934496417bb7cf111e0f1d301302 100644 --- a/src/private/account_p.h +++ b/src/private/account_p.h @@ -23,7 +23,7 @@ #include <account.h> class AccountPrivate; -class PhoneNumber; +class ContactMethod; class CipherModel; class AccountStatusModel; @@ -55,7 +55,7 @@ public: //Attributes QByteArray m_AccountId ; QHash<QString,QString> m_hAccountDetails ; - PhoneNumber* m_pAccountNumber ; + ContactMethod* m_pAccountNumber ; Account* q_ptr ; bool m_isLoaded ; int m_LastTransportCode ; diff --git a/src/private/call_p.h b/src/private/call_p.h index bf1578e16e3668912ed0b2f7f9ec011736d9da57..cd1f6e0e46a1dc0b747188c41f180e49fab4465e 100644 --- a/src/private/call_p.h +++ b/src/private/call_p.h @@ -28,7 +28,7 @@ class QTimer; //Ring class Account; -class PhoneNumber; +class ContactMethod; class UserActionModel; class InstantMessagingModel; @@ -101,7 +101,7 @@ public: //Attributes Account* m_Account ; QString m_CallId ; - PhoneNumber* m_pPeerPhoneNumber; + ContactMethod* m_pPeerContactMethod; QString m_PeerName ; QString m_RecordingPath ; Call::LegacyHistoryState m_HistoryState ; @@ -117,8 +117,8 @@ public: Call::Direction m_Direction ; Call::Type m_Type ; - mutable TemporaryPhoneNumber* m_pTransferNumber ; - mutable TemporaryPhoneNumber* m_pDialNumber ; + mutable TemporaryContactMethod* m_pTransferNumber ; + mutable TemporaryContactMethod* m_pDialNumber ; //Cache HistoryTimeCategoryModel::HistoryConst m_HistoryConst; diff --git a/src/private/phonedirectorymodel_p.h b/src/private/phonedirectorymodel_p.h index c9764c9aa1f19a13e767e03c3c412a4e5f49ed95..0a66230a88a88c96b8cb4a8ab56c86687b9ebe90 100644 --- a/src/private/phonedirectorymodel_p.h +++ b/src/private/phonedirectorymodel_p.h @@ -21,12 +21,12 @@ //Ring class PhoneDirectoryModel; -#include "phonenumber.h" +#include "contactmethod.h" //Internal data structures ///@struct NumberWrapper Wrap phone numbers to prevent collisions struct NumberWrapper { - QVector<PhoneNumber*> numbers; + QVector<ContactMethod*> numbers; }; class PhoneDirectoryModelPrivate : public QObject @@ -60,14 +60,14 @@ public: //Helpers - void indexNumber(PhoneNumber* number, const QStringList& names ); - void setAccount (PhoneNumber* number, Account* account ); - PhoneNumber* fillDetails(NumberWrapper* wrap, const URI& strippedUri, Account* account, Person* contact, const QString& type); + void indexNumber(ContactMethod* number, const QStringList& names ); + void setAccount (ContactMethod* number, Account* account ); + ContactMethod* fillDetails(NumberWrapper* wrap, const URI& strippedUri, Account* account, Person* contact, const QString& type); //Attributes - QVector<PhoneNumber*> m_lNumbers ; + QVector<ContactMethod*> m_lNumbers ; QHash<QString,NumberWrapper*> m_hDirectory ; - QVector<PhoneNumber*> m_lPopularityIndex ; + QVector<ContactMethod*> m_lPopularityIndex ; QMap<QString,NumberWrapper*> m_lSortedNames ; QMap<QString,NumberWrapper*> m_hSortedNumbers ; QHash<QString,NumberWrapper*> m_hNumbersByNames ; diff --git a/src/profilemodel.cpp b/src/profilemodel.cpp index 66b30973a4e1d3788f9f8c808ce47624d79e88c5..7accc25f479654d3548022947e0825214e1da3d6 100644 --- a/src/profilemodel.cpp +++ b/src/profilemodel.cpp @@ -86,7 +86,7 @@ struct VCardMapper { c->setPhoto(photo); } - void addPhoneNumber(Person* c, const QString& key, const QByteArray& fn) { + void addContactMethod(Person* c, const QString& key, const QByteArray& fn) { Q_UNUSED(c) Q_UNUSED(key) qDebug() << fn; @@ -120,7 +120,7 @@ struct VCardMapper { } if(key.contains(VCardUtils::Property::TELEPHONE)) { - addPhoneNumber(c, key, value); + addContactMethod(c, key, value); return true; } @@ -515,7 +515,7 @@ ProfileContentBackend::SupportedFeatures ProfileContentBackend::supportedFeature //TODO ^^ Remove that one once debugging is done } -// bool ProfileContentBackend::addPhoneNumber( Person* contact , PhoneNumber* number) +// bool ProfileContentBackend::addContactMethod( Person* contact , ContactMethod* number) // { // Q_UNUSED(contact) // Q_UNUSED(number) diff --git a/src/vcardutils.cpp b/src/vcardutils.cpp index a1c8743c6efdf73aaddd7222cd64eba7ffb8e5dc..72a20024bfa0ccc4328a633fa3ccafff4b791f19 100644 --- a/src/vcardutils.cpp +++ b/src/vcardutils.cpp @@ -89,7 +89,7 @@ void VCardUtils::addAddress(const Person::Address* addr) addProperty(prop, value); } -void VCardUtils::addPhoneNumber(const QString& type, const QString& num) +void VCardUtils::addContactMethod(const QString& type, const QString& num) { // This will need some formatting addProperty(Property::TELEPHONE, type + num); diff --git a/src/vcardutils.h b/src/vcardutils.h index 0612eef51d34b9d242cadaee0e1bfeba2960147a..e6a11905484da943e4d56ef03f694a628d518876 100644 --- a/src/vcardutils.h +++ b/src/vcardutils.h @@ -74,7 +74,7 @@ public: void addProperty(const QString& prop, const QString& value); void addEmail(const QString& type, const QString& num); void addAddress(const Person::Address* addr); - void addPhoneNumber(const QString& type, const QString& num); + void addContactMethod(const QString& type, const QString& num); void addPhoto(const QByteArray img); const QByteArray endVCard();