SelfProfile related things is done, not tested yet.
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index 14a89df..5dea76c 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -15,14 +15,35 @@
#include <QStringList>
#include <QItemSelectionModel>
#include <QModelIndex>
+#include <QDir>
-ContactPanel::ContactPanel(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::ContactPanel),
- m_contactListModel(new QStringListModel)
+#ifndef Q_MOC_RUN
+#include <boost/filesystem.hpp>
+#include "logging.h"
+#include "exception.h"
+#endif
+
+namespace fs = boost::filesystem;
+using namespace ndn;
+
+INIT_LOGGER("ContactPanel");
+
+ContactPanel::ContactPanel(Ptr<ContactStorage> contactStorage, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::ContactPanel)
+ , m_contactStorage(contactStorage)
+ , m_contactListModel(new QStringListModel)
+ , m_profileEditor(NULL)
{
+
ui->setupUi(this);
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
+ QString path = (QDir::home().path());
+ path.append(QDir::separator()).append(".chronos").append(QDir::separator()).append("chronos.db");
+ db.setDatabaseName(path);
+ bool ok = db.open();
+
QStringList contactNameList;
contactNameList << "Alex" << "Wentao" << "Yingdi";
@@ -32,6 +53,8 @@
QItemSelectionModel* selectionModel = ui->ContactList->selectionModel();
connect(selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
+ connect(ui->EditProfileButton, SIGNAL(clicked()),
+ this, SLOT(openProfileEditor()));
}
ContactPanel::~ContactPanel()
@@ -49,6 +72,15 @@
ui->NameData->setText(text);
}
+void
+ContactPanel::openProfileEditor()
+{
+ if(m_profileEditor == NULL)
+ m_profileEditor = new ProfileEditor(m_contactStorage);
+
+ m_profileEditor->show();
+}
+
#if WAF
#include "contactpanel.moc"
#include "contactpanel.cpp.moc"