diff --git a/src/backend/dbus-interface/kylinconnectresource.cpp b/src/backend/dbus-interface/kylinconnectresource.cpp index a2d02a3d..6f52488b 100644 --- a/src/backend/dbus-interface/kylinconnectresource.cpp +++ b/src/backend/dbus-interface/kylinconnectresource.cpp @@ -386,6 +386,7 @@ void KyConnectResourse::getIpv4ConnectSetting( { if (NetworkManager::Ipv4Setting::Automatic == ipv4Setting->method()) { connectSetting.m_ipv4ConfigIpType = CONFIG_IP_DHCP; + connectSetting.m_ipv4Dns = ipv4Setting->dns(); return; } @@ -404,6 +405,7 @@ void KyConnectResourse::getIpv6ConnectSetting( if (NetworkManager::Ipv6Setting::Automatic == ipv6Setting->method()) { connectSetting.m_ipv6ConfigIpType = CONFIG_IP_DHCP; + connectSetting.m_ipv6Dns = ipv6Setting->dns(); return; } diff --git a/src/backend/dbus-interface/kylinconnectsetting.cpp b/src/backend/dbus-interface/kylinconnectsetting.cpp index 88aeb57d..f77c74a0 100644 --- a/src/backend/dbus-interface/kylinconnectsetting.cpp +++ b/src/backend/dbus-interface/kylinconnectsetting.cpp @@ -69,7 +69,7 @@ int KyConnectSetting::setIpConfigType(KyIpAddressType ipType, KyIpConfigType ipC return 0; } -void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns) +void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay) { qDebug()<<"ipv4 address"< &ipv4DnsList) +{ + m_ipv4Dns = ipv4DnsList; +} + +void KyConnectSetting::ipv6DnsConstruct(QList &ipv6DnsList) +{ + m_ipv6Dns = ipv6DnsList; +} + void KyConnectSetting::dumpInfo() { qDebug()<<"connect setting info:"; diff --git a/src/backend/dbus-interface/kylinconnectsetting.h b/src/backend/dbus-interface/kylinconnectsetting.h index f2e967e6..c8ae8f8c 100644 --- a/src/backend/dbus-interface/kylinconnectsetting.h +++ b/src/backend/dbus-interface/kylinconnectsetting.h @@ -50,8 +50,10 @@ public: void setIfaceName(QString &ifaceName); void setConnectName(QString &connectName); int setIpConfigType(KyIpAddressType ipType, KyIpConfigType configType); - void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns); - void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay, QStringList &ipv6Dns); + void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay); + void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay); + void ipv4DnsConstruct(QList &ipv4DnsList); + void ipv6DnsConstruct(QList &ipv6DnsList); void dumpInfo(); public: diff --git a/src/frontend/netdetails/creatnetpage.cpp b/src/frontend/netdetails/creatnetpage.cpp index 89987a6a..f8bbb0df 100644 --- a/src/frontend/netdetails/creatnetpage.cpp +++ b/src/frontend/netdetails/creatnetpage.cpp @@ -17,24 +17,18 @@ void CreatNetPage::initUI() ipv4addressEdit = new LineEdit(this); netMaskEdit = new LineEdit(this); gateWayEdit = new LineEdit(this); -// firstDnsEdit = new LineEdit(this); -// secondDnsEdit = new LineEdit(this); m_connNameLabel = new QLabel(this); m_configLabel = new QLabel(this); m_addressLabel = new QLabel(this); m_maskLabel = new QLabel(this); m_gateWayLabel = new QLabel(this); -// m_dnsLabel = new QLabel(this); -// m_secDnsLabel = new QLabel(this); m_connNameLabel->setText(tr("Connection Name")); m_configLabel->setText(tr("Ipv4Config")); m_addressLabel->setText(tr("Address")); m_maskLabel->setText(tr("Netmask")); m_gateWayLabel->setText(tr("Default Gateway")); -// m_dnsLabel->setText(tr("Prefs DNS")); -// m_secDnsLabel->setText(tr("Alternative DNS")); // IP的正则格式限制 QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); @@ -48,8 +42,6 @@ void CreatNetPage::initUI() m_detailLayout->addRow(m_addressLabel,ipv4addressEdit); m_detailLayout->addRow(m_maskLabel,netMaskEdit); m_detailLayout->addRow(m_gateWayLabel,gateWayEdit); -// m_detailLayout->addRow(m_dnsLabel,firstDnsEdit); -// m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit); m_detailLayout->addRow(m_dnsWidget); ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)" @@ -58,8 +50,6 @@ void CreatNetPage::initUI() ipv4addressEdit->setValidator(new QRegExpValidator(rx, this)); gateWayEdit->setValidator(new QRegExpValidator(rx, this)); netMaskEdit->setValidator(new QRegExpValidator(rx, this)); -// firstDnsEdit->setValidator(new QRegExpValidator(rx, this)); -// secondDnsEdit->setValidator(new QRegExpValidator(rx, this)); } void CreatNetPage::initComponent() { @@ -74,14 +64,6 @@ void CreatNetPage::initComponent() { connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); -// connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); -// connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); - connect(m_dnsWidget, &MultipleDnsWidget::dnsTextChanged, this, [=]() { - setCreatePageState(false); - }); - connect(m_dnsWidget, &MultipleDnsWidget::dnsEditingFinished, this, [=]() { - setCreatePageState(true); - }); } bool CreatNetPage::checkConnectBtnIsEnabled() @@ -142,16 +124,11 @@ void CreatNetPage::setLineEnabled(bool check) { ipv4addressEdit->setEnabled(check); netMaskEdit->setEnabled(check); gateWayEdit->setEnabled(check); -// firstDnsEdit->setEnabled(check); -// secondDnsEdit->setEnabled(check); - m_dnsWidget->setEditEnabled(check); if (!check) { ipv4addressEdit->clear(); netMaskEdit->clear(); gateWayEdit->clear(); -// firstDnsEdit->clear(); -// secondDnsEdit->clear(); ipv4addressEdit->setPlaceholderText(" "); netMaskEdit->setPlaceholderText(" "); @@ -188,31 +165,13 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting) << " netMask " << netMask << " gateWay " << gateWay; - QStringList dnsList; - dnsList.clear(); -#if 0 - if (!firstDnsEdit->text().isEmpty()) { - dnsList << firstDnsEdit->text(); - if (!secondDnsEdit->text().isEmpty()) { - dnsList << secondDnsEdit->text(); - } - } -#endif - QList ipv4dnsList; ipv4dnsList.clear(); ipv4dnsList = m_dnsWidget->getDns(); - for (QHostAddress str: ipv4dnsList) { - dnsList << str.toString(); - } - - if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) { - setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); - } else { - setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL); - setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList); - } + setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); + setting.ipv4DnsConstruct(ipv4dnsList); } bool CreatNetPage::netMaskIsValide(QString text) diff --git a/src/frontend/netdetails/detailpage.cpp b/src/frontend/netdetails/detailpage.cpp index 92c06650..0a9c4c9d 100644 --- a/src/frontend/netdetails/detailpage.cpp +++ b/src/frontend/netdetails/detailpage.cpp @@ -222,7 +222,9 @@ void DetailPage::initUI() { m_ipv4Widget = new DetailWidget(qobject_cast(m_IPV4), m_listWidget); m_ipv4Widget->setKey(tr("IPV4:")); - m_IPV4Dns = new QLabel(this); + m_IPV4Dns = new FixLabel(this); + m_IPV4Dns->setFixedWidth(MAX_LABEL_WIDTH); + m_IPV4Dns->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_ipv4DnsWidget = new DetailWidget(qobject_cast(m_IPV4Dns), m_listWidget); m_ipv4DnsWidget->setKey(tr("IPV4 Dns:")); diff --git a/src/frontend/netdetails/detailpage.h b/src/frontend/netdetails/detailpage.h index c7062629..913e3138 100644 --- a/src/frontend/netdetails/detailpage.h +++ b/src/frontend/netdetails/detailpage.h @@ -72,7 +72,7 @@ public: QLabel *m_Chan; QLabel *m_BandWidth; QLabel *m_IPV4; - QLabel *m_IPV4Dns; + FixLabel *m_IPV4Dns; FixLabel *m_IPV6; QLabel *m_Mac; QLabel *m_autoConnect; diff --git a/src/frontend/netdetails/ipv4page.cpp b/src/frontend/netdetails/ipv4page.cpp index 1468e2d8..39d38847 100644 --- a/src/frontend/netdetails/ipv4page.cpp +++ b/src/frontend/netdetails/ipv4page.cpp @@ -72,14 +72,6 @@ void Ipv4Page::initComponent() { connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); -// connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); -// connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); - connect(m_dnsWidget, &MultipleDnsWidget::dnsTextChanged, this, [=]() { - setIpv4PageState(false); - }); - connect(m_dnsWidget, &MultipleDnsWidget::dnsEditingFinished, this, [=]() { - setIpv4PageState(true); - }); } void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config) @@ -124,6 +116,15 @@ void Ipv4Page::setGateWay(const QString &gateWay) bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) { bool isChanged = false; + QList ipv4DnsList; + ipv4DnsList.clear(); + ipv4DnsList = m_dnsWidget->getDns(); + if (info.ipv4DnsList != ipv4DnsList) { + qDebug() << "ipv4 dns changed"; + setting.ipv4DnsConstruct(ipv4DnsList); + isChanged = true; + } + if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { if (info.ipv4ConfigType != CONFIG_IP_DHCP) { qDebug() << "ipv4ConfigType change to Auto"; @@ -131,10 +132,8 @@ bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) QString ipv4address(""); QString netMask(""); QString gateWay(""); - QStringList dnsList; - dnsList.empty(); qDebug() << ipv4address << netMask << gateWay; - setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList); + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); isChanged = true; } } else { @@ -145,37 +144,17 @@ bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) } qDebug() << "ipv4 netmask " << getNetMaskText(netMaskEdit->text()); - QList ipv4dnsList; - ipv4dnsList.clear(); - ipv4dnsList = m_dnsWidget->getDns(); - if(info.strIPV4Address != ipv4addressEdit->text() || info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text()) - || info.strIPV4GateWay != gateWayEdit->text() - // || info.strIPV4FirDns != firstDnsEdit->text() - // || info.strIPV4SecDns != secondDnsEdit->text() - || info.ipv4DnsList != ipv4dnsList) { + || info.strIPV4GateWay != gateWayEdit->text()) { qDebug() << "ipv4 info changed"; - QStringList dnsList; - dnsList.clear(); - for (QHostAddress str: ipv4dnsList) { - dnsList << str.toString(); - } -#if 0 - if (!firstDnsEdit->text().isEmpty()) { - dnsList << firstDnsEdit->text(); - if (!secondDnsEdit->text().isEmpty()) { - dnsList << secondDnsEdit->text(); - } - } -#endif QString ipv4address =ipv4addressEdit->text(); QString netMask = getNetMaskText(netMaskEdit->text()); QString gateWay = gateWayEdit->text(); qDebug() << ipv4address << netMask << gateWay; - setting.ipv4AddressConstruct(ipv4address, netMask, gateWay, dnsList); + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); setting.dumpInfo(); isChanged = true; } @@ -237,16 +216,11 @@ void Ipv4Page::setLineEnabled(bool check) { ipv4addressEdit->setEnabled(check); netMaskEdit->setEnabled(check); gateWayEdit->setEnabled(check); -// firstDnsEdit->setEnabled(check); -// secondDnsEdit->setEnabled(check); - m_dnsWidget->setEditEnabled(check); if (!check) { ipv4addressEdit->clear(); netMaskEdit->clear(); gateWayEdit->clear(); -// firstDnsEdit->clear(); -// secondDnsEdit->clear(); } } diff --git a/src/frontend/netdetails/ipv6page.cpp b/src/frontend/netdetails/ipv6page.cpp index a29a788a..bd6c67ee 100644 --- a/src/frontend/netdetails/ipv6page.cpp +++ b/src/frontend/netdetails/ipv6page.cpp @@ -49,6 +49,15 @@ void Ipv6Page::setGateWay(const QString &gateWay) bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) { bool isChanged = false; + QList ipv6DnsList; + ipv6DnsList.clear(); + ipv6DnsList = m_dnsWidget->getDns(); + if (info.ipv6DnsList != ipv6DnsList) { + qDebug() << "ipv6 dns changed"; + setting.ipv6DnsConstruct(ipv6DnsList); + isChanged = true; + } + if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) { if (info.ipv6ConfigType != CONFIG_IP_DHCP) { qDebug() << "ipv6ConfigType change to Auto"; @@ -56,9 +65,7 @@ bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) QString ipv6address(""); QString prefix(""); QString gateWay(""); - QStringList dnsList; - dnsList.empty(); - setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList); + setting.ipv6AddressConstruct(ipv6address, prefix, gateWay); isChanged = true; } } else { @@ -68,35 +75,16 @@ bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) isChanged = true; } - QList ipv6dnsList; - ipv6dnsList.clear(); - ipv6dnsList = m_dnsWidget->getDns(); - if(info.strIPV6Address != ipv6AddressEdit->text() || info.iIPV6Prefix != lengthEdit->text().toInt() - || info.strIPV6GateWay != gateWayEdit->text() - // || info.strIPV6FirDns != firstDnsEdit->text() - // || info.strIPV6SecDns != secondDnsEdit->text() - || info.ipv6DnsList != ipv6dnsList) { + || info.strIPV6GateWay != gateWayEdit->text()) { qDebug() << "ipv6 info changed"; - QStringList dnsList; - dnsList.clear(); - for (QHostAddress str: ipv6dnsList) { - dnsList << str.toString(); - } -#if 0 - if (!firstDnsEdit->text().isEmpty()) { - dnsList << firstDnsEdit->text(); - if (!secondDnsEdit->text().isEmpty()) { - dnsList << secondDnsEdit->text(); - } - } -#endif + QString ipv6address =ipv6AddressEdit->text(); QString prefix = lengthEdit->text(); QString gateWay = gateWayEdit->text(); - setting.ipv6AddressConstruct(ipv6address, prefix, gateWay, dnsList); + setting.ipv6AddressConstruct(ipv6address, prefix, gateWay); setting.dumpInfo(); isChanged = true; } @@ -163,14 +151,6 @@ void Ipv6Page::initComponent() { connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); -// connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); -// connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); - connect(m_dnsWidget, &MultipleDnsWidget::dnsTextChanged, this, [=]() { - setIpv6PageState(false); - }); - connect(m_dnsWidget, &MultipleDnsWidget::dnsEditingFinished, this, [=]() { - setIpv6PageState(true); - }); } void Ipv6Page::configChanged(int index) { @@ -187,16 +167,12 @@ void Ipv6Page::setControlEnabled(bool check) ipv6AddressEdit->setEnabled(check); lengthEdit->setEnabled(check); gateWayEdit->setEnabled(check); - m_dnsWidget->setEditEnabled(check); -// firstDnsEdit->setEnabled(check); -// secondDnsEdit->setEnabled(check); + if (!check) { ipv6AddressEdit->clear(); lengthEdit->clear(); gateWayEdit->clear(); -// firstDnsEdit->clear(); -// secondDnsEdit->clear(); } } diff --git a/src/frontend/netdetails/multiplednswidget.cpp b/src/frontend/netdetails/multiplednswidget.cpp index 55aca598..398838e0 100644 --- a/src/frontend/netdetails/multiplednswidget.cpp +++ b/src/frontend/netdetails/multiplednswidget.cpp @@ -86,8 +86,6 @@ void MultipleDnsWidget::initComponent() item->setFlags(item->flags() | Qt::ItemIsEditable); ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp); m_dnsListWidget ->setItemDelegateForRow(m_dnsListWidget->currentIndex().row(), dnsListItemEdit); - connect(dnsListItemEdit, SIGNAL(textChanged(QString)), this, SIGNAL(dnsTextChanged(QString))); - connect(dnsListItemEdit, SIGNAL(editingFinished()), this, SIGNAL(dnsEditingFinished())); }); } @@ -110,7 +108,7 @@ QList MultipleDnsWidget::getDns() const QString aDns; while (m_dnsListWidget->count() > row) { aDns = m_dnsListWidget->item(row)->text(); - if (!dnsList.contains(aDns)) { + if (!dnsList.contains(aDns) && !aDns.isEmpty()) { dnsList << aDns; ipv4dnsList << QHostAddress(aDns); } @@ -140,9 +138,6 @@ void MultipleDnsWidget::AddOneDnsItem(QListWidget *listWidget) ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp); listWidget->setItemDelegateForRow(listWidget->currentIndex().row() , dnsListItemEdit); listWidget->editItem(dnsListWidgetItem); - - connect(dnsListItemEdit, SIGNAL(textChanged(QString)), this, SIGNAL(dnsTextChanged(QString))); - connect(dnsListItemEdit, SIGNAL(editingFinished()), this, SIGNAL(dnsEditingFinished())); } void MultipleDnsWidget::RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *listWidget) @@ -164,15 +159,18 @@ void MultipleDnsWidget::setDnsListWidgetStyle() void MultipleDnsWidget::onAddBtnClicked() { - //避免重复添加空白项 - if (m_dnsListWidget->currentItem()) { - if (m_dnsListWidget->currentItem()->text().isEmpty()) { - m_dnsListWidget->removeItemWidget(m_dnsListWidget->currentItem()); - delete m_dnsListWidget->currentItem(); - } - } - AddOneDnsItem(m_dnsListWidget); + + //避免重复添加空白项 + int row = m_dnsListWidget->count() - 1; + while (row >= 0) { + if (!m_dnsListWidget->item(row)->isSelected() + && m_dnsListWidget->item(row)->text().isEmpty()) { + m_dnsListWidget->removeItemWidget(m_dnsListWidget->item(row)); + delete m_dnsListWidget->item(row); + } + row --; + } m_removeDnsBtn->setEnabled(true); } diff --git a/src/frontend/netdetails/multiplednswidget.h b/src/frontend/netdetails/multiplednswidget.h index 8a4ef1c4..92dc9c1a 100644 --- a/src/frontend/netdetails/multiplednswidget.h +++ b/src/frontend/netdetails/multiplednswidget.h @@ -62,9 +62,6 @@ private Q_SLOTS: void onAddBtnClicked(); void onRemoveBtnClicked(); -Q_SIGNALS: - void dnsTextChanged(const QString &); - void dnsEditingFinished(); }; #endif // MULTIPLEDNSWIDGET_H diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 2622e80e..3632a8fd 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -363,28 +363,20 @@ void NetDetail::pagePadding(QString netName, bool isWlan) detailPage->setAutoConnect(m_info.isAutoConnect); //ipv4页面填充 + ipv4Page->setIpv4Config(m_info.ipv4ConfigType); + ipv4Page->setMulDns(m_info.ipv4DnsList); if (m_info.ipv4ConfigType == CONFIG_IP_MANUAL) { - ipv4Page->setIpv4Config(m_info.ipv4ConfigType); ipv4Page->setIpv4(m_info.strIPV4Address); ipv4Page->setNetMask(m_info.strIPV4NetMask); -// ipv4Page->setIpv4FirDns(m_info.strIPV4FirDns); -// ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns); - ipv4Page->setMulDns(m_info.ipv4DnsList); ipv4Page->setGateWay(m_info.strIPV4GateWay); - } else { - ipv4Page->setIpv4Config(m_info.ipv4ConfigType); } //ipv6页面填充 + ipv6Page->setIpv6Config(m_info.ipv6ConfigType); + ipv6Page->setMulDns(m_info.ipv6DnsList); if (m_info.ipv6ConfigType == CONFIG_IP_MANUAL) { - ipv6Page->setIpv6Config(m_info.ipv6ConfigType); ipv6Page->setIpv6(m_info.strIPV6Address); ipv6Page->setIpv6Perfix(m_info.iIPV6Prefix); -// ipv6Page->setIpv6FirDns(m_info.strIPV6FirDns); -// ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns); - ipv6Page->setMulDns(m_info.ipv6DnsList); ipv6Page->setGateWay(m_info.strIPV6GateWay); - } else { - ipv6Page->setIpv6Config(m_info.ipv6ConfigType); } //安全页面 @@ -554,14 +546,25 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived) conInfo.iIPV6Prefix = ipv6Page->getPerfixLength(connetSetting.m_ipv6Address.at(0).netmask().toString()); conInfo.strIPV6GateWay = connetSetting.m_ipv6Address.at(0).gateway().toString(); } + } - conInfo.ipv6DnsList = connetSetting.m_ipv6Dns; + conInfo.ipv4DnsList = connetSetting.m_ipv4Dns; + conInfo.ipv6DnsList = connetSetting.m_ipv6Dns; + QString dnsList; + dnsList.clear(); + if (!conInfo.ipv4DnsList.isEmpty()) { + for (QHostAddress str: conInfo.ipv4DnsList) { + dnsList.append(str.toString()); + dnsList.append("; "); + } + dnsList.chop(2); + conInfo.strDynamicIpv4Dns = dnsList; } if (!bActived) { conInfo.strDynamicIpv4 = conInfo.strIPV4Address.isEmpty() ? tr("Auto") : conInfo.strIPV4Address; conInfo.strDynamicIpv6 = conInfo.strIPV6Address.isEmpty() ? tr("Auto") : conInfo.strIPV6Address; - conInfo.strDynamicIpv4Dns = conInfo.ipv4DnsList.isEmpty() ? tr("Auto") : conInfo.ipv4DnsList.at(0).toString(); + conInfo.strDynamicIpv4Dns = conInfo.ipv4DnsList.isEmpty() ? tr("Auto") : conInfo.strDynamicIpv4Dns; } } diff --git a/src/frontend/tools/listitemedit.cpp b/src/frontend/tools/listitemedit.cpp index af232060..4d47a2d0 100644 --- a/src/frontend/tools/listitemedit.cpp +++ b/src/frontend/tools/listitemedit.cpp @@ -30,8 +30,6 @@ QWidget *ListItemEdit::createEditor(QWidget *parent, const QStyleOptionViewItem { QLineEdit *editor = new QLineEdit(parent); editor->setValidator(new QRegExpValidator(m_regExp, parent)); - connect(editor, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString))); - connect(editor, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); return editor; } diff --git a/src/frontend/tools/listitemedit.h b/src/frontend/tools/listitemedit.h index e6614099..901b51a6 100644 --- a/src/frontend/tools/listitemedit.h +++ b/src/frontend/tools/listitemedit.h @@ -44,9 +44,6 @@ public: private: QRegExp m_regExp; -Q_SIGNALS: - void textChanged(const QString &); - void editingFinished(); }; #endif // LISTITEMEDIT_H