mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 无蓝牙和wifi模块,任务栏仍展示了飞行模式
添加过滤条件,只在有蓝牙或无线网络的机器显示飞行模式 Log: 有条件的显示飞行模式 Influence: 飞行模式 Task: https://pms.uniontech.com/bug-view-147945.html Change-Id: I1ad1295d5be1d14afce5095ec7915cf009c9b64c
This commit is contained in:
parent
459bc92e00
commit
bd5ae48187
@ -47,9 +47,6 @@ void AirplaneModePlugin::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_proxyInter = proxyInter;
|
||||
|
||||
if (!pluginIsDisable())
|
||||
m_proxyInter->itemAdded(this, AIRPLANEMODE_KEY);
|
||||
|
||||
bool hasBluetooth = false;
|
||||
QDBusInterface inter("com.deepin.daemon.Bluetooth",
|
||||
"/com/deepin/daemon/Bluetooth",
|
||||
@ -58,9 +55,9 @@ void AirplaneModePlugin::init(PluginProxyInterface *proxyInter)
|
||||
if (inter.isValid()) {
|
||||
QDBusReply<QString> reply = inter.call("GetAdapters");
|
||||
QString replyStr = reply.value();
|
||||
replyStr = replyStr.replace("[", "");
|
||||
replyStr = replyStr.replace("]", "");
|
||||
if (!replyStr.isEmpty()) {
|
||||
QJsonDocument json = QJsonDocument::fromJson(replyStr.toUtf8());
|
||||
QJsonArray array = json.array();
|
||||
if (array.size() > 0 && !array[0].toObject()["Path"].toString().isEmpty()) {
|
||||
hasBluetooth = true;
|
||||
}
|
||||
}
|
||||
@ -72,6 +69,12 @@ void AirplaneModePlugin::init(PluginProxyInterface *proxyInter)
|
||||
hasWireless = true;
|
||||
}
|
||||
}
|
||||
if (!pluginIsDisable()) {
|
||||
if (hasBluetooth || hasWireless) {
|
||||
m_proxyInter->itemAdded(this, AIRPLANEMODE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
// 蓝牙和无线网络,只要有其中一个就允许显示飞行模式
|
||||
if (hasBluetooth || hasWireless) {
|
||||
refreshAirplaneEnableState();
|
||||
|
Loading…
x
Reference in New Issue
Block a user