mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix: 概率性出现蓝牙开关关闭的情况下,蓝牙选项依然存在,而且刷新按钮还在刷新
删掉蓝牙设置的布局 Log: 概率性出现蓝牙开关关闭的情况下,蓝牙选项依然存在,而且刷新按钮还在刷新 Bug: https://pms.uniontech.com/zentao/bug-view-33367.html Change-Id: I471757cea51f0637c63c3774bb3cbbdcfff0d329 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2714 Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com> Reviewed-by: <mailman@uniontech.com> Reviewed-by: wangwei <wangwei@uniontech.com> Tested-by: <mailman@uniontech.com>
This commit is contained in:
parent
ae30c4593b
commit
99f76ab8b9
@ -97,7 +97,7 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
|
||||
m_centrealLayout->addLayout(appletNameLayout);
|
||||
m_centrealLayout->addWidget(m_line);
|
||||
m_centrealLayout->addLayout(m_adapterLayout);
|
||||
m_centrealLayout->addLayout(m_menueLayout);
|
||||
m_centrealLayout->addWidget(m_openControlCenter);
|
||||
m_centralWidget->setLayout(m_centrealLayout);
|
||||
m_centralWidget->setFixedWidth(POPUPWIDTH);
|
||||
m_centralWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
@ -245,17 +245,15 @@ void BluetoothApplet::updateView()
|
||||
isPowered = true;
|
||||
itemCount += adapterItem->deviceCount();
|
||||
}
|
||||
if (adapterItem->connectedDevsName().size())
|
||||
if (adapterItem->connectedDevsName().size()) {
|
||||
isAdapterConnected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_openControlCenter->setVisible(isPowered);
|
||||
if (isAdapterConnected) {
|
||||
m_menueLayout->addWidget(m_openControlCenter);
|
||||
if (isPowered) {
|
||||
contentHeight += ITEMHEIGHT;
|
||||
} else
|
||||
m_menueLayout->removeWidget(m_openControlCenter);
|
||||
}
|
||||
|
||||
int adaptersCnt = m_adapterItems.size();
|
||||
if (adaptersCnt > 1) {
|
||||
|
@ -94,30 +94,31 @@ AdaptersManager::AdaptersManager(QObject *parent)
|
||||
|
||||
void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powered)
|
||||
{
|
||||
if (adapter) {
|
||||
QDBusObjectPath path(adapter->id());
|
||||
QDBusPendingCall call = m_bluetoothInter->SetAdapterPowered(path, powered);
|
||||
if (!adapter)
|
||||
return;
|
||||
|
||||
if (powered) {
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, call, adapter] {
|
||||
if (!call.isError()) {
|
||||
QDBusObjectPath dPath(adapter->id());
|
||||
m_bluetoothInter->SetAdapterDiscoverableTimeout(dPath, 60 * 5);
|
||||
m_bluetoothInter->SetAdapterDiscoverable(dPath, true);
|
||||
m_bluetoothInter->RequestDiscovery(dPath);
|
||||
} else {
|
||||
qWarning() << call.error().message();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
QDBusPendingCall call = m_bluetoothInter->ClearUnpairedDevice();
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [ = ] {
|
||||
if (call.isError())
|
||||
qWarning() << call.error().message();
|
||||
});
|
||||
}
|
||||
QDBusObjectPath path(adapter->id());
|
||||
QDBusPendingCall call = m_bluetoothInter->SetAdapterPowered(path, powered);
|
||||
|
||||
if (powered) {
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [this, call, adapter] {
|
||||
if (!call.isError()) {
|
||||
QDBusObjectPath dPath(adapter->id());
|
||||
m_bluetoothInter->SetAdapterDiscoverableTimeout(dPath, 60 * 5);
|
||||
m_bluetoothInter->SetAdapterDiscoverable(dPath, true);
|
||||
m_bluetoothInter->RequestDiscovery(dPath);
|
||||
} else {
|
||||
qWarning() << call.error().message();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
QDBusPendingCall call = m_bluetoothInter->ClearUnpairedDevice();
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, [ = ] {
|
||||
if (call.isError())
|
||||
qWarning() << call.error().message();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user