diff --git a/0001-fix-network-fix-the-self-test-defect-v-p-n.patch b/0001-fix-network-fix-the-self-test-defect-v-p-n.patch new file mode 100644 index 0000000000000000000000000000000000000000..f88a694fb7298cfe8576701c0a752a6470da092c --- /dev/null +++ b/0001-fix-network-fix-the-self-test-defect-v-p-n.patch @@ -0,0 +1,1102 @@ +From 391a0f856549f6f6e74ee9eeff1db8361fa641ad Mon Sep 17 00:00:00 2001 +From: luoqing +Date: Tue, 6 Sep 2022 18:57:13 +0800 +Subject: [PATCH] fix(network):fix the self-test defect v-p-n +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复v-p-n的自测缺陷 +--- + plugins/network/src/connection-lists.cpp | 4 +- + .../src/plugin/manager/vpn-manager.cpp | 146 ++++++++++------ + .../network/src/plugin/manager/vpn-manager.h | 7 +- + .../plugin/setting-widget/vpn/vpn-ipsec.cpp | 43 ++++- + .../src/plugin/setting-widget/vpn/vpn-ipsec.h | 9 +- + .../plugin/setting-widget/vpn/vpn-ipsec.ui | 45 +++-- + .../plugin/setting-widget/vpn/vpn-widget.cpp | 52 +++++- + .../plugin/setting-widget/vpn/vpn-widget.h | 3 + + .../plugin/setting-widget/vpn/vpn-widget.ui | 2 +- + .../plugin/settings/vpn/vpn-l2tp-setting.cpp | 4 + + .../kiran-cpanel-network.zh_CN.ts | 161 ++++++++---------- + 11 files changed, 310 insertions(+), 166 deletions(-) + +diff --git a/plugins/network/src/connection-lists.cpp b/plugins/network/src/connection-lists.cpp +index 1772379..5745953 100644 +--- a/plugins/network/src/connection-lists.cpp ++++ b/plugins/network/src/connection-lists.cpp +@@ -177,6 +177,7 @@ void ConnectionLists::showConnectionLists(ConnectionSettings::ConnectionType typ + } + + // TODO:优化代码 ++// Note:vpn connection 的devicePath目前暂时置为空 + void ConnectionLists::addConnectionToLists(Connection::Ptr ptr, const QString& devicePath) + { + if (ptr == nullptr) +@@ -213,7 +214,8 @@ void ConnectionLists::addConnectionToLists(Connection::Ptr ptr, const QString& d + for (ActiveConnection::Ptr activeConnection : activeConnectionList) + { + QStringList deviceList = activeConnection->devices(); +- if (activeConnection->uuid() == ptr->uuid() && deviceList.contains(devicePath)) ++ if (activeConnection->uuid() == ptr->uuid() && ++ (deviceList.contains(devicePath) || devicePath.isEmpty())) + { + connectionInfo.activeConnectionPath = activeConnection->path(); + switch (activeConnection->state()) +diff --git a/plugins/network/src/plugin/manager/vpn-manager.cpp b/plugins/network/src/plugin/manager/vpn-manager.cpp +index 8573610..40a3b56 100644 +--- a/plugins/network/src/plugin/manager/vpn-manager.cpp ++++ b/plugins/network/src/plugin/manager/vpn-manager.cpp +@@ -91,37 +91,9 @@ void VpnManager::initConnection() + connect(ui->l2tpSetting, &VpnL2tpSetting::returnPreviousPage, this, &VpnManager::handleReturnPreviousPage); + connect(ui->pptpSetting, &VpnPptpSetting::returnPreviousPage, this, &VpnManager::handleReturnPreviousPage); + +- connect(ui->saveButton, &QPushButton::clicked, this, [this]() +- { +- int index = ui->vpnTypeStacked->currentIndex(); +- switch (index) +- { +- case VPN_TYPE_L2TP: +- if(ui->l2tpSetting->isInputValid()) +- { +- ui->l2tpSetting->handleSaveButtonClicked(ConnectionSettings::ConnectionType::Vpn); +- handleReturnPreviousPage(); +- } +- break; +- case VPN_TYPE_PPTP: +- if(ui->pptpSetting->isInputValid()) +- { +- ui->pptpSetting->handleSaveButtonClicked(ConnectionSettings::ConnectionType::Vpn); +- handleReturnPreviousPage(); +- } +- break; +- default: +- break; +- } }); +- +- connect(ui->connectionShowPage, &ConnectionShowPage::connectionUpdated, this, [this](const QString &path) +- { +- KLOG_DEBUG() << "Connection::updated:" << path; +- //移除后再加载进来以更新信息 +- ui->connectionShowPage->removeConnectionFromLists(path); +- Connection::Ptr updateConnection = findConnection(path); +- ui->connectionShowPage->addConnectionToLists(updateConnection,""); +- handleReturnPreviousPage(); }); ++ connect(ui->saveButton, &QPushButton::clicked, this, &VpnManager::handleSaveButtonClicked); ++ ++ connect(ui->connectionShowPage, &ConnectionShowPage::connectionUpdated, this, &VpnManager::handleConnectionUpdated); + + initNotifierConnection(); + } +@@ -143,7 +115,7 @@ void VpnManager::handleRequestEditConnection(const QString &uuid, QString active + ui->l2tpSetting->setConnectionSettings(connectionSettings); + + ui->l2tpSetting->initSettingPage(); +- ui->l2tpSetting->showSettingPage(); ++ ui->l2tpSetting->showSettingPage(activeConnectionPath); + } + else if (serviceType.contains("pptp")) + { +@@ -152,7 +124,7 @@ void VpnManager::handleRequestEditConnection(const QString &uuid, QString active + ui->pptpSetting->setConnectionSettings(connectionSettings); + + ui->pptpSetting->initSettingPage(); +- ui->pptpSetting->showSettingPage(); ++ ui->pptpSetting->showSettingPage(activeConnectionPath); + } + else + { +@@ -164,7 +136,32 @@ void VpnManager::handleRequestEditConnection(const QString &uuid, QString active + ui->stackedWidget->setCurrentIndex(PAGE_SETTING); + } + ++void VpnManager::handleSaveButtonClicked() ++{ ++ int index = ui->vpnTypeStacked->currentIndex(); ++ switch (index) ++ { ++ case VPN_TYPE_L2TP: ++ if (ui->l2tpSetting->isInputValid()) ++ { ++ ui->l2tpSetting->handleSaveButtonClicked(ConnectionSettings::ConnectionType::Vpn); ++ handleReturnPreviousPage(); ++ } ++ break; ++ case VPN_TYPE_PPTP: ++ if (ui->pptpSetting->isInputValid()) ++ { ++ ui->pptpSetting->handleSaveButtonClicked(ConnectionSettings::ConnectionType::Vpn); ++ handleReturnPreviousPage(); ++ } ++ break; ++ default: ++ break; ++ } ++} ++ + //考虑弹窗输入密码的情况 ++// TODO: AgentOwned的作用 + void VpnManager::handleRequestActivateConnection(const QString &connectionPath, const QString &connectionParameter) + { + Connection::Ptr connection = findConnection(connectionPath); +@@ -173,16 +170,25 @@ void VpnManager::handleRequestActivateConnection(const QString &connectionPath, + NMStringMap dataMap = vpnSetting->data(); + + int passwordFlags = dataMap.value("password-flags").toInt(); +- if (passwordFlags == Setting::SecretFlagType::None) ++ /** ++ * None - 已保存的 Save password for all users ++ * NotRequired - 不要求 ++ * NotSaved - 总是询问 ++ * AgentOwned - 暂时不使用,Save password for this user ++ */ ++ if (passwordFlags == Setting::SecretFlagType::None || passwordFlags == Setting::SecretFlagType::AgentOwned) + { + activateVPNConnection(connectionPath, connectionParameter); ++ KLOG_DEBUG() << "passwordFlags None"; + } + else if (passwordFlags == Setting::SecretFlagType::NotRequired) + { + activateVPNConnection(connectionPath, connectionParameter); ++ KLOG_DEBUG() << "passwordFlags NotRequired"; + } + else if (passwordFlags == Setting::SecretFlagType::NotSaved) + { ++ KLOG_DEBUG() << "passwordFlags NotSaved"; + TextInputDialog inputDialog; + inputDialog.setTitle(tr("Tips")); + QString tips = QString(tr("Password required to connect to %1.")).arg(settings->id()); +@@ -246,12 +252,13 @@ void VpnManager::handleActiveConnectionAdded(const QString &activePath) + QString uuid = vpnConnection->uuid(); + KLOG_DEBUG() << "vpn uuid:" << uuid; + QListWidgetItem *activeItem = ui->connectionShowPage->findItemByUuid(uuid); +- ui->connectionShowPage->updateItemActivatedPath(activeItem, activePath); +- connect(vpnConnection.data(), &VpnConnection::stateChanged, [=](VpnConnection::State state, VpnConnection::StateChangeReason reason) +- { handleVpnConnectionStateChanged(state, reason, activePath); }); +- //加载等待动画 +- auto item = ui->connectionShowPage->findItemByActivatedPath(activePath); +- ui->connectionShowPage->updateItemActivatingStatus(item); ++ KLOG_DEBUG() << "-----------activeItem:" << activeItem; ++ if (activeItem != nullptr) ++ { ++ KLOG_DEBUG() << "---------vpn updateItemActivatedPath"; ++ ui->connectionShowPage->updateItemActivatedPath(activeItem, activePath); ++ } ++ connect(vpnConnection.data(), &VpnConnection::stateChanged, this, &VpnManager::handleVpnConnectionStateChanged, Qt::UniqueConnection); + } + } + +@@ -260,13 +267,17 @@ void VpnManager::handleActiveConnectionRemoved(const QString &activePath) + } + + // TODO:若没有安装VPN插件则需要提示 +-void VpnManager::handleVpnConnectionStateChanged(VpnConnection::State state, VpnConnection::StateChangeReason reason, const QString &activePath) ++void VpnManager::handleVpnConnectionStateChanged(VpnConnection::State state, VpnConnection::StateChangeReason reason) + { +- auto activeConnection = findActiveConnection(activePath); +- KLOG_DEBUG() << " activeConnection->id():" << activeConnection->id(); ++ // auto activeConnection = findActiveConnection(activePath); ++ // auto activeConnection = qobject_cast(sender()); ++ ++ auto activeVpnConnection = qobject_cast(sender()); ++ QString activePath = activeVpnConnection->path(); ++ KLOG_DEBUG() << " activeConnection->id():" << activeVpnConnection->id(); + QString id = ""; +- if (activeConnection != nullptr) +- id = activeConnection->id(); ++ if (activeVpnConnection != nullptr) ++ id = activeVpnConnection->id(); + switch (state) + { + case VpnConnection::State::Unknown: +@@ -279,6 +290,7 @@ void VpnManager::handleVpnConnectionStateChanged(VpnConnection::State state, Vpn + KLOG_DEBUG() << "VpnConnection::State::NeedAuth"; + break; + case VpnConnection::State::Connecting: ++ handleStateActivating(activePath); + KLOG_DEBUG() << "VpnConnection::State::Connecting"; + break; + case VpnConnection::State::GettingIpConfig: +@@ -356,10 +368,30 @@ void VpnManager::handleVpnStateActivated(const QString &activePath) + { + ui->connectionShowPage->updateItemActivatedStatus(activePath); + auto item = ui->connectionShowPage->findItemByActivatedPath(activePath); +- NetworkConnectionInfo connectionInfo = item->data(Qt::UserRole).value(); +- StatusNotification::ActiveConnectionActivatedNotify(connectionInfo); ++ if (item != nullptr) ++ { ++ NetworkConnectionInfo connectionInfo = item->data(Qt::UserRole).value(); ++ StatusNotification::ActiveConnectionActivatedNotify(connectionInfo); ++ ui->connectionShowPage->update(); ++ } ++ } ++} ++ ++void VpnManager::handleStateActivating(const QString &activatedPath) ++{ ++ ActiveConnection::Ptr activatedConnection = findActiveConnection(activatedPath); ++ if (activatedConnection.isNull()) ++ return; + +- ui->connectionShowPage->update(); ++ if (activatedConnection->type() == ConnectionSettings::ConnectionType::Vpn) ++ { ++ // 加载等待动画 ++ auto item = ui->connectionShowPage->findItemByActivatedPath(activatedPath); ++ KLOG_DEBUG() << "item:" << item; ++ if (item != nullptr) ++ { ++ ui->connectionShowPage->updateItemActivatingStatus(item); ++ } + } + } + +@@ -394,3 +426,21 @@ void VpnManager::clearVpnSetting() + break; + } + } ++ ++// TODO:更新列表逻辑需要修改 ++void VpnManager::handleConnectionUpdated(const QString &path) ++{ ++ KLOG_DEBUG() << "Connection::updated:" << path; ++ Connection::Ptr updateConnection = findConnection(path); ++ if (updateConnection->settings()->connectionType() == ConnectionSettings::Vpn) ++ { ++ //移除后再加载进来以更新信息 ++ ui->connectionShowPage->removeConnectionFromLists(path); ++ ui->connectionShowPage->addConnectionToLists(updateConnection, ""); ++ if (ui->stackedWidget->currentIndex() == PAGE_SETTING) ++ { ++ } ++ else ++ handleReturnPreviousPage(); ++ } ++} +diff --git a/plugins/network/src/plugin/manager/vpn-manager.h b/plugins/network/src/plugin/manager/vpn-manager.h +index e3fd096..93e209b 100644 +--- a/plugins/network/src/plugin/manager/vpn-manager.h ++++ b/plugins/network/src/plugin/manager/vpn-manager.h +@@ -48,13 +48,18 @@ public slots: + void handleActiveConnectionAdded(const QString &activePath) override; + void handleActiveConnectionRemoved(const QString &activePath) override; + +- void handleVpnConnectionStateChanged(NetworkManager::VpnConnection::State state, NetworkManager::VpnConnection::StateChangeReason reason, const QString &activePath); ++ void handleVpnConnectionStateChanged(NetworkManager::VpnConnection::State state, NetworkManager::VpnConnection::StateChangeReason reason); + void handleVpnStateActivated(const QString &activePath); ++ void handleStateActivating(const QString &activatedPath) override; ++ + void handleVpnStateDisconnected(const QString &activePath); + void handleVpnStateFailed(const QString &activePath); + + void handleReturnPreviousPage(); + ++ void handleConnectionUpdated(const QString &path); ++ void handleSaveButtonClicked(); ++ + private: + Ui::VpnManager *ui; + }; +diff --git a/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.cpp b/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.cpp +index d51d9d5..b936014 100644 +--- a/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.cpp ++++ b/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.cpp +@@ -37,12 +37,16 @@ void VpnIPsec::initUI() + ui->enableIPsecLayout->addWidget(m_enableIPsec); + m_enableIPsec->setChecked(false); + ui->IPsecWidget->setVisible(false); ++ ui->preSharedKey->setEchoMode(QLineEdit::Password); ++ ui->passwordVisual->setVisible(true); + } + + void VpnIPsec::initConnection() + { +- connect(m_enableIPsec, &QAbstractButton::toggled, [=](bool checked) ++ connect(m_enableIPsec, &QAbstractButton::toggled, this, [this](bool checked) + { ui->IPsecWidget->setVisible(checked); }); ++ ++ connect(ui->passwordVisual, &QPushButton::clicked, this, &VpnIPsec::enablePasswordVisual); + } + + void VpnIPsec::setVpnSetting(const VpnSetting::Ptr &vpnSetting) +@@ -50,6 +54,11 @@ void VpnIPsec::setVpnSetting(const VpnSetting::Ptr &vpnSetting) + m_vpnSetting = vpnSetting; + } + ++void VpnIPsec::setConnectionPtr(const Connection::Ptr &connection) ++{ ++ m_connection = connection; ++} ++ + void VpnIPsec::saveSettings() + { + m_dataMap = m_vpnSetting->data(); +@@ -87,9 +96,27 @@ void VpnIPsec::showSettings() + + ui->groupName->setText(dataMap.value("ipsec-group-name")); + ui->groupId->setText(dataMap.value("ipsec-gateway-id")); +- ui->preSharedKey->setText(dataMap.value("ipsec-psk")); ++ // ui->preSharedKey->setText(dataMap.value("ipsec-psk")); + ui->ipsecIKE->setText(dataMap.value("ipsec-ike")); + ui->ipsecESP->setText(dataMap.value("ipsec-esp")); ++ ++ // XXX:调用m_connection->secrets,会触发Connection::update,有待更改 ++ QDBusPendingReply reply = m_connection->secrets("vpn"); ++ reply.waitForFinished(); ++ if (reply.isError() || !reply.isValid()) ++ { ++ qDebug() << "get secrets error for connection:" << reply.error(); ++ } ++ NMVariantMapMap NMVariantMap = reply.value(); ++ QVariantMap variantMap = NMVariantMap.value("vpn"); ++ QVariant secretsValue = variantMap.value("secrets"); ++ ++ auto dbusArg = secretsValue.value(); ++ KLOG_DEBUG() << dbusArg.currentType() << dbusArg.currentSignature(); ++ ++ NMStringMap dbusMap = qdbus_cast(dbusArg); ++ KLOG_DEBUG() << "dbusMap " << dbusMap; ++ ui->preSharedKey->setText(dbusMap.value("ipsec-psk")); + } + else + resetSettings(); +@@ -110,3 +137,15 @@ void VpnIPsec::clearPtr() + { + m_vpnSetting.clear(); + } ++ ++void VpnIPsec::enablePasswordVisual() ++{ ++ if (ui->preSharedKey->echoMode() == QLineEdit::Password) ++ { ++ ui->preSharedKey->setEchoMode(QLineEdit::Normal); ++ } ++ else ++ { ++ ui->preSharedKey->setEchoMode(QLineEdit::Password); ++ } ++} +diff --git a/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.h b/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.h +index 35e90c3..5fcf5f5 100644 +--- a/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.h ++++ b/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.h +@@ -15,8 +15,9 @@ + #ifndef KIRAN_CPANEL_NETWORK_VPN_IPSEC_H + #define KIRAN_CPANEL_NETWORK_VPN_IPSEC_H + +-#include ++#include + #include ++#include + QT_BEGIN_NAMESPACE + namespace Ui + { +@@ -24,7 +25,6 @@ class VpnIPsec; + } + QT_END_NAMESPACE + +- + class KiranSwitchButton; + class VpnIPsec : public QWidget + { +@@ -37,18 +37,21 @@ public: + void initUI(); + void initConnection(); + void setVpnSetting(const NetworkManager::VpnSetting::Ptr &vpnSetting); ++ void setConnectionPtr(const NetworkManager::Connection::Ptr &connection); + + public slots: + void saveSettings(); + void showSettings(); + void resetSettings(); + void clearPtr(); ++ void enablePasswordVisual(); + + private: + Ui::VpnIPsec *ui; + NetworkManager::VpnSetting::Ptr m_vpnSetting; ++ NetworkManager::Connection::Ptr m_connection; + NMStringMap m_dataMap; + KiranSwitchButton *m_enableIPsec; + }; + +-#endif //KIRAN_CPANEL_NETWORK_VPN_IPSEC_H ++#endif // KIRAN_CPANEL_NETWORK_VPN_IPSEC_H +diff --git a/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.ui b/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.ui +index a789a33..915abef 100644 +--- a/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.ui ++++ b/plugins/network/src/plugin/setting-widget/vpn/vpn-ipsec.ui +@@ -156,23 +156,34 @@ + + + +- +- +- +- 0 +- 36 +- +- +- +- +- 16777215 +- 36 +- +- +- +- EditPreSharedKey +- +- ++ ++ ++ ++ ++ ++ 0 ++ 36 ++ ++ ++ ++ ++ 16777215 ++ 36 ++ ++ ++ ++ EditPreSharedKey ++ ++ ++ ++ ++ ++ ++ Show Password ++ ++ ++ ++ + + + +diff --git a/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.cpp b/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.cpp +index 56eb802..b1b2306 100644 +--- a/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.cpp ++++ b/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.cpp +@@ -43,7 +43,7 @@ void VpnWidget::initUI() + + ui->passwordOptions->setFocusPolicy(Qt::NoFocus); + ui->password->setEchoMode(QLineEdit::Password); +- ui->passwordVisual->setVisible(false); ++ ui->passwordVisual->setVisible(true); + } + + void VpnWidget::initConnection() +@@ -57,6 +57,11 @@ void VpnWidget::setVpnSetting(const VpnSetting::Ptr &vpnSetting) + m_vpnSetting = vpnSetting; + } + ++void VpnWidget::setConnectionPtr(const Connection::Ptr &connection) ++{ ++ m_connection = connection; ++} ++ + void VpnWidget::setErrorTips(KiranTips *errorTips) + { + m_errorTip = errorTips; +@@ -69,6 +74,9 @@ void VpnWidget::handlePasswordOptionsChanged(Setting::SecretFlagType secretFlagT + case Setting::SecretFlagType::None: + ui->passwordWidget->setVisible(true); + break; ++ case Setting::SecretFlagType::AgentOwned: ++ ui->passwordWidget->setVisible(true); ++ break; + case Setting::SecretFlagType::NotSaved: + ui->passwordWidget->setVisible(false); + break; +@@ -123,17 +131,49 @@ void VpnWidget::showSettings() + if (m_vpnSetting != nullptr) + { + NMStringMap dataMap = m_vpnSetting->data(); +- NMStringMap secretMap = m_vpnSetting->secrets(); ++ + ui->gateway->setText(dataMap.value("gateway")); + ui->userName->setText(dataMap.value("user")); +- + KLOG_DEBUG() << "password-flags:" << dataMap.value("password-flags"); + int index = ui->passwordOptions->findData(dataMap.value("password-flags")); +- ui->passwordOptions->setCurrentIndex(index); ++ if (index == -1) ++ { ++ // 代表password-flags为Setting::SecretFlagType::AgentOwned (0x01) ++ // XXX:暂时不使用AgentOwned,统一改为None ++ if (dataMap.value("password-flags") == 1) ++ { ++ int newIndex = ui->passwordOptions->findData(Setting::SecretFlagType::None); ++ ui->passwordOptions->setCurrentIndex(newIndex); ++ } ++ } ++ else ++ ui->passwordOptions->setCurrentIndex(index); ++ ++ // 通过m_vpnSetting->secrets()获取到的map为空 ++ // NMStringMap secretMap = m_vpnSetting->secrets(); ++ // KLOG_DEBUG() << "vpn secretMap:" << secretMap; ++ // KLOG_DEBUG() << "password:" << secretMap.value("password"); ++ // ui->password->setText(secretMap.value("password")); + +- KLOG_DEBUG() << "password:" << secretMap.value("password"); +- ui->password->setText(secretMap.value("password")); + ui->ntDomain->setText(dataMap.value("domain")); ++ ++ // XXX:调用m_connection->secrets,会触发Connection::update,有待更改 ++ QDBusPendingReply reply = m_connection->secrets("vpn"); ++ reply.waitForFinished(); ++ if (reply.isError() || !reply.isValid()) ++ { ++ qDebug() << "get secrets error for connection:" << reply.error(); ++ } ++ NMVariantMapMap NMVariantMap = reply.value(); ++ QVariantMap variantMap = NMVariantMap.value("vpn"); ++ QVariant secretsValue = variantMap.value("secrets"); ++ ++ auto dbusArg = secretsValue.value(); ++ KLOG_DEBUG() << dbusArg.currentType() << dbusArg.currentSignature(); ++ ++ NMStringMap dbusMap = qdbus_cast(dbusArg); ++ KLOG_DEBUG() << "dbusMap " << dbusMap; ++ ui->password->setText(dbusMap.value("password")); + } + else + resetSettings(); +diff --git a/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.h b/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.h +index 73c7494..8efb301 100644 +--- a/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.h ++++ b/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.h +@@ -14,6 +14,7 @@ + #ifndef KIRAN_CPANEL_NETWORK_VPN_WIDGET_H + #define KIRAN_CPANEL_NETWORK_VPN_WIDGET_H + ++#include + #include + #include + QT_BEGIN_NAMESPACE +@@ -36,6 +37,7 @@ public: + void initUI(); + void initConnection(); + void setVpnSetting(const NetworkManager::VpnSetting::Ptr &vpnSetting); ++ void setConnectionPtr(const NetworkManager::Connection::Ptr &connection); + void setErrorTips(KiranTips *errorTips); + bool isIpv4AddressValid(const QString &address); + +@@ -52,6 +54,7 @@ public slots: + private: + Ui::VpnWidget *ui; + NetworkManager::VpnSetting::Ptr m_vpnSetting; ++ NetworkManager::Connection::Ptr m_connection; + NMStringMap m_dataMap; + NMStringMap m_secretMap; + KiranTips *m_errorTip = nullptr; +diff --git a/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.ui b/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.ui +index e9c9298..8d9a319 100644 +--- a/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.ui ++++ b/plugins/network/src/plugin/setting-widget/vpn/vpn-widget.ui +@@ -195,7 +195,7 @@ + ButtonPasswordVisual + + +- PushButton ++ Show Password + + + +diff --git a/plugins/network/src/plugin/settings/vpn/vpn-l2tp-setting.cpp b/plugins/network/src/plugin/settings/vpn/vpn-l2tp-setting.cpp +index 2e31ad8..e6679ac 100644 +--- a/plugins/network/src/plugin/settings/vpn/vpn-l2tp-setting.cpp ++++ b/plugins/network/src/plugin/settings/vpn/vpn-l2tp-setting.cpp +@@ -63,6 +63,10 @@ void VpnL2tpSetting::initSpecificSettings() + ui->vpnIPsec->setVpnSetting(m_vpnSetting); + ui->vpnIpvx->setIpv4Setting(m_ipv4Setting); + ui->disconnectAndDeleteWidget->setConnectionPtr(m_connection); ++ ++ // XXX:暂时转入ConnectionPtr,之后优化 ++ ui->vpnWidget->setConnectionPtr(m_connection); ++ ui->vpnIPsec->setConnectionPtr(m_connection); + } + + void VpnL2tpSetting::showSettingPage(QString activeConnectionPath) +diff --git a/plugins/network/translations/kiran-cpanel-network.zh_CN.ts b/plugins/network/translations/kiran-cpanel-network.zh_CN.ts +index 0949f19..0f8503a 100644 +--- a/plugins/network/translations/kiran-cpanel-network.zh_CN.ts ++++ b/plugins/network/translations/kiran-cpanel-network.zh_CN.ts +@@ -176,8 +176,8 @@ + 请输入网络名称 + + +- +- ++ ++ + Other WiFi networks + 其它WIFI网络 + +@@ -205,50 +205,49 @@ + 自动连接 + + +- ++ + Required + 必填 + + +- ++ + Wired Connection %1 + 有线网络%1 + + +- ++ + VPN L2TP %1 + + + +- ++ + VPN PPTP %1 + + + +- ++ + Connection name can not be empty + 网络名称不能为空 + + +- + Error +- 错误 ++ 错误 + + + + ConnectionShowPage + +- ++ + ConnectionShowPage + + + +- ++ + TextLabel + + + +- ++ + ButtonCreateConnection + + +@@ -420,14 +419,13 @@ + 不指定设备 + + +- ++ + Clone Mac invalid + 无效的克隆MAC地址 + + +- + Error +- 错误 ++ 错误 + + + +@@ -498,44 +496,37 @@ + + + +- ++ + Auto + 自动 + + +- ++ + Manual + 手动 + + +- + ++ + Required + 必填 + + +- ++ + Ipv4 address can not be empty + Ipv4地址不能为空 + + +- +- +- +- +- +- +- + Error +- 错误 ++ 错误 + + +- ++ + Ipv4 Address invalid + 无效的Ipv4地址 + + +- ++ + NetMask can not be empty + 子网掩码不能为空 + +@@ -545,17 +536,17 @@ + 无效的子网掩码 + + +- ++ + Ipv4 Gateway invalid + 无效的Ipv4网关 + + +- ++ + Ipv4 Preferred DNS invalid + 无效的Ipv4首选DNS + + +- ++ + Ipv4 Alternate DNS invalid + 无效的Ipv4备选DNS + +@@ -628,56 +619,51 @@ + + + +- ++ + Auto + 自动 + + +- ++ + Manual + 手动 + + +- ++ + Ignored + 忽略 + + +- ++ + Required + 必填 + + +- ++ + Ipv6 address can not be empty + Ipv6地址不能为空 + + +- +- +- +- +- + Error +- 错误 ++ 错误 + + +- ++ + Ipv6 address invalid + 无效的Ipv6地址 + + +- ++ + Ipv6 Gateway invalid + 无效的Ipv6网关 + + +- ++ + Ipv6 Preferred DNS invalid + 无效的Ipv6首选DNS + + +- ++ + Ipv6 Alternate DNS invalid + 无效的Ipv6备选DNS + +@@ -692,7 +678,7 @@ + + NetworkTray + +- ++ + Network settings + 网络设置 + +@@ -780,64 +766,64 @@ + + TrayItemWidget + +- ++ + TrayItemWidget + + + +- ++ + Icon + + + +- ++ + Name + 名称 + + +- ++ + Status + 状态 + + +- ++ + Ignore + 忽略 + + +- ++ + Disconnect + 断开 + + +- +- ++ ++ + Cancel + 取消 + + +- +- ++ ++ + Connect + 连接 + + +- ++ + Connected + 已连接 + + +- ++ + Unconnected + 未连接 + + +- ++ + Please input password + 请输入密码 + + +- ++ + Please input a network name + 请输入网络名称 + +@@ -903,27 +889,32 @@ + 预共享密钥 + + +- ++ + EditPreSharedKey + + + +- ++ ++ Show Password ++ 显示密码 ++ ++ ++ + Internet Key Exchange Protocol + 密钥交换协议 + + +- ++ + EditIpsecIKE + + + +- ++ + Encapsulating Security Payload + 安全封装协议 + + +- ++ + EditIpsecESP + + +@@ -984,7 +975,7 @@ + + + +- ++ + VPN name + VPN名称 + +@@ -1023,12 +1014,12 @@ + + + +- ++ + Tips + 提示 + + +- ++ + Password required to connect to %1. + 连接网络 "%1" 需要密码 + +@@ -1139,7 +1130,7 @@ + + + +- ++ + VPN name + VPN名称 + +@@ -1198,8 +1189,8 @@ + + + +- PushButton +- ++ Show Password ++ 显示密码 + + + +@@ -1212,52 +1203,48 @@ + + + +- + + ++ + Required + 必填 + + +- ++ + Saved + 已保存的 + + +- ++ + Ask + 总是询问 + + +- ++ + Not required + 不要求 + + +- ++ + Gateway can not be empty + 网关不能为空 + + +- +- +- +- + Error +- 错误 ++ 错误 + + +- ++ + Gateway invalid + 无效的网关 + + +- ++ + user name can not be empty + 用户名不能为空 + + +- ++ + password can not be empty + 密码不能为空 + +@@ -1308,7 +1295,7 @@ + + + +- ++ + Network name + 网络名称 + +-- +2.33.0 + diff --git a/kiran-control-panel.spec b/kiran-control-panel.spec index 590b085d76053e265ef070c9c6eb5a81d4406464..45535f91f58f24216e38626c5d767be8d3fc05fc 100644 --- a/kiran-control-panel.spec +++ b/kiran-control-panel.spec @@ -1,12 +1,14 @@ Name: kiran-control-panel Version: 2.3.5 -Release: 1 +Release: 2 Summary: Kiran Control Panel Summary(zh_CN): Kiran桌面控制面板 License: MulanPSL-2.0 Source0: %{name}-%{version}.tar.gz +Patch0001: 0001-fix-network-fix-the-self-test-defect-v-p-n.patch + BuildRequires: gcc-c++ BuildRequires: cmake >= 3.2 BuildRequires: glib2-devel @@ -166,6 +168,9 @@ make %{?_smp_mflags} rm -rf %{buildroot} %changelog +* Tue Sep 06 2022 luoqing - 2.3.5-2 +- KYOS-F: Fix V-P-N self-test defects + * Mon Sep 05 2022 luoqing - 2.3.5-1 - KYOS-F: Fix the network connection status does not change after unplugging the network cable (#I5I0AA) - KYOS-F: Fix network tay crash (#I5OKBR)