From c15fb85c53a39a53e923a866801c48717c6803e7 Mon Sep 17 00:00:00 2001 From: Lemmy Date: Thu, 12 Mar 2026 17:29:32 -0400 Subject: [PATCH] chore(bt): unified get/setDeviceAutoConnect to use similar arguments --- .../Panels/Settings/Tabs/Connections/BluetoothSubTab.qml | 5 ++--- Services/Networking/BluetoothService.qml | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Panels/Settings/Tabs/Connections/BluetoothSubTab.qml b/Modules/Panels/Settings/Tabs/Connections/BluetoothSubTab.qml index 37e4dcc5c..215ac1b2d 100644 --- a/Modules/Panels/Settings/Tabs/Connections/BluetoothSubTab.qml +++ b/Modules/Panels/Settings/Tabs/Connections/BluetoothSubTab.qml @@ -668,15 +668,14 @@ Item { spacing: Style.marginXS visible: Settings.data.network.bluetoothAutoConnect NIcon { - icon: BluetoothService.getDeviceAutoConnect(modelData.address) ? "repeat" : "repeat-off" + icon: BluetoothService.getDeviceAutoConnect(modelData) ? "repeat" : "repeat-off" pointSize: Style.fontSizeXS - color: BluetoothService.getDeviceAutoConnect(modelData.address) ? Color.mPrimary : Color.mOnSurface } NCheckbox { label: I18n.tr("common.auto-connect") labelSize: Style.fontSizeXS baseSize: Style.baseWidgetSize * 0.5 - checked: BluetoothService.getDeviceAutoConnect(modelData.address) + checked: BluetoothService.getDeviceAutoConnect(modelData) onToggled: checked => BluetoothService.setDeviceAutoConnect(modelData, checked) } } diff --git a/Services/Networking/BluetoothService.qml b/Services/Networking/BluetoothService.qml index 819d966af..7ad9f02b1 100644 --- a/Services/Networking/BluetoothService.qml +++ b/Services/Networking/BluetoothService.qml @@ -83,10 +83,11 @@ Singleton { } } - function getDeviceAutoConnect(mac) { - if (!mac || !cacheAdapter.autoConnectSettings) { + function getDeviceAutoConnect(device) { + if (!device || !device.address || !cacheAdapter.autoConnectSettings) { return false; } + const mac = device.address; const settings = cacheAdapter.autoConnectSettings[mac]; return settings ? !!settings.autoConnect : false; } @@ -679,7 +680,7 @@ Singleton { return; } - _autoConnectQueue = adapter.devices.values.filter(dev => dev && dev.paired && !dev.connected && !dev.blocked && getDeviceAutoConnect(dev.address) === true); + _autoConnectQueue = adapter.devices.values.filter(dev => dev && dev.paired && !dev.connected && !dev.blocked && getDeviceAutoConnect(dev) === true); if (root._autoConnectQueue.length > 0) { autoConnectStepTimer.restart();