Skip to content
Snippets Groups Projects
Commit b474cc62 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Adrien Béraud
Browse files

ContactMethod: add isConfirmed/setConfirmed property

Add isConfirmed/setConfirmed property saying if a contact method
is confirmed as trusted by the associated peer account.

Synchronized them on daemon contact property 'confirmed' during
the account loading.

Change-Id: I04bb1b56afea43b2fe02b242c43d9d75fe4e1e44
parent 95b93057
No related branches found
No related tags found
No related merge requests found
...@@ -172,9 +172,14 @@ Account* Account::buildExistingAccountFromId(const QByteArray& _accountId) ...@@ -172,9 +172,14 @@ Account* Account::buildExistingAccountFromId(const QByteArray& _accountId)
if (a->protocol() == Account::Protocol::RING) { if (a->protocol() == Account::Protocol::RING) {
for (auto contact_info : account_contacts) { for (auto contact_info : account_contacts) {
auto cm = PhoneDirectoryModel::instance().getNumber(contact_info["id"], a); auto cm = PhoneDirectoryModel::instance().getNumber(contact_info["id"], a);
if (contact_info["banned"] IS_TRUE) {
a->bannedContactModel()->add(cm);
} else {
cm->setConfirmed(contact_info["confirmed"] IS_TRUE);
a->d_ptr->m_NumbersFromDaemon << cm; a->d_ptr->m_NumbersFromDaemon << cm;
} }
} }
}
//Load the tracked buddies //Load the tracked buddies
const VectorMapStringString subscriptions = PresenceManager::instance().getSubscriptions(a->id()); const VectorMapStringString subscriptions = PresenceManager::instance().getSubscriptions(a->id());
......
...@@ -101,7 +101,8 @@ ContactMethodPrivate::ContactMethodPrivate(const URI& uri, NumberCategory* cat, ...@@ -101,7 +101,8 @@ ContactMethodPrivate::ContactMethodPrivate(const URI& uri, NumberCategory* cat,
m_Uri(uri),m_pCategory(cat),m_Tracked(false),m_Present(false), m_Uri(uri),m_pCategory(cat),m_Tracked(false),m_Present(false),
m_Type(st),m_PopularityIndex(-1),m_pPerson(nullptr),m_pAccount(nullptr), m_Type(st),m_PopularityIndex(-1),m_pPerson(nullptr),m_pAccount(nullptr),
m_IsBookmark(false), m_IsBookmark(false),
m_Index(-1),m_hasType(false),m_pTextRecording(nullptr), m_pCertificate(nullptr), q_ptr(q) m_Index(-1),m_hasType(false),m_pTextRecording(nullptr), m_pCertificate(nullptr),
m_Confirmed(false), q_ptr(q)
{} {}
ContactMethod::ContactMethod() ContactMethod::ContactMethod()
...@@ -127,6 +128,19 @@ ContactMethod::~ContactMethod() ...@@ -127,6 +128,19 @@ ContactMethod::~ContactMethod()
delete d_ptr; delete d_ptr;
} }
///Return if this contact has confirmed the associated account
bool ContactMethod::isConfirmed() const
{
return d_ptr->m_Confirmed;
}
///Change the confirmed property
void ContactMethod::setConfirmed(bool confirmed)
{
d_ptr->m_Confirmed = confirmed;
d_ptr->changed();
}
///Return if this number presence is being tracked ///Return if this number presence is being tracked
bool ContactMethod::isTracked() const bool ContactMethod::isTracked() const
{ {
......
...@@ -91,6 +91,7 @@ public: ...@@ -91,6 +91,7 @@ public:
Q_PROPERTY(QString registeredName READ registeredName NOTIFY registeredNameSet ) Q_PROPERTY(QString registeredName READ registeredName NOTIFY registeredNameSet )
Q_PROPERTY(QString bestId READ bestId ) Q_PROPERTY(QString bestId READ bestId )
Q_PROPERTY(QString bestName READ bestName ) Q_PROPERTY(QString bestName READ bestName )
Q_PROPERTY(bool isConfirmed READ isConfirmed WRITE setConfirmed )
// Q_PROPERTY(QHash<QString,int> alternativeNames READ alternativeNames ) // Q_PROPERTY(QHash<QString,int> alternativeNames READ alternativeNames )
...@@ -140,6 +141,7 @@ public: ...@@ -140,6 +141,7 @@ public:
QString bestId () const; QString bestId () const;
bool isDuplicate () const; bool isDuplicate () const;
QString bestName () const; QString bestName () const;
bool isConfirmed () const;
/* /*
* Returns roles associated on ContactMethod based on Call::Roles * Returns roles associated on ContactMethod based on Call::Roles
...@@ -158,6 +160,7 @@ public: ...@@ -158,6 +160,7 @@ public:
bool setType (ContactMethod::Type t ); bool setType (ContactMethod::Type t );
void setLastUsed (time_t t ); void setLastUsed (time_t t );
void setPresent (bool present ); void setPresent (bool present );
void setConfirmed (bool confirmed );
//Mutator //Mutator
Q_INVOKABLE void addCall(Call* call); Q_INVOKABLE void addCall(Call* call);
......
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
Certificate* m_pCertificate; Certificate* m_pCertificate;
QString m_RegisteredName ; QString m_RegisteredName ;
UsageStatistics m_UsageStats ; UsageStatistics m_UsageStats ;
bool m_Confirmed ;
//Parents //Parents
QList<ContactMethod*> m_lParents; QList<ContactMethod*> m_lParents;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment