-
Notifications
You must be signed in to change notification settings - Fork 18
/
AddExtensionDialog.cpp
51 lines (41 loc) · 1.2 KB
/
AddExtensionDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "AddExtensionDialog.h"
#include "Global.h"
#include "ui_addextensiondialog.h"
AddExtensionDialog::AddExtensionDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddExtensionDialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QObject::connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AddExtensionDialog::onAccept);
QObject::connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
ui->extenLine->setValidator(new QIntValidator(this));
}
AddExtensionDialog::~AddExtensionDialog()
{
delete ui;
}
QString AddExtensionDialog::getExtension() const
{
return ui->extenLine->text();
}
QString AddExtensionDialog::getProtocol() const
{
return ui->protocol->currentText();
}
void AddExtensionDialog::setExtension(const QString &extension)
{
ui->extenLine->setText(extension);
}
void AddExtensionDialog::setProtocol(const QString &protocol)
{
int index = ui->protocol->findText(protocol);
ui->protocol->setCurrentIndex(index);
}
void AddExtensionDialog::onAccept()
{
if (ui->extenLine->text().isEmpty())
MsgBoxWarning(tr("Invalid phone number!"));
else
QDialog::accept();
}