blob: 553b15c2dd2377f9c3bfa7e33a8247fbe7585acf [file] [log] [blame]
/* -*- 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 "setaliasdialog.h"
#include "ui_setaliasdialog.h"
using namespace ndn;
using namespace std;
SetAliasDialog::SetAliasDialog(shared_ptr<chronos::ContactManager> contactManager,
QWidget *parent)
: QDialog(parent)
, ui(new Ui::SetAliasDialog)
, m_contactManager(contactManager)
{
ui->setupUi(this);
connect(ui->okButton, SIGNAL(clicked()),
this, SLOT(onOkClicked()));
connect(ui->cancelButton, SIGNAL(clicked()),
this, SLOT(onCancelClicked()));
}
SetAliasDialog::~SetAliasDialog()
{
delete ui;
}
void
SetAliasDialog::onOkClicked()
{
QString text = ui->aliasInput->text();
string alias = text.toStdString();
m_contactManager->getContactStorage()->updateAlias(Name(m_target), alias);
emit aliasChanged();
this->close();
}
void
SetAliasDialog::onCancelClicked()
{ this->close(); }
void
SetAliasDialog::setTargetIdentity(const string& name)
{
m_target = name;
string msg("Set alias for ");
msg.append(name).append(":");
ui->introLabel->setText(QString::fromStdString(msg));
ui->aliasInput->clear();
}
#if WAF
#include "setaliasdialog.moc"
#include "setaliasdialog.cpp.moc"
#endif