From 19f6c7dfe7dfc09025938067cc11fb7415bed228 Mon Sep 17 00:00:00 2001 From: caixiangrong Date: Thu, 26 Dec 2024 17:06:38 +0800 Subject: [PATCH] fix: Create a temporary connection to an unconnected wireless network 1. Create a temporary connection to an unconnected wireless network 2. Modify the flight mode configuration to default display pms: BUG-297861 pms: BUG-295501 --- config/org.deepin.dde.network.json | 4 ++-- net-view/operation/private/netmanagerthreadprivate.cpp | 9 ++++++--- src/configsetting.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/org.deepin.dde.network.json b/config/org.deepin.dde.network.json index d1eb0818..1959132b 100644 --- a/config/org.deepin.dde.network.json +++ b/config/org.deepin.dde.network.json @@ -33,12 +33,12 @@ "visibility": "public" }, "networkAirplaneMode": { - "value": false, + "value": true, "serial": 0, "flags": [], "name": "NetworkAirplaneMode", "name[zh_CN]": "网络飞行模式", - "description": "控制中心-网络模块是否显示飞行模式页面,默认不显示。", + "description": "控制中心-网络模块是否显示飞行模式页面,默认显示。", "permissions": "readwrite", "visibility": "private" }, diff --git a/net-view/operation/private/netmanagerthreadprivate.cpp b/net-view/operation/private/netmanagerthreadprivate.cpp index 4ba6fded..59aefde7 100644 --- a/net-view/operation/private/netmanagerthreadprivate.cpp +++ b/net-view/operation/private/netmanagerthreadprivate.cpp @@ -523,6 +523,7 @@ void NetManagerThreadPrivate::doInit() if (m_flags.testFlags(NetType::NetManagerFlag::Net_Airplane)) { m_airplaneModeEnabled = false; getAirplaneModeEnabled(); + connect(ConfigSetting::instance(), &ConfigSetting::enableAirplaneModeChanged, this, &NetManagerThreadPrivate::getAirplaneModeEnabled); QDBusConnection::systemBus().connect("org.deepin.dde.AirplaneMode1", "/org/deepin/dde/AirplaneMode1", "org.freedesktop.DBus.Properties", @@ -834,7 +835,7 @@ void NetManagerThreadPrivate::updateAirplaneModeEnabled(const QDBusVariant &enab void NetManagerThreadPrivate::updateAirplaneModeEnabledable(const QDBusVariant &enabledable) { - bool airplaneEnabledable = enabledable.variant().toBool(); + bool airplaneEnabledable = enabledable.variant().toBool() && ConfigSetting::instance()->networkAirplaneMode(); Q_EMIT dataChanged(DataChanged::DeviceAvailableChanged, "Root", QVariant(airplaneEnabledable)); } @@ -928,13 +929,15 @@ void NetManagerThreadPrivate::doConnectOrInfo(const QString &id, NetType::NetIte uuid.replace(24, QString::number(second).length(), QString::number(second)); } settings->setUuid(uuid); - QDBusPendingReply reply = NetworkManager::addAndActivateConnection(settings->toMap(), devPath, ap->path()); + QVariantMap options; + options.insert("persist", "memory"); + options.insert("flags", MANULCONNECTION); + QDBusPendingReply reply = NetworkManager::addAndActivateConnection2(settings->toMap(), devPath, ap->path(), options); if (reply.isError()) { qCWarning(DNC) << "activateConnection fiald:" << reply.error().message(); } } } - } break; case NetType::ConnectionItem: { NetworkManager::Connection::Ptr conn = findConnection(id); diff --git a/src/configsetting.cpp b/src/configsetting.cpp index 6d154cb1..faa0ab66 100644 --- a/src/configsetting.cpp +++ b/src/configsetting.cpp @@ -15,7 +15,7 @@ static Dtk::Core::DConfig *dConfig = nullptr; ConfigSetting::ConfigSetting(QObject *parent) : QObject(parent) - , m_alwaysFromNM(false) + , m_alwaysFromNM(true) , m_loadServiceFromNM(false) , m_enableConnectivity(false) , m_checkPortal(false)