mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53:09 +00:00
Add quicksettings item for bluetooth
Now that we have bluetooth support add an item for it
This commit is contained in:
parent
f326853971
commit
4aee5533b3
1 changed files with 30 additions and 2 deletions
|
|
@ -22,6 +22,7 @@ import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
||||||
|
import org.kde.bluezqt 1.0 as BluezQt
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -42,6 +43,14 @@ Item {
|
||||||
id: enabledConnections
|
id: enabledConnections
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: BluezQt.Manager
|
||||||
|
|
||||||
|
function onBluetoothOperationalChanged() {
|
||||||
|
settingsModel.get(2).enabled = BluezQt.Manager.bluetoothOperational
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function toggleAirplane() {
|
function toggleAirplane() {
|
||||||
print("toggle airplane mode")
|
print("toggle airplane mode")
|
||||||
}
|
}
|
||||||
|
|
@ -57,13 +66,23 @@ Item {
|
||||||
|
|
||||||
function toggleWwan() {
|
function toggleWwan() {
|
||||||
nmHandler.enableWwan(!enabledConnections.wwanEnabled)
|
nmHandler.enableWwan(!enabledConnections.wwanEnabled)
|
||||||
settingsModel.get(2).enabled = !enabledConnections.wwanEnabled
|
settingsModel.get(3).enabled = !enabledConnections.wwanEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleRotation() {
|
function toggleRotation() {
|
||||||
const enable = !plasmoid.nativeInterface.autoRotateEnabled
|
const enable = !plasmoid.nativeInterface.autoRotateEnabled
|
||||||
plasmoid.nativeInterface.autoRotateEnabled = enable
|
plasmoid.nativeInterface.autoRotateEnabled = enable
|
||||||
settingsModel.get(8).enabled = enable
|
settingsModel.get(9).enabled = enable
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleBluetooth() {
|
||||||
|
var enable = !BluezQt.Manager.bluetoothOperational;
|
||||||
|
BluezQt.Manager.bluetoothBlocked = !enable;
|
||||||
|
|
||||||
|
for (var i = 0; i < BluezQt.Manager.adapters.length; ++i) {
|
||||||
|
var adapter = BluezQt.Manager.adapters[i];
|
||||||
|
adapter.powered = enable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestShutdown() {
|
function requestShutdown() {
|
||||||
|
|
@ -153,6 +172,15 @@ Item {
|
||||||
"enabled": enabledConnections.wirelessEnabled,
|
"enabled": enabledConnections.wirelessEnabled,
|
||||||
"applet": null
|
"applet": null
|
||||||
});
|
});
|
||||||
|
settingsModel.append({
|
||||||
|
"text": i18n("Bluetooth"),
|
||||||
|
"icon": "network-bluetooth",
|
||||||
|
"settingsCommand": "plasma-settings -m kcm_bluetooth",
|
||||||
|
"toggleFunction": "toggleBluetooth",
|
||||||
|
"delegate": "",
|
||||||
|
"enabled": BluezQt.Manager.bluetoothOperational,
|
||||||
|
"applet": null
|
||||||
|
});
|
||||||
settingsModel.append({
|
settingsModel.append({
|
||||||
"text": i18n("Mobile Data"),
|
"text": i18n("Mobile Data"),
|
||||||
"icon": "network-modem",
|
"icon": "network-modem",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue