blob: ae75a2bf1a9c3e4d8db4b813b793ada3fa73b5e6 [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
Yingdi Yu0b0a7362014-08-05 16:31:30 -070011#include "set-alias-dialog.hpp"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080012#include "ui_set-alias-dialog.h"
13
Yingdi Yueb692ac2015-02-10 18:46:18 -080014namespace chronochat {
Yingdi Yu348f5ea2014-03-01 14:47:25 -080015
Yingdi Yu0b0a7362014-08-05 16:31:30 -070016SetAliasDialog::SetAliasDialog(QWidget* parent)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080017 : QDialog(parent)
18 , ui(new Ui::SetAliasDialog)
19{
20 ui->setupUi(this);
21
22 connect(ui->okButton, SIGNAL(clicked()),
Yingdi Yufa0b6a02014-04-30 14:26:42 -070023 this, SLOT(onOkClicked()));
Yingdi Yu348f5ea2014-03-01 14:47:25 -080024 connect(ui->cancelButton, SIGNAL(clicked()),
Yingdi Yufa0b6a02014-04-30 14:26:42 -070025 this, SLOT(onCancelClicked()));
Yingdi Yu348f5ea2014-03-01 14:47:25 -080026}
27
28SetAliasDialog::~SetAliasDialog()
29{
30 delete ui;
31}
32
33void
34SetAliasDialog::onOkClicked()
35{
36 emit aliasChanged(m_targetIdentity, ui->aliasInput->text());
37 this->close();
38}
39
40void
41SetAliasDialog::onCancelClicked()
Yingdi Yufa0b6a02014-04-30 14:26:42 -070042{
43 this->close();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080044}
45
Yingdi Yufa0b6a02014-04-30 14:26:42 -070046void
Yingdi Yu348f5ea2014-03-01 14:47:25 -080047SetAliasDialog::setTargetIdentity(const QString& targetIdentity, const QString& alias)
Yingdi Yufa0b6a02014-04-30 14:26:42 -070048{
49 m_targetIdentity = targetIdentity;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080050 QString msg = QString("Set alias for %1:").arg(targetIdentity);
51 ui->introLabel->setText(msg);
52 ui->aliasInput->setText(alias);
53}
54
Yingdi Yueb692ac2015-02-10 18:46:18 -080055} // namespace chronochat
Yingdi Yu348f5ea2014-03-01 14:47:25 -080056
57#if WAF
58#include "set-alias-dialog.moc"
Yingdi Yu42125862014-08-07 17:04:28 -070059// #include "set-alias-dialog.cpp.moc"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080060#endif