Adding browsing existing certificates feature
diff --git a/src/browsecontactdialog.h b/src/browsecontactdialog.h
new file mode 100644
index 0000000..f74a14f
--- /dev/null
+++ b/src/browsecontactdialog.h
@@ -0,0 +1,106 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+
+#ifndef BROWSECONTACTDIALOG_H
+#define BROWSECONTACTDIALOG_H
+
+#include <QDialog>
+#include <QStringListModel>
+#include "warningdialog.h"
+
+
+#ifndef Q_MOC_RUN
+#include <ndn.cxx/security/certificate/identity-certificate.h>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include "profile.h"
+#include "contact-manager.h"
+#endif
+
+namespace Ui {
+class BrowseContactDialog;
+}
+
+class BrowseContactDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit BrowseContactDialog(ndn::Ptr<ContactManager> contactManager,
+ QWidget *parent = 0);
+
+ ~BrowseContactDialog();
+
+protected:
+ typedef boost::recursive_mutex RecLock;
+ typedef boost::unique_lock<RecLock> UniqueRecLock;
+
+private:
+ std::vector<std::string>
+ getCertName();
+
+ void
+ updateCertificateMap(bool filter = false);
+
+ void
+ updateCertificateFetchingStatus(int count);
+
+ void
+ fetchCertificate();
+
+private slots:
+ void
+ updateSelection(const QItemSelection &selected,
+ const QItemSelection &deselected);
+
+ void
+ onCertificateFetched(const ndn::security::IdentityCertificate& identityCertificate);
+
+ void
+ onCertificateFetchFailed(const ndn::Name& identity);
+
+ void
+ onWarning(QString msg);
+
+ void
+ onAddClicked();
+
+ void
+ onCancelClicked();
+
+public slots:
+ void
+ refreshList();
+
+signals:
+ void
+ newContactAdded();
+
+private:
+ Ui::BrowseContactDialog *ui;
+
+ ndn::Ptr<ContactManager> m_contactManager;
+
+ WarningDialog* m_warningDialog;
+ QStringListModel* m_contactListModel;
+
+ QStringList m_contactList;
+ std::vector<ndn::Name> m_contactNameList;
+ std::vector<ndn::Name> m_certificateNameList;
+ std::map<ndn::Name, ndn::security::IdentityCertificate> m_certificateMap;
+ std::map<ndn::Name, Profile> m_profileMap;
+
+ RecLock m_mutex;
+
+
+};
+
+#endif // BROWSECONTACTDIALOG_H