Skip to content

Commit

Permalink
fix: Create a temporary connection to an unconnected wireless network
Browse files Browse the repository at this point in the history
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
  • Loading branch information
caixr23 committed Dec 27, 2024
1 parent 9fd90a4 commit 19f6c7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions config/org.deepin.dde.network.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
9 changes: 6 additions & 3 deletions net-view/operation/private/netmanagerthreadprivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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<QDBusObjectPath, QDBusObjectPath> reply = NetworkManager::addAndActivateConnection(settings->toMap(), devPath, ap->path());
QVariantMap options;
options.insert("persist", "memory");
options.insert("flags", MANULCONNECTION);
QDBusPendingReply<QDBusObjectPath, QDBusObjectPath> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/configsetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 19f6c7d

Please sign in to comment.