mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +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 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
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -33,6 +34,14 @@ Item {
|
||||||
|
|
||||||
property bool screenshotRequested: false
|
property bool screenshotRequested: false
|
||||||
|
|
||||||
|
PlasmaNM.Handler {
|
||||||
|
id: nmHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaNM.EnabledConnections {
|
||||||
|
id: enabledConnections
|
||||||
|
}
|
||||||
|
|
||||||
function toggleAirplane() {
|
function toggleAirplane() {
|
||||||
print("toggle airplane mode")
|
print("toggle airplane mode")
|
||||||
}
|
}
|
||||||
|
|
@ -41,6 +50,11 @@ Item {
|
||||||
plasmoid.nativeInterface.toggleTorch()
|
plasmoid.nativeInterface.toggleTorch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleWifi() {
|
||||||
|
nmHandler.enableWireless(!enabledConnections.wirelessEnabled)
|
||||||
|
settingsModel.get(1).enabled = !enabledConnections.wirelessEnabled
|
||||||
|
}
|
||||||
|
|
||||||
function requestShutdown() {
|
function requestShutdown() {
|
||||||
print("Shutdown requested, depends on ksmserver running");
|
print("Shutdown requested, depends on ksmserver running");
|
||||||
var service = pmSource.serviceForSource("PowerDevil");
|
var service = pmSource.serviceForSource("PowerDevil");
|
||||||
|
|
@ -122,11 +136,10 @@ Item {
|
||||||
settingsModel.append({
|
settingsModel.append({
|
||||||
"text": i18n("Wifi"),
|
"text": i18n("Wifi"),
|
||||||
"icon": "network-wireless-signal",
|
"icon": "network-wireless-signal",
|
||||||
"enabled": false,
|
"settingsCommand": "",
|
||||||
"settingsCommand": "plasma-settings -m kcm_mobile_wifi",
|
"toggleFunction": "toggleWifi",
|
||||||
"toggleFunction": "",
|
|
||||||
"delegate": "",
|
"delegate": "",
|
||||||
"enabled": false,
|
"enabled": enabledConnections.wirelessEnabled,
|
||||||
"applet": null
|
"applet": null
|
||||||
});
|
});
|
||||||
settingsModel.append({
|
settingsModel.append({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue