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

applet: Toggle Bluetooth status on middle-click

BUG: 427816
FIXED-IN: 5.24
parent 8649e05e
Pipeline #123032 passed with stage
in 50 seconds
......@@ -30,6 +30,17 @@ Item {
Plasmoid.compactRepresentation: CompactRepresentation { }
Plasmoid.fullRepresentation: FullRepresentation { }
function toggleBluetooth()
{
var enable = !btManager.bluetoothOperational;
btManager.bluetoothBlocked = !enable;
for (var i = 0; i < btManager.adapters.length; ++i) {
var adapter = btManager.adapters[i];
adapter.powered = enable;
}
}
function action_configure() {
KCMShell.openSystemSettings("kcm_bluetooth");
}
......
......@@ -19,7 +19,15 @@ MouseArea {
Layout.maximumWidth: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
Layout.maximumHeight: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
onClicked: plasmoid.expanded = !plasmoid.expanded
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
onClicked: {
if (mouse.button === Qt.MiddleButton) {
toggleBluetooth();
} else {
plasmoid.expanded = !plasmoid.expanded;
}
}
hoverEnabled: true
......
......@@ -60,15 +60,4 @@ PlasmaExtras.PlasmoidHeading {
Accessible.name: plasmoid.action("configure").text
}
}
function toggleBluetooth()
{
var enable = !btManager.bluetoothOperational;
btManager.bluetoothBlocked = !enable;
for (var i = 0; i < btManager.adapters.length; ++i) {
var adapter = btManager.adapters[i];
adapter.powered = enable;
}
}
}
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