533 lines
22 KiB
Diff
533 lines
22 KiB
Diff
From 4b63a44d04c18418076fe7570887e601b499671c Mon Sep 17 00:00:00 2001
|
||
From: luoqing <luoqing@kylinsec.com.cn>
|
||
Date: Tue, 23 Aug 2022 09:19:05 +0800
|
||
Subject: [PATCH 4/7] fix(network):Add error prompt box when saving
|
||
configuration
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
- 保存配置时,增加错误提示框
|
||
|
||
Close #I5GYQD
|
||
---
|
||
.../src/plugin/manager/wired-manager.cpp | 2 +
|
||
.../setting-widget/connection-name-widget.cpp | 16 ++-
|
||
.../plugin/setting-widget/ethernet-widget.cpp | 27 +++--
|
||
.../src/plugin/setting-widget/ipv4-widget.cpp | 105 ++++++++++++++----
|
||
.../src/plugin/setting-widget/ipv6-widget.cpp | 62 +++++++++--
|
||
.../src/plugin/settings/setting-page.cpp | 10 +-
|
||
.../plugin/settings/wired-setting-page.cpp | 7 +-
|
||
7 files changed, 180 insertions(+), 49 deletions(-)
|
||
|
||
diff --git a/plugins/network/src/plugin/manager/wired-manager.cpp b/plugins/network/src/plugin/manager/wired-manager.cpp
|
||
index cfd11b2..9ceeb89 100644
|
||
--- a/plugins/network/src/plugin/manager/wired-manager.cpp
|
||
+++ b/plugins/network/src/plugin/manager/wired-manager.cpp
|
||
@@ -180,7 +180,9 @@ void WiredManager::handleSaveButtonClicked()
|
||
handleReturnPreviousPage();
|
||
}
|
||
else
|
||
+ {
|
||
KLOG_DEBUG() << "Invalid input exists";
|
||
+ }
|
||
}
|
||
|
||
void WiredManager::handleConnectionUpdated(const QString &path)
|
||
diff --git a/plugins/network/src/plugin/setting-widget/connection-name-widget.cpp b/plugins/network/src/plugin/setting-widget/connection-name-widget.cpp
|
||
index 71b3626..5ee8b62 100644
|
||
--- a/plugins/network/src/plugin/setting-widget/connection-name-widget.cpp
|
||
+++ b/plugins/network/src/plugin/setting-widget/connection-name-widget.cpp
|
||
@@ -13,6 +13,7 @@
|
||
*/
|
||
|
||
#include "connection-name-widget.h"
|
||
+#include <kiran-message-box.h>
|
||
#include <kiran-switch-button.h>
|
||
#include <qt5-log-i.h>
|
||
#include <NetworkManagerQt/Connection>
|
||
@@ -82,7 +83,7 @@ void ConnectionNameWidget::showSettings(ConnectionSettings::ConnectionType conne
|
||
}
|
||
else if (m_connectionType == ConnectionSettings::Wireless)
|
||
{
|
||
- if(m_connectionSettings != nullptr)
|
||
+ if (m_connectionSettings != nullptr)
|
||
{
|
||
WirelessSetting::Ptr wirelessSetting = m_connectionSettings->setting(Setting::Wireless).dynamicCast<WirelessSetting>();
|
||
ui->connectionName->setText(wirelessSetting->ssid());
|
||
@@ -91,8 +92,8 @@ void ConnectionNameWidget::showSettings(ConnectionSettings::ConnectionType conne
|
||
}
|
||
else
|
||
{
|
||
-// ui->connectionName->setEnabled(true);
|
||
-// m_autoConnection->setChecked(true);
|
||
+ // ui->connectionName->setEnabled(true);
|
||
+ // m_autoConnection->setChecked(true);
|
||
}
|
||
}
|
||
}
|
||
@@ -173,11 +174,16 @@ void ConnectionNameWidget::clearPtr()
|
||
|
||
bool ConnectionNameWidget::isInputValid()
|
||
{
|
||
- bool valid = true;
|
||
QString nameStr = ui->connectionName->text();
|
||
if (nameStr.isEmpty())
|
||
{
|
||
+ QString error = QString(tr("Connection name can not be empty"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+
|
||
+ KLOG_DEBUG() << "Connection name cannot be empty";
|
||
return false;
|
||
}
|
||
- return valid;
|
||
+ return true;
|
||
}
|
||
\ No newline at end of file
|
||
diff --git a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
||
index 55c5cd8..ae43125 100644
|
||
--- a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
||
+++ b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
||
@@ -13,11 +13,13 @@
|
||
*/
|
||
|
||
#include "ethernet-widget.h"
|
||
+#include <kiran-message-box.h>
|
||
#include <kiran-switch-button.h>
|
||
#include <qt5-log-i.h>
|
||
#include <NetworkManagerQt/Manager>
|
||
#include <NetworkManagerQt/WiredDevice>
|
||
#include "ui_ethernet-widget.h"
|
||
+
|
||
using namespace NetworkManager;
|
||
|
||
EthernetWidget::EthernetWidget(QWidget *parent) : QWidget(parent), ui(new Ui::EthernetWidget)
|
||
@@ -38,7 +40,7 @@ void EthernetWidget::initUI()
|
||
ui->customMTU->setVisible(false);
|
||
ui->customMTU->setMinimum(0);
|
||
ui->customMTU->setMaximum(10000);
|
||
- //UserData设为空"",为了匹配Mac地址为空的情况
|
||
+ // UserData设为空"",为了匹配Mac地址为空的情况
|
||
ui->deviceMac->addItem(tr("No device specified"), "");
|
||
initEthernetMacComboBox();
|
||
}
|
||
@@ -75,7 +77,7 @@ void EthernetWidget::setWiredSetting(const WiredSetting::Ptr &wiredSetting)
|
||
|
||
void EthernetWidget::saveSettings()
|
||
{
|
||
- if(m_wiredSetting != nullptr)
|
||
+ if (m_wiredSetting != nullptr)
|
||
{
|
||
QString macAddress = ui->deviceMac->currentData().toString();
|
||
QString cloneMac = ui->cloneDeviceMac->text();
|
||
@@ -89,7 +91,7 @@ void EthernetWidget::saveSettings()
|
||
|
||
void EthernetWidget::showSettings()
|
||
{
|
||
- if(m_wiredSetting != nullptr)
|
||
+ if (m_wiredSetting != nullptr)
|
||
{
|
||
QString deviceMac = m_wiredSetting->macAddress().toHex(':').toUpper();
|
||
QString cloneDeviceMac = m_wiredSetting->clonedMacAddress().toHex(':').toUpper();
|
||
@@ -132,15 +134,26 @@ void EthernetWidget::clearPtr()
|
||
|
||
bool EthernetWidget::isInputValid()
|
||
{
|
||
- isCloneMacValid(ui->cloneDeviceMac->text());
|
||
- return false;
|
||
+ if (!isCloneMacValid(ui->cloneDeviceMac->text()))
|
||
+ {
|
||
+ QString error = QString(tr("Clone Mac invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+
|
||
+ KLOG_DEBUG() << "Clone Mac invalid";
|
||
+ return false;
|
||
+ }
|
||
+ return true;
|
||
}
|
||
|
||
bool EthernetWidget::isCloneMacValid(const QString &cloneMac)
|
||
{
|
||
- if (cloneMac.isEmpty()) {
|
||
+ if (cloneMac.isEmpty())
|
||
+ {
|
||
return true;
|
||
}
|
||
- bool matched = QRegExp("^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$").exactMatch(cloneMac);
|
||
+ bool matched = QRegExp("^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$").exactMatch(cloneMac);
|
||
+
|
||
return matched;
|
||
}
|
||
diff --git a/plugins/network/src/plugin/setting-widget/ipv4-widget.cpp b/plugins/network/src/plugin/setting-widget/ipv4-widget.cpp
|
||
index 30f7844..7f28576 100644
|
||
--- a/plugins/network/src/plugin/setting-widget/ipv4-widget.cpp
|
||
+++ b/plugins/network/src/plugin/setting-widget/ipv4-widget.cpp
|
||
@@ -13,6 +13,7 @@
|
||
*/
|
||
|
||
#include "ipv4-widget.h"
|
||
+#include <kiran-message-box.h>
|
||
#include <kiran-switch-button.h>
|
||
#include <qt5-log-i.h>
|
||
#include "ui_ipv4-widget.h"
|
||
@@ -65,7 +66,6 @@ void Ipv4Widget::setIpv4Setting(const Ipv4Setting::Ptr &ipv4Setting)
|
||
m_ipv4Setting = ipv4Setting;
|
||
}
|
||
|
||
-// TODO:错误提示弹窗
|
||
void Ipv4Widget::saveSettings()
|
||
{
|
||
if (m_ipv4Setting != nullptr)
|
||
@@ -85,7 +85,6 @@ void Ipv4Widget::saveSettings()
|
||
m_ipv4Setting->setMethod(method);
|
||
|
||
ipv4Address.setIp(QHostAddress(ui->ipv4Address->text()));
|
||
- // XXX:输入合法性检测
|
||
QString netMask = ui->ipv4Netmask->text();
|
||
if (!netMask.contains("."))
|
||
{
|
||
@@ -134,8 +133,11 @@ void Ipv4Widget::showSettings()
|
||
{
|
||
if (m_ipv4Setting != nullptr)
|
||
{
|
||
+ KLOG_DEBUG() << "m_ipv4Setting->method():" << m_ipv4Setting->method();
|
||
+
|
||
if (m_ipv4Setting->method() == Ipv4Setting::ConfigMethod::Automatic)
|
||
{
|
||
+ KLOG_DEBUG() << "Ipv4Setting::ConfigMethod::Automatic";
|
||
resetSettings();
|
||
}
|
||
else if (m_ipv4Setting->method() == Ipv4Setting::ConfigMethod::Manual)
|
||
@@ -143,11 +145,15 @@ void Ipv4Widget::showSettings()
|
||
int ipv4MethodIndex = ui->ipv4Method->findData(m_ipv4Setting->method());
|
||
ui->ipv4Method->setCurrentIndex(ipv4MethodIndex);
|
||
// xxx:取addresses的方式有待改进
|
||
- IpAddress ipv4Address = m_ipv4Setting->addresses().at(0);
|
||
+ IpAddress ipv4Address = m_ipv4Setting->addresses().value(0);
|
||
QString address = ipv4Address.ip().toString();
|
||
QString netmask = ipv4Address.netmask().toString();
|
||
QString gateway = ipv4Address.gateway().toString();
|
||
|
||
+ KLOG_DEBUG() << "address:" << address;
|
||
+ KLOG_DEBUG() << "netmask:" << netmask;
|
||
+ KLOG_DEBUG() << "gateway:" << gateway;
|
||
+
|
||
ui->ipv4Address->setText(address);
|
||
ui->ipv4Netmask->setText(netmask);
|
||
ui->ipv4Gateway->setText(gateway);
|
||
@@ -188,57 +194,108 @@ void Ipv4Widget::clearPtr()
|
||
}
|
||
|
||
// TODO:验证功能待完善
|
||
+// XXX:输入验证提示暂时先用弹框,之后修改
|
||
bool Ipv4Widget::isInputValid()
|
||
{
|
||
Ipv4Setting::ConfigMethod configMethod = ui->ipv4Method->currentData().value<Ipv4Setting::ConfigMethod>();
|
||
- bool valid = true;
|
||
+
|
||
if (configMethod == Ipv4Setting::ConfigMethod::Automatic)
|
||
{
|
||
- isIpv4AddressValid(ui->ipv4PreferredDNS->text());
|
||
- isIpv4AddressValid(ui->ipv4AlternateDNS->text());
|
||
}
|
||
else if (configMethod == Ipv4Setting::ConfigMethod::Manual)
|
||
{
|
||
- QString ipv4 = ui->ipv4Address->text();
|
||
- QString netMask = ui->ipv4Netmask->text();
|
||
+ QString ipv4 = ui->ipv4Address->text();
|
||
+ QString netMask = ui->ipv4Netmask->text();
|
||
+ QString ipv4Gateway = ui->ipv4Gateway->text();
|
||
|
||
if (ipv4.isEmpty())
|
||
{
|
||
- valid = false;
|
||
- KLOG_DEBUG() << "Ipv4 address cannot be empty";
|
||
+ QString error = QString(tr("Ipv4 address can not be empty"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+
|
||
+ KLOG_DEBUG() << "Ipv4 address can not be empty";
|
||
+ return false;
|
||
}
|
||
else
|
||
{
|
||
- if(!isIpv4AddressValid(ipv4))
|
||
+ if (!isIpv4AddressValid(ipv4))
|
||
{
|
||
- valid = false;
|
||
- KLOG_DEBUG() << "Ipv4Address invalid";
|
||
+ QString error = QString(tr("Ipv4 Address invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv4 Address invalid";
|
||
+ return false;
|
||
}
|
||
}
|
||
-
|
||
+
|
||
if (netMask.isEmpty())
|
||
{
|
||
- valid = false;
|
||
+ QString error = QString(tr("NetMask can not be empty"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
KLOG_DEBUG() << "NetMask cannot be empty";
|
||
+ return false;
|
||
}
|
||
else
|
||
{
|
||
- if(!isIpv4NetmaskValid(netMask))
|
||
+ if (!isIpv4NetmaskValid(netMask))
|
||
{
|
||
- valid = false;
|
||
+ QString error = QString(tr("Netmask invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
KLOG_DEBUG() << "Netmask invalid";
|
||
+ return false;
|
||
}
|
||
}
|
||
|
||
- ui->ipv4Gateway->text();
|
||
- ui->ipv4PreferredDNS->text();
|
||
- ui->ipv4AlternateDNS->text();
|
||
- isIpv4AddressValid(ui->ipv4Gateway->text());
|
||
- isIpv4AddressValid(ui->ipv4PreferredDNS->text());
|
||
- isIpv4AddressValid(ui->ipv4AlternateDNS->text());
|
||
+ if (!ipv4Gateway.isEmpty())
|
||
+ {
|
||
+ if (!isIpv4AddressValid(ipv4Gateway))
|
||
+ {
|
||
+ QString error = QString(tr("Ipv4 Gateway invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv4 Netmask invalid";
|
||
+ return false;
|
||
+ }
|
||
+ }
|
||
+ }
|
||
|
||
+ QString preferredDNS = ui->ipv4PreferredDNS->text();
|
||
+ if (!preferredDNS.isEmpty())
|
||
+ {
|
||
+ if (!isIpv4AddressValid(preferredDNS))
|
||
+ {
|
||
+ QString error = QString(tr("Ipv4 Preferred DNS invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv4 Preferred DNS invalid";
|
||
+ return false;
|
||
+ }
|
||
}
|
||
- return valid;
|
||
+
|
||
+ QString alternateDNS = ui->ipv4AlternateDNS->text();
|
||
+ if (!alternateDNS.isEmpty())
|
||
+ {
|
||
+ if (!isIpv4AddressValid(alternateDNS))
|
||
+ {
|
||
+ QString error = QString(tr("Ipv4 Alternate DNS invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv4 Alternate DNS invalid";
|
||
+ return false;
|
||
+ }
|
||
+ }
|
||
+
|
||
+ return true;
|
||
}
|
||
|
||
bool Ipv4Widget::isIpv4AddressValid(const QString &address)
|
||
diff --git a/plugins/network/src/plugin/setting-widget/ipv6-widget.cpp b/plugins/network/src/plugin/setting-widget/ipv6-widget.cpp
|
||
index a703f95..a9f1676 100644
|
||
--- a/plugins/network/src/plugin/setting-widget/ipv6-widget.cpp
|
||
+++ b/plugins/network/src/plugin/setting-widget/ipv6-widget.cpp
|
||
@@ -13,6 +13,7 @@
|
||
*/
|
||
|
||
#include "ipv6-widget.h"
|
||
+#include <kiran-message-box.h>
|
||
#include <qt5-log-i.h>
|
||
#include "ui_ipv6-widget.h"
|
||
using namespace NetworkManager;
|
||
@@ -177,7 +178,7 @@ void Ipv6Widget::clearPtr()
|
||
bool Ipv6Widget::isInputValid()
|
||
{
|
||
Ipv6Setting::ConfigMethod configMethod = ui->ipv6Method->currentData().value<Ipv6Setting::ConfigMethod>();
|
||
- bool valid = true;
|
||
+
|
||
if (configMethod == Ipv6Setting::ConfigMethod::Ignored)
|
||
{
|
||
}
|
||
@@ -189,24 +190,71 @@ bool Ipv6Widget::isInputValid()
|
||
QString ipv6 = ui->ipv6Address->text();
|
||
if (ipv6.isEmpty())
|
||
{
|
||
- valid = false;
|
||
+ QString error = QString(tr("Ipv6 address can not be empty"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+
|
||
KLOG_DEBUG() << "Ipv6 Address cannot be empty";
|
||
+ return false;
|
||
}
|
||
else
|
||
{
|
||
if (!isIpv6AddressValid(ipv6))
|
||
{
|
||
- valid = false;
|
||
+ QString error = QString(tr("Ipv6 address invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
KLOG_DEBUG() << "Ipv6Address invalid";
|
||
+ return false;
|
||
}
|
||
}
|
||
|
||
- isIpv6AddressValid(ui->ipv6Gateway->text());
|
||
- isIpv6AddressValid(ui->ipv6AlternateDNS->text());
|
||
- isIpv6AddressValid(ui->ipv6PreferredDNS->text());
|
||
+ QString ipv6Gateway = ui->ipv6Gateway->text();
|
||
+ if (!ipv6Gateway.isEmpty())
|
||
+ {
|
||
+ if (!isIpv6AddressValid(ipv6Gateway))
|
||
+ {
|
||
+ QString error = QString(tr("Ipv6 Gateway invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv6 Netmask invalid";
|
||
+ return false;
|
||
+ }
|
||
+ }
|
||
}
|
||
|
||
- return valid;
|
||
+ QString preferredDNS = ui->ipv6PreferredDNS->text();
|
||
+ if (!preferredDNS.isEmpty())
|
||
+ {
|
||
+ if (!isIpv6AddressValid(preferredDNS))
|
||
+ {
|
||
+ QString error = QString(tr("Ipv6 Preferred DNS invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv6 Preferred DNS invalid";
|
||
+ return false;
|
||
+ }
|
||
+ }
|
||
+
|
||
+ QString alternateDNS = ui->ipv6AlternateDNS->text();
|
||
+ if (!alternateDNS.isEmpty())
|
||
+ {
|
||
+ if (!isIpv6AddressValid(alternateDNS))
|
||
+ {
|
||
+ QString error = QString(tr("Ipv6 Alternate DNS invalid"));
|
||
+ KiranMessageBox::KiranStandardButton btn = KiranMessageBox::message(this, tr("Error"),
|
||
+ error,
|
||
+ KiranMessageBox::Yes | KiranMessageBox::No);
|
||
+ KLOG_DEBUG() << "Ipv6 Alternate DNS invalid";
|
||
+ return false;
|
||
+ }
|
||
+ }
|
||
+
|
||
+ return true;
|
||
}
|
||
|
||
bool Ipv6Widget::isIpv6AddressValid(const QString &address)
|
||
diff --git a/plugins/network/src/plugin/settings/setting-page.cpp b/plugins/network/src/plugin/settings/setting-page.cpp
|
||
index 241f46c..dd84209 100644
|
||
--- a/plugins/network/src/plugin/settings/setting-page.cpp
|
||
+++ b/plugins/network/src/plugin/settings/setting-page.cpp
|
||
@@ -76,11 +76,12 @@ void SettingPage::setConnectionSettings(const ConnectionSettings::Ptr& other)
|
||
|
||
void SettingPage::handleSaveButtonClicked(ConnectionSettings::ConnectionType connectionType)
|
||
{
|
||
- if(m_connectionSettings == nullptr)
|
||
+ if (m_connectionSettings == nullptr)
|
||
{
|
||
initConnectionSettings(connectionType);
|
||
initSettingPage();
|
||
saveSettingPage();
|
||
+ KLOG_DEBUG() << " m_connectionSettings->toMap():" << m_connectionSettings->toMap();
|
||
QDBusPendingReply<QDBusObjectPath> replyAdd = NetworkManager::addConnection(m_connectionSettings->toMap());
|
||
replyAdd.waitForFinished();
|
||
if (replyAdd.isError())
|
||
@@ -88,13 +89,16 @@ void SettingPage::handleSaveButtonClicked(ConnectionSettings::ConnectionType con
|
||
KLOG_DEBUG() << "add connection failed," << replyAdd.error();
|
||
}
|
||
else
|
||
- KLOG_DEBUG() << "add new connection";
|
||
+ {
|
||
+ KLOG_DEBUG() << "add new connection reply:" << replyAdd.reply();
|
||
+ }
|
||
}
|
||
else
|
||
{
|
||
saveSettingPage();
|
||
//只有无线网络使用自定义settingUpdated信号,因为未连接无线网络前不存在本地Setting,无法在初始化时监听信号
|
||
- connect(m_connection.data(),&NetworkManager::Connection::updated,this,&SettingPage::settingUpdated,Qt::UniqueConnection);
|
||
+ connect(m_connection.data(), &NetworkManager::Connection::updated, this, &SettingPage::settingUpdated, Qt::UniqueConnection);
|
||
+ KLOG_DEBUG() << "m_connectionSettings->toMap():" << m_connectionSettings->toMap();
|
||
QDBusPendingReply<> replyUpdate = m_connection->update(m_connectionSettings->toMap());
|
||
replyUpdate.waitForFinished();
|
||
if (replyUpdate.isError())
|
||
diff --git a/plugins/network/src/plugin/settings/wired-setting-page.cpp b/plugins/network/src/plugin/settings/wired-setting-page.cpp
|
||
index 86ec372..4466468 100644
|
||
--- a/plugins/network/src/plugin/settings/wired-setting-page.cpp
|
||
+++ b/plugins/network/src/plugin/settings/wired-setting-page.cpp
|
||
@@ -20,18 +20,17 @@
|
||
#include <NetworkManagerQt/Manager>
|
||
#include <NetworkManagerQt/Settings>
|
||
#include "ui_wired-setting-page.h"
|
||
+
|
||
using namespace NetworkManager;
|
||
|
||
WiredSettingPage::WiredSettingPage(QWidget *parent) : SettingPage(parent), ui(new Ui::WiredSettingPage)
|
||
{
|
||
ui->setupUi(this);
|
||
initConnecton();
|
||
- KLOG_DEBUG() << "WiredSettingPage::WiredSettingPage(QWidget *parent)";
|
||
}
|
||
|
||
WiredSettingPage::~WiredSettingPage()
|
||
{
|
||
- KLOG_DEBUG() << "WiredSettingPage::~WiredSettingPage()";
|
||
delete ui;
|
||
}
|
||
|
||
@@ -54,6 +53,7 @@ void WiredSettingPage::initSpecificSettings()
|
||
m_wiredSetting = m_connectionSettings->setting(Setting::SettingType::Wired).dynamicCast<WiredSetting>();
|
||
}
|
||
|
||
+// TODO:修改命名
|
||
void WiredSettingPage::initWidgets()
|
||
{
|
||
ui->connectionNameWidget->setConnectionSettings(m_connectionSettings);
|
||
@@ -109,7 +109,8 @@ void WiredSettingPage::clearPtr()
|
||
|
||
bool WiredSettingPage::isInputValid()
|
||
{
|
||
- if (ui->ipv4Widget->isInputValid() && ui->ipv6Widget->isInputValid() && ui->connectionNameWidget->isInputValid())
|
||
+ if (ui->ipv4Widget->isInputValid() && ui->ipv6Widget->isInputValid() &&
|
||
+ ui->connectionNameWidget->isInputValid() && ui->ethernetWidget->isInputValid())
|
||
return true;
|
||
else
|
||
return false;
|
||
--
|
||
2.33.0
|
||
|