diff --git a/dcc-network/qml/PageDSLSettings.qml b/dcc-network/qml/PageDSLSettings.qml index a16e003f..a520757e 100644 --- a/dcc-network/qml/PageDSLSettings.qml +++ b/dcc-network/qml/PageDSLSettings.qml @@ -61,11 +61,6 @@ DccObject { weight: 500 canNotBind: false onEditClicked: modified = true - onSsidChanged: { - if (root.type === NetType.WirelessItem && !root.config[root.config.connection.type].hasOwnProperty("id")) { - sectionGeneric.settingsID = sectionDevice.ssid - } - } } SectionPPP { id: sectionPPP diff --git a/dcc-network/qml/PageSettings.qml b/dcc-network/qml/PageSettings.qml index e483cf79..2f8f623b 100644 --- a/dcc-network/qml/PageSettings.qml +++ b/dcc-network/qml/PageSettings.qml @@ -67,11 +67,6 @@ DccObject { weight: 600 type: root.type onEditClicked: modified = true - onSsidChanged: { - if (root.type === NetType.WirelessItem && !root.config[root.config.connection.type].hasOwnProperty("id")) { - sectionGeneric.settingsID = sectionDevice.ssid - } - } } } onConfigChanged: { @@ -209,6 +204,9 @@ DccObject { } else { nConfig["connection"]["interface-name"] = devConfig.interfaceName } + if (nConfig["connection"].type === "802-11-wireless" && !devConfig.hasOwnProperty("ssid")) { + devConfig["ssid"] = nConfig["connection"]["id"] + } nConfig[config.connection.type] = devConfig if (item) { diff --git a/dcc-network/qml/PageSystemProxy.qml b/dcc-network/qml/PageSystemProxy.qml index 4774cf21..2b6a7a4a 100644 --- a/dcc-network/qml/PageSystemProxy.qml +++ b/dcc-network/qml/PageSystemProxy.qml @@ -55,7 +55,6 @@ DccObject { "method": method }) } - console.log("method=====", method) } } Connections { @@ -113,6 +112,7 @@ DccObject { page: D.LineEdit { topInset: 4 bottomInset: 4 + placeholderText: qsTr("Required") text: dccObj.config Layout.fillWidth: true showAlert: autoUrlAlert diff --git a/dcc-network/qml/PageWirelessDevice.qml b/dcc-network/qml/PageWirelessDevice.qml index 17627be4..aee6a1d4 100644 --- a/dcc-network/qml/PageWirelessDevice.qml +++ b/dcc-network/qml/PageWirelessDevice.qml @@ -122,6 +122,7 @@ DccObject { Layout.fillWidth: true leftPadding: 36 contentItem: Label { + verticalAlignment: Text.AlignVCenter text: model.item.name color: palette.link } diff --git a/dcc-network/qml/SectionDevice.qml b/dcc-network/qml/SectionDevice.qml index 4c5e8dc1..7d75d76c 100644 --- a/dcc-network/qml/SectionDevice.qml +++ b/dcc-network/qml/SectionDevice.qml @@ -19,8 +19,6 @@ DccTitleObject { property var devData: [] property bool hasMTU: false property string interfaceName: "" - property string ssid: "" - property bool ssidEnabled: false property string errorKey: "" signal editClicked @@ -54,8 +52,6 @@ DccTitleObject { if (root.config.hasOwnProperty("cloned-mac-address")) { root.config["cloned-mac-address"] = NetUtils.macToStr(root.config["cloned-mac-address"]) } - ssid = root.config.hasOwnProperty("ssid") ? root.config["ssid"] : "" - ssidEnabled = type === NetType.WirelessItem && !root.config.hasOwnProperty("ssid") } function getConfig() { let saveConfig = root.config ? root.config : {} @@ -72,18 +68,11 @@ DccTitleObject { delete saveConfig["mtu"] } - if (type === NetType.WirelessItem) { - saveConfig["ssid"] = ssid - } saveConfig["band"] = root.config["band"] return saveConfig } function checkInput() { errorKey = "" - if (type === NetType.WirelessItem && ssid.length === 0) { - errorKey = "ssid" - return false - } if (root.config.hasOwnProperty("cloned-mac-address") && !NetUtils.macRegExp.test(root.config["cloned-mac-address"])) { errorKey = "cloned-mac-address" console.log(errorKey, root.config[errorKey]) @@ -108,36 +97,6 @@ DccTitleObject { weight: root.weight + 20 pageType: DccObject.Item page: DccGroupView {} - DccObject { - name: "ssid" - parentName: root.parentName + "/devGroup" - weight: 10 - displayName: qsTr("SSID") - pageType: DccObject.Editor - visible: type === NetType.WirelessItem - page: D.LineEdit { - enabled: ssidEnabled - placeholderText: qsTr("Required") - text: ssid - onTextChanged: { - if (showAlert) { - errorKey = "" - } - if (text !== ssid) { - ssid = text - root.editClicked() - } - } - showAlert: errorKey === dccObj.name - alertDuration: 2000 - onShowAlertChanged: { - if (showAlert) { - DccApp.showPage(dccObj) - forceActiveFocus() - } - } - } - } DccObject { name: "mac-address" parentName: root.parentName + "/devGroup" diff --git a/dcc-network/qml/SectionGeneric.qml b/dcc-network/qml/SectionGeneric.qml index 91a96352..2c019bd9 100644 --- a/dcc-network/qml/SectionGeneric.qml +++ b/dcc-network/qml/SectionGeneric.qml @@ -29,7 +29,7 @@ DccTitleObject { root.config.id = settingsID errorKey = "" console.log("root.config.id.length", root.config.id, root.config.id.length) - if (root.config.type !== "802-11-wireless" && root.config.id.length === 0) { + if (root.config.id.length === 0) { errorKey = "id" } @@ -47,12 +47,13 @@ DccTitleObject { DccObject { name: "name" parentName: root.parentName + "/genericGroup" - displayName: qsTr("Name") + displayName: root.config.type === "802-11-wireless" ? qsTr("Name (SSID)") : qsTr("Name") weight: 10 - enabled: root.config.type !== "802-11-wireless" + enabled: !root.config.hasOwnProperty("id") || root.config.id.length === 0 pageType: DccObject.Editor page: D.LineEdit { text: settingsID + placeholderText: qsTr("Required") onTextChanged: { if (showAlert) { errorKey = "" diff --git a/dcc-network/translations/network.ts b/dcc-network/translations/network.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network.ts +++ b/dcc-network/translations/network.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_az.ts b/dcc-network/translations/network_az.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_az.ts +++ b/dcc-network/translations/network_az.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_bo.ts b/dcc-network/translations/network_bo.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_bo.ts +++ b/dcc-network/translations/network_bo.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_ca.ts b/dcc-network/translations/network_ca.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_ca.ts +++ b/dcc-network/translations/network_ca.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_es.ts b/dcc-network/translations/network_es.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_es.ts +++ b/dcc-network/translations/network_es.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_fi.ts b/dcc-network/translations/network_fi.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_fi.ts +++ b/dcc-network/translations/network_fi.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_fr.ts b/dcc-network/translations/network_fr.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_fr.ts +++ b/dcc-network/translations/network_fr.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_hu.ts b/dcc-network/translations/network_hu.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_hu.ts +++ b/dcc-network/translations/network_hu.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_it.ts b/dcc-network/translations/network_it.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_it.ts +++ b/dcc-network/translations/network_it.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_ja.ts b/dcc-network/translations/network_ja.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_ja.ts +++ b/dcc-network/translations/network_ja.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_ko.ts b/dcc-network/translations/network_ko.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_ko.ts +++ b/dcc-network/translations/network_ko.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_nb_NO.ts b/dcc-network/translations/network_nb_NO.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_nb_NO.ts +++ b/dcc-network/translations/network_nb_NO.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_pl.ts b/dcc-network/translations/network_pl.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_pl.ts +++ b/dcc-network/translations/network_pl.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_pt_BR.ts b/dcc-network/translations/network_pt_BR.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_pt_BR.ts +++ b/dcc-network/translations/network_pt_BR.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_ru.ts b/dcc-network/translations/network_ru.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_ru.ts +++ b/dcc-network/translations/network_ru.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_uk.ts b/dcc-network/translations/network_uk.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_uk.ts +++ b/dcc-network/translations/network_uk.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_zh_CN.ts b/dcc-network/translations/network_zh_CN.ts index a699d6bc..ac3cb073 100644 --- a/dcc-network/translations/network_zh_CN.ts +++ b/dcc-network/translations/network_zh_CN.ts @@ -342,6 +342,10 @@ Set up proxy servers 设置代理服务器 + + Required + 必填 + PageVPN @@ -540,10 +544,6 @@ Ethernet 以太网 - - SSID - - Device MAC Addr 设备MAC地址 @@ -576,10 +576,6 @@ 5 GHz - - Required - 必填 - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect 自动连接 + + Required + 必填 + + + Name (SSID) + 名称(SSID) + SectionIPv4 diff --git a/dcc-network/translations/network_zh_HK.ts b/dcc-network/translations/network_zh_HK.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_zh_HK.ts +++ b/dcc-network/translations/network_zh_HK.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/dcc-network/translations/network_zh_TW.ts b/dcc-network/translations/network_zh_TW.ts index b6ee456d..40045c91 100644 --- a/dcc-network/translations/network_zh_TW.ts +++ b/dcc-network/translations/network_zh_TW.ts @@ -342,6 +342,10 @@ Set up proxy servers + + Required + + PageVPN @@ -540,10 +544,6 @@ Ethernet - - SSID - - Device MAC Addr @@ -576,10 +576,6 @@ 5 GHz - - Required - - SectionGeneric @@ -595,6 +591,14 @@ Auto Connect + + Required + + + + Name (SSID) + + SectionIPv4 diff --git a/net-view/operation/netmanager.cpp b/net-view/operation/netmanager.cpp index e41c0cae..b02fb84a 100644 --- a/net-view/operation/netmanager.cpp +++ b/net-view/operation/netmanager.cpp @@ -301,6 +301,10 @@ void NetManagerPrivate::exec(NetManager::CmdType cmd, const QString &id, const Q m_managerThread->connectHotspot(id, param, false); item = nullptr; } break; + case NetType::NetItemType::ConnectionItem: { + m_managerThread->disconnectConnection(id); + item = nullptr; + } break; default: item = item->getParentPrivate(); break; diff --git a/net-view/operation/private/netmanagerthreadprivate.cpp b/net-view/operation/private/netmanagerthreadprivate.cpp index 66f1dcb5..285b7f40 100644 --- a/net-view/operation/private/netmanagerthreadprivate.cpp +++ b/net-view/operation/private/netmanagerthreadprivate.cpp @@ -273,6 +273,11 @@ void NetManagerThreadPrivate::disconnectDevice(const QString &id) QMetaObject::invokeMethod(this, "doDisconnectDevice", Qt::QueuedConnection, Q_ARG(QString, id)); } +void NetManagerThreadPrivate::disconnectConnection(const QString &path) +{ + QMetaObject::invokeMethod(this, "doDisconnectConnection", Qt::QueuedConnection, Q_ARG(QString, path)); +} + void NetManagerThreadPrivate::connectHidden(const QString &id, const QString &ssid) { if (m_isInitialized) @@ -626,6 +631,17 @@ void NetManagerThreadPrivate::doDisconnectDevice(const QString &id) } } +void NetManagerThreadPrivate::doDisconnectConnection(const QString &path) +{ + NetworkManager::ActiveConnection::List activeConnections = NetworkManager::activeConnections(); + for (NetworkManager::ActiveConnection::Ptr activeConnection : activeConnections) { + if (activeConnection->connection()->path() == path) { + qCInfo(DNC) << "disconnect item:" << activeConnection->path(); + NetworkManager::deactivateConnection(activeConnection->path()); + } + } +} + void NetManagerThreadPrivate::doConnectHidden(const QString &id, const QString &ssid) { QList devices = NetworkController::instance()->devices(); @@ -880,11 +896,32 @@ void NetManagerThreadPrivate::doConnectOrInfo(const QString &id, NetType::NetIte return; } WirelessSecuritySetting::KeyMgmt keyMgmt = getKeyMgmtByAp(nmAp.get()); - if (keyMgmt == WirelessSecuritySetting::WpaNone) { + if (keyMgmt == WirelessSecuritySetting::WpaEap) { + doGetConnectInfo(id, type, param); + } else { NetworkManager::ConnectionSettings::Ptr settings = NetworkManager::ConnectionSettings::Ptr(new ConnectionSettings(ConnectionSettings::Wireless)); settings->setId(ap->ssid()); - settings->setting(Setting::SettingType::Wireless).staticCast()->setSsid(ap->ssid().toUtf8()); - settings->setting(Setting::SettingType::Wireless).staticCast()->setInitialized(true); + NetworkManager::WirelessSetting::Ptr wSetting = settings->setting(Setting::SettingType::Wireless).staticCast(); + wSetting->setSsid(ap->ssid().toUtf8()); + wSetting->setInitialized(true); + WirelessSecuritySetting::Ptr wsSetting = settings->setting(Setting::WirelessSecurity).dynamicCast(); + switch (keyMgmt) { + case WirelessSecuritySetting::KeyMgmt::WpaNone: + break; + case WirelessSecuritySetting::KeyMgmt::Wep: + wsSetting->setKeyMgmt(keyMgmt); + wsSetting->setWepKeyFlags(Setting::None); + break; + case WirelessSecuritySetting::KeyMgmt::WpaPsk: + case WirelessSecuritySetting::KeyMgmt::SAE: + wsSetting->setKeyMgmt(keyMgmt); + wsSetting->setPskFlags(Setting::None); + break; + default: + wsSetting->setKeyMgmt(keyMgmt); + break; + } + wsSetting->setInitialized(true); QString uuid = settings->createNewUuid(); while (findConnectionByUuid(uuid)) { qint64 second = QDateTime::currentDateTime().toSecsSinceEpoch(); @@ -895,9 +932,6 @@ void NetManagerThreadPrivate::doConnectOrInfo(const QString &id, NetType::NetIte if (reply.isError()) { qCWarning(DNC) << "activateConnection fiald:" << reply.error().message(); } - break; - } else { - doGetConnectInfo(id, type, param); } } diff --git a/net-view/operation/private/netmanagerthreadprivate.h b/net-view/operation/private/netmanagerthreadprivate.h index 2c20ff66..def7b228 100644 --- a/net-view/operation/private/netmanagerthreadprivate.h +++ b/net-view/operation/private/netmanagerthreadprivate.h @@ -109,6 +109,7 @@ public Q_SLOTS: void setDeviceEnabled(const QString &id, bool enabled); void requestScan(const QString &id); void disconnectDevice(const QString &id); + void disconnectConnection(const QString &path); void connectHidden(const QString &id, const QString &ssid); void connectWired(const QString &id, const QVariantMap ¶m); void connectWireless(const QString &id, const QVariantMap ¶m); @@ -144,6 +145,7 @@ protected Q_SLOTS: void doSetDeviceEnabled(const QString &id, bool enabled); void doRequestScan(const QString &id); void doDisconnectDevice(const QString &id); + void doDisconnectConnection(const QString &path); void doConnectHidden(const QString &id, const QString &ssid); void doConnectWired(const QString &id, const QVariantMap ¶m); void doConnectWireless(const QString &id, const QVariantMap ¶m);