quicksettings: add hotspot quicksetting

This commit is contained in:
Yari Polla 2023-02-28 13:32:37 +01:00 committed by Devin Lin
parent 6d1aeae654
commit d37324ee43
3 changed files with 70 additions and 0 deletions

View file

@ -11,6 +11,7 @@ plasma_install_package(keyboardtoggle org.kde.plasma.quicksetting.keyboardtoggle
plasma_install_package(mobiledata org.kde.plasma.quicksetting.mobiledata quicksettings)
plasma_install_package(settingsapp org.kde.plasma.quicksetting.settingsapp quicksettings)
plasma_install_package(wifi org.kde.plasma.quicksetting.wifi quicksettings)
plasma_install_package(hotspot org.kde.plasma.quicksetting.hotspot quicksettings)
add_subdirectory(flashlight)
add_subdirectory(nightcolor)
add_subdirectory(powermenu)

View file

@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2022 Yari Polla <skilvingr@gmail.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.15
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
MobileShell.QuickSetting {
id: root
readonly property string defaultStatus: i18n("Tap to enable hotspot")
PlasmaNM.Handler {
id: nmHandler
}
text: i18n("Hotspot")
icon: "network-wireless-hotspot"
enabled: false
status: defaultStatus
function toggle() {
if (!enabled) {
nmHandler.createHotspot();
} else {
nmHandler.stopHotspot();
}
}
Connections {
target: nmHandler
function onHotspotCreated() {
root.enabled = true;
root.status = "";
}
function onHotspotDisabled() {
root.enabled = false;
root.status = defaultStatus;
}
}
}

View file

@ -0,0 +1,23 @@
{
"KPlugin": {
"Authors": [
{
"Email": "skilvingr@gmail.com",
"Name": "Yari Polla",
"Name[x-test]": "xxYari Pollaxx"
}
],
"Description": "Hotspot quick setting for Plasma Mobile",
"Description[x-test]": "xxHotspot quick setting for Plasma Mobilexx",
"Icon": "network-wireless-hotspot",
"Id": "org.kde.plasma.quicksetting.hotspot",
"License": "GPL-2.0+",
"Name": "Hotspot",
"Name[x-test]": "xxHotspotxx",
"ServiceTypes": [
"KPackage/GenericQML"
],
"Version": "0.1",
"Website": "https://kde.org"
}
}