Commit bc647972 authored by Nate Graham's avatar Nate Graham
Browse files

[Applet] Correctly hide separator when there are no connected devices

Leftover from d34ae3f0.

This code generally needs a refactor to be more declarative, which will
be done later.
parent d34ae3f0
......@@ -14,6 +14,8 @@ import org.kde.plasma.components 2.0 as PlasmaComponents // for Highlight
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.bluetooth 1.0 as PlasmaBt
import "logic.js" as Logic
PlasmaComponents3.Page {
Action {
......@@ -77,7 +79,7 @@ PlasmaComponents3.Page {
// group because it's unnecessary; all we want to do here is
// separate the connected devices from the available ones
section.delegate: Loader {
active: section != "Connected"
active: section != "Connected" && Logic.conectedDevicesCount() > 0
sourceComponent: Item {
width: listView.width
height: PlasmaCore.Units.gridUnit
......
......@@ -68,3 +68,16 @@ function icon()
}
return "preferences-system-bluetooth";
}
function conectedDevicesCount() {
var connectedDevices = [];
for (var i = 0; i < btManager.devices.length; ++i) {
var device = btManager.devices[i];
if (device.connected) {
connectedDevices.push(device);
}
}
return connectedDevices.length
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment