mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
38 lines
1.4 KiB
QML
38 lines
1.4 KiB
QML
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
import QtQuick 2.15
|
|
|
|
import org.kde.plasma.mm 1.0 as PlasmaMM
|
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
|
|
|
QS.QuickSetting {
|
|
text: i18n("Mobile Data")
|
|
icon: "network-modem"
|
|
status: {
|
|
if (!PlasmaMM.SignalIndicator.modemAvailable) {
|
|
return i18n("Not Available");
|
|
} else if (PlasmaMM.SignalIndicator.needsAPNAdded) {
|
|
return i18n("APN needs to be configured in the settings");
|
|
} else if (PlasmaMM.SignalIndicator.mobileDataSupported) {
|
|
return enabled ? i18n("On") : i18n("Off");
|
|
} else if (PlasmaMM.SignalIndicator.simEmpty) {
|
|
return i18n("No SIM inserted");
|
|
} else {
|
|
return i18n("Not Available");
|
|
}
|
|
}
|
|
|
|
settingsCommand: "plasma-open-settings kcm_cellular_network"
|
|
enabled: PlasmaMM.SignalIndicator.mobileDataEnabled
|
|
|
|
function toggle() {
|
|
if (PlasmaMM.SignalIndicator.needsAPNAdded || !PlasmaMM.SignalIndicator.mobileDataSupported) {
|
|
// open settings if unable to toggle mobile data
|
|
MobileShell.ShellUtil.executeCommand("plasma-open-settings kcm_cellular_network");
|
|
} else {
|
|
PlasmaMM.SignalIndicator.mobileDataEnabled = !PlasmaMM.SignalIndicator.mobileDataEnabled;
|
|
}
|
|
}
|
|
}
|