partially working new chronochat
diff --git a/src/invitelistdialog.cpp b/src/invitelistdialog.cpp
new file mode 100644
index 0000000..797a312
--- /dev/null
+++ b/src/invitelistdialog.cpp
@@ -0,0 +1,93 @@
+/* -*- 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>
+ */
+
+#include "invitelistdialog.h"
+#include "ui_invitelistdialog.h"
+
+using namespace std;
+
+InviteListDialog::InviteListDialog(ndn::Ptr<ContactManager> contactManager,
+ QWidget *parent)
+ :QDialog(parent)
+ , ui(new Ui::InviteListDialog)
+ , m_contactManager(contactManager)
+ , m_contactListModel(new QStringListModel)
+{
+ ui->setupUi(this);
+
+ refreshContactList();
+
+ ui->contactListView->setModel(m_contactListModel);
+
+ connect(ui->inviteButton, SIGNAL(clicked()),
+ this, SLOT(inviteWrapper()));
+ connect(ui->cancelButton, SIGNAL(clicked()),
+ this, SLOT(onCancelClicked()));
+}
+
+InviteListDialog::~InviteListDialog()
+{
+ delete ui;
+ delete m_contactListModel;
+}
+
+void
+InviteListDialog::setInviteLabel(string label)
+{
+ string msg("invite to chatroom:\n");
+ msg += label;
+ ui->inviteLabel->setText(QString::fromUtf8(msg.c_str()));
+ refreshContactList();
+}
+
+void
+InviteListDialog::refreshContactList()
+{
+ m_contactList = m_contactManager->getContactItemList();
+ QStringList contactNameList;
+ for(int i = 0; i < m_contactList.size(); i++)
+ {
+ contactNameList << QString::fromUtf8(m_contactList[i]->getAlias().c_str());
+ }
+
+ m_contactListModel->setStringList(contactNameList);
+}
+
+void
+InviteListDialog::inviteWrapper()
+{
+ QModelIndexList selected = ui->contactListView->selectionModel()->selectedIndexes();
+ QString text = m_contactListModel->data(selected.first(), Qt::DisplayRole).toString();
+ string alias = text.toUtf8().constData();
+
+ int i = 0;
+ for(; i < m_contactList.size(); i++)
+ {
+ if(alias == m_contactList[i]->getAlias())
+ break;
+ }
+
+ QString invitedContactNamespace = QString::fromUtf8(m_contactList[i]->getNameSpace().toUri().c_str());
+
+ bool isIntroducer = true;
+
+ emit invitionDetermined(invitedContactNamespace, isIntroducer);
+
+ this->close();
+}
+
+void
+InviteListDialog::onCancelClicked()
+{ this->close(); }
+
+#if WAF
+#include "invitelistdialog.moc"
+#include "invitelistdialog.cpp.moc"
+#endif