Skip to content
Snippets Groups Projects
Commit 2fc4f15e authored by Olivier SOLDANO's avatar Olivier SOLDANO
Browse files

add utility functions adding and checking contacts

add the contact addition wrapping from ConfigurationManager.
add hasContact to check if a contact method is part account contacts.

Change-Id: I10cd59ebdba74dba5098d794810f29542b70daa4
parent 23bf543c
Branches
No related tags found
No related merge requests found
...@@ -1458,10 +1458,42 @@ bool Account::removeContact( Certificate* c ) ...@@ -1458,10 +1458,42 @@ bool Account::removeContact( Certificate* c )
return false; return false;
ConfigurationManager::instance().removeContact(id(), c->remoteId(), false); ConfigurationManager::instance().removeContact(id(), c->remoteId(), false);
return true;
}
bool Account::addContact( const URI& uri )
{
if (uri.isEmpty())
return false;
ConfigurationManager::instance().addContact(id(), uri);
return true; return true;
} }
bool Account::addContact(const ContactMethod* c)
{
if (!c)
return false;
return addContact(c->uri());
}
bool Account::addContact( Certificate* c )
{
if ((!c) || (c->remoteId().isEmpty()))
return false;
ConfigurationManager::instance().addContact(id(), c->remoteId());
return true;
}
bool Account::hasContact(ContactMethod* c )
{
auto contacts = getContacts();
return contacts.indexOf(c) != -1;
}
uint Account::internalId() const uint Account::internalId() const
{ {
return d_ptr->m_InternalId; return d_ptr->m_InternalId;
......
...@@ -485,6 +485,10 @@ class LIB_EXPORT Account : public ItemBase { ...@@ -485,6 +485,10 @@ class LIB_EXPORT Account : public ItemBase {
Q_INVOKABLE bool removeContact(Certificate* c); Q_INVOKABLE bool removeContact(Certificate* c);
Q_INVOKABLE bool removeContact(const ContactMethod* c); Q_INVOKABLE bool removeContact(const ContactMethod* c);
Q_INVOKABLE bool removeContact(const URI& uri); Q_INVOKABLE bool removeContact(const URI& uri);
Q_INVOKABLE bool addContact(Certificate* c);
Q_INVOKABLE bool addContact(const ContactMethod* c);
Q_INVOKABLE bool addContact(const URI& uri);
Q_INVOKABLE bool hasContact(ContactMethod* c);
Q_INVOKABLE QString accountDetail(const QString& param) const; Q_INVOKABLE QString accountDetail(const QString& param) const;
//Setters //Setters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment