mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Quicksettings: toggle wifi on button press
This commit is contained in:
parent
bd1ed772b0
commit
264d570609
1 changed files with 17 additions and 4 deletions
|
|
@ -21,6 +21,7 @@ import QtQuick 2.1
|
|||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
|
@ -33,6 +34,14 @@ Item {
|
|||
|
||||
property bool screenshotRequested: false
|
||||
|
||||
PlasmaNM.Handler {
|
||||
id: nmHandler
|
||||
}
|
||||
|
||||
PlasmaNM.EnabledConnections {
|
||||
id: enabledConnections
|
||||
}
|
||||
|
||||
function toggleAirplane() {
|
||||
print("toggle airplane mode")
|
||||
}
|
||||
|
|
@ -41,6 +50,11 @@ Item {
|
|||
plasmoid.nativeInterface.toggleTorch()
|
||||
}
|
||||
|
||||
function toggleWifi() {
|
||||
nmHandler.enableWireless(!enabledConnections.wirelessEnabled)
|
||||
settingsModel.get(1).enabled = !enabledConnections.wirelessEnabled
|
||||
}
|
||||
|
||||
function requestShutdown() {
|
||||
print("Shutdown requested, depends on ksmserver running");
|
||||
var service = pmSource.serviceForSource("PowerDevil");
|
||||
|
|
@ -122,11 +136,10 @@ Item {
|
|||
settingsModel.append({
|
||||
"text": i18n("Wifi"),
|
||||
"icon": "network-wireless-signal",
|
||||
"enabled": false,
|
||||
"settingsCommand": "plasma-settings -m kcm_mobile_wifi",
|
||||
"toggleFunction": "",
|
||||
"settingsCommand": "",
|
||||
"toggleFunction": "toggleWifi",
|
||||
"delegate": "",
|
||||
"enabled": false,
|
||||
"enabled": enabledConnections.wirelessEnabled,
|
||||
"applet": null
|
||||
});
|
||||
settingsModel.append({
|
||||
|
|
|
|||
Loading…
Reference in a new issue