shift-shell/quicksettings/airplanemode/contents/ui/main.qml
Devin Lin ee1a311af7 components/mobileshell: Introduce singleton for plasma-nm lib
We currently create several instances of the plasma-nm objects over the shell. Use a single singleton to avoid having to load it multiple times.
2025-04-25 14:58:18 -04:00

22 lines
834 B
QML

/*
* SPDX-FileCopyrightText: 2021 Bhushan Shah <bshah@kde.org>
* SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import org.kde.plasma.networkmanagement as PlasmaNM
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
import org.kde.plasma.private.mobileshell as MobileShell
QS.QuickSetting {
text: i18n("Airplane Mode")
icon: PlasmaNM.Configuration.airplaneModeEnabled ? "network-flightmode-on" : "network-flightmode-off"
status: ""
enabled: PlasmaNM.Configuration.airplaneModeEnabled
function toggle() {
MobileShell.NetworkInfo.handler.enableAirplaneMode(!PlasmaNM.Configuration.airplaneModeEnabled);
PlasmaNM.Configuration.airplaneModeEnabled = !PlasmaNM.Configuration.airplaneModeEnabled;
}
}