Own the network: details, VPN, enterprise Wi-Fi, and a firewall that can also allow
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -16,6 +16,21 @@ Column {
|
||||
|
||||
spacing: 0
|
||||
|
||||
// Connected and paired devices always render (they lead the sort, so the
|
||||
// slice keeps them); unpaired strangers fill up to the cap and the rest
|
||||
// wait behind the "nearby devices" row. Discovery in a busy room finds
|
||||
// dozens of phones and TVs that are not yours.
|
||||
property bool showAll: false
|
||||
readonly property int visibleCap: 5
|
||||
readonly property var shown: {
|
||||
const list = Connectivity.bluetoothDevices;
|
||||
if (root.showAll || list.length <= root.visibleCap)
|
||||
return list;
|
||||
const pinned = list.filter(device => device.connected || device.paired).length;
|
||||
return list.slice(0, Math.max(root.visibleCap, pinned));
|
||||
}
|
||||
readonly property int hiddenCount: Connectivity.bluetoothDevices.length - root.shown.length
|
||||
|
||||
function primaryAction(device: var): void {
|
||||
if (device.connected) {
|
||||
device.disconnect();
|
||||
@@ -41,7 +56,7 @@ Column {
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: Connectivity.bluetoothDevices
|
||||
model: root.shown
|
||||
|
||||
SettingRow {
|
||||
id: entry
|
||||
@@ -52,7 +67,8 @@ Column {
|
||||
width: parent.width
|
||||
label: entry.modelData.name || entry.modelData.address || "Unknown device"
|
||||
detail: root.stateLabel(entry.modelData)
|
||||
divider: entry.index < Connectivity.bluetoothDevices.length - 1
|
||||
divider: entry.index < root.shown.length - 1
|
||||
|| root.hiddenCount > 0 || root.showAll
|
||||
controlWidth: 200
|
||||
activatable: !entry.modelData.pairing
|
||||
onActivated: root.primaryAction(entry.modelData)
|
||||
@@ -81,6 +97,19 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
SettingRow {
|
||||
width: parent.width
|
||||
visible: root.hiddenCount > 0
|
||||
|| (root.showAll && Connectivity.bluetoothDevices.length > root.visibleCap)
|
||||
label: root.showAll
|
||||
? "Show fewer devices"
|
||||
: root.hiddenCount + (root.hiddenCount === 1 ? " more nearby device" : " more nearby devices")
|
||||
detail: root.showAll ? "" : "Unpaired devices in range, folded to keep the list short"
|
||||
activatable: true
|
||||
onActivated: root.showAll = !root.showAll
|
||||
divider: false
|
||||
}
|
||||
|
||||
SettingRow {
|
||||
width: parent.width
|
||||
visible: Connectivity.bluetoothDevices.length === 0
|
||||
|
||||
Reference in New Issue
Block a user