-
Notifications
You must be signed in to change notification settings - Fork 0
/
editconnection.cpp
77 lines (68 loc) · 2 KB
/
editconnection.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "ui_editconnection.h"
#include "editconnection.h"
EditConnection::EditConnection(Connection *conn, QWidget *parent) :
QDialog(parent),
ui(new Ui::EditConnection)
{
ui->setupUi(this);
connection = conn;
ui->nameLE->setText(connection->name());
if(connection->local()) {
ui->localRB->setChecked(true);
ui->remoteRB->setChecked(false);
ui->socketLE->setText(connection->socket());
} else {
ui->localRB->setChecked(false);
ui->remoteRB->setChecked(true);
ui->hostLE->setText(connection->host());
ui->portLE->setText(QString(connection->port()));
ui->sslCB->setChecked(connection->useSSL());
if(connection->useSSL())
ui->pkcsLE->setText(connection->pkcs12());
}
}
EditConnection::~EditConnection()
{
delete ui;
}
void EditConnection::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void EditConnection::on_buttonBox_accepted()
{
connection->setName(ui->nameLE->text());
connection->setLocal(ui->localRB->isChecked());
connection->setSocket(ui->socketLE->text());
connection->setHost(ui->hostLE->text());
connection->setPort(ui->portLE->text().toInt());
connection->setUseSSL(ui->sslCB->isChecked());
connection->setPkcs12(ui->pkcsLE->text());
}
void EditConnection::on_buttonBox_rejected()
{
}
void EditConnection::on_sslCB_clicked()
{
ui->pkcsLE->setEnabled(ui->sslCB->isChecked());
}
void EditConnection::on_localRB_clicked()
{
ui->socketL->setEnabled(ui->localRB->isChecked());
ui->socketLE->setEnabled(ui->localRB->isChecked());
ui->hostL->setEnabled(ui->remoteRB->isChecked());
ui->hostLE->setEnabled(ui->remoteRB->isChecked());
ui->portL->setEnabled(ui->remoteRB->isChecked());
ui->portLE->setEnabled(ui->remoteRB->isChecked());
}
void EditConnection::on_remoteRB_clicked()
{
this->on_localRB_clicked();
}