Fixing the Add/Delete Contact bug, now when a contact is added and removed, the panelPolicyManager will add/remove the contact into/from trust anchors
Change-Id: Ia7a8bc5c6cbe1744018410c0ca0019db3e5d3994
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index 4ee8d71..e9fafaa 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -148,6 +148,11 @@
this, SLOT(acceptInvitation(const ChronosInvitation&, const ndn::security::IdentityCertificate&)));
connect(m_invitationDialog, SIGNAL(invitationRejected(const ChronosInvitation&)),
this, SLOT(rejectInvitation(const ChronosInvitation&)));
+
+ connect(&*m_contactManager, SIGNAL(contactAdded(const ndn::Name&)),
+ this, SLOT(addContactIntoPanelPolicy(const ndn::Name&)));
+ connect(&*m_contactManager, SIGNAL(contactRemoved(const ndn::Name&)),
+ this, SLOT(removeContactFromPanelPolicy(const ndn::Name&)));
connect(m_settingDialog, SIGNAL(identitySet(const QString&, const QString&)),
this, SLOT(updateDefaultIdentity(const QString&, const QString&)));
@@ -644,6 +649,18 @@
{ m_invitationDialog->show(); }
void
+ContactPanel::addContactIntoPanelPolicy(const Name& contactNameSpace)
+{
+ Ptr<ContactItem> contact = m_contactManager->getContact(contactNameSpace);
+ if(contact != NULL)
+ m_panelPolicyManager->addTrustAnchor(contact->getSelfEndorseCertificate());
+}
+
+void
+ContactPanel::removeContactFromPanelPolicy(const Name& keyName)
+{ m_panelPolicyManager->removeTrustAnchor(keyName); }
+
+void
ContactPanel::refreshContactList()
{
m_contactList = m_contactManager->getContactItemList();