Make the phoneshell a bit more flexible

Use plasma-open-settings to open configs instead of directly
plasma-settings.

This way we're less dependent on specific set up.
This commit is contained in:
Aleix Pol 2021-08-26 16:25:01 +02:00
parent d30744789f
commit 31448728b8
5 changed files with 15 additions and 8 deletions

View file

@ -60,6 +60,13 @@ add_subdirectory(applets)
add_subdirectory(containments) add_subdirectory(containments)
add_subdirectory(components) add_subdirectory(components)
find_program(PlasmaOpenSettings plasma-open-settings)
set_package_properties(PlasmaOpenSettings PROPERTIES
URL https://invent.kde.org/plasma/kde-cli-tools/
DESCRIPTION "Opens KCMs properly"
TYPE RUNTIME
PURPOSE "Used on the top panel")
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
# add clang-format target for all our real source files # add clang-format target for all our real source files

View file

@ -142,7 +142,7 @@ Item {
text: i18n("Battery") text: i18n("Battery")
icon: "battery-full" + (batteryProvider.pluggedIn ? "-charging" : "") icon: "battery-full" + (batteryProvider.pluggedIn ? "-charging" : "")
enabled: false enabled: false
settingsCommand: "plasma-settings -m kcm_mobile_power" settingsCommand: "plasma-open-settings kcm_mobile_power"
} }
Component.onCompleted: quickSettings.quickSettingsModel.include(setting) Component.onCompleted: quickSettings.quickSettingsModel.include(setting)
} }
@ -161,7 +161,7 @@ Item {
text: i18n("Sound") text: i18n("Sound")
icon: "audio-speakers-symbolic" icon: "audio-speakers-symbolic"
enabled: false enabled: false
settingsCommand: "plasma-settings -m kcm_pulseaudio" settingsCommand: "plasma-open-settings kcm_pulseaudio"
function toggle() { function toggle() {
volumeProvider.showVolumeOverlay() volumeProvider.showVolumeOverlay()
} }

View file

@ -36,7 +36,7 @@ HomeScreenComponents.QuickSettingsModel
text: i18n("Settings") text: i18n("Settings")
icon: "configure" icon: "configure"
enabled: false enabled: false
settingsCommand: "plasma-settings" settingsCommand: "plasma-open-settings"
} }
HomeScreenComponents.QuickSetting { HomeScreenComponents.QuickSetting {
PlasmaNM.Handler { PlasmaNM.Handler {
@ -49,7 +49,7 @@ HomeScreenComponents.QuickSettingsModel
text: i18n("Wi-Fi") text: i18n("Wi-Fi")
icon: "network-wireless-signal" icon: "network-wireless-signal"
settingsCommand: "plasma-settings -m kcm_mobile_wifi" settingsCommand: "plasma-open-settings kcm_mobile_wifi"
function toggle() { function toggle() {
nmHandler.enableWireless(!enabledConnections.wirelessEnabled) nmHandler.enableWireless(!enabledConnections.wirelessEnabled)
} }
@ -58,7 +58,7 @@ HomeScreenComponents.QuickSettingsModel
HomeScreenComponents.QuickSetting { HomeScreenComponents.QuickSetting {
text: i18n("Bluetooth") text: i18n("Bluetooth")
icon: "network-bluetooth" icon: "network-bluetooth"
settingsCommand: "plasma-settings -m kcm_bluetooth" settingsCommand: "plasma-open-settings kcm_bluetooth"
function toggle() { function toggle() {
var enable = !BluezQt.Manager.bluetoothOperational; var enable = !BluezQt.Manager.bluetoothOperational;
BluezQt.Manager.bluetoothBlocked = !enable; BluezQt.Manager.bluetoothBlocked = !enable;
@ -73,7 +73,7 @@ HomeScreenComponents.QuickSettingsModel
HomeScreenComponents.QuickSetting { HomeScreenComponents.QuickSetting {
text: i18n("Mobile Data") text: i18n("Mobile Data")
icon: "network-modem" icon: "network-modem"
settingsCommand: "plasma-settings -m kcm_mobile_broadband" settingsCommand: "plasma-open-settings kcm_mobile_broadband"
enabled: enabledConnections.wwanEnabled enabled: enabledConnections.wwanEnabled
function toggle() { function toggle() {
nmHandler.enableWwan(!enabledConnections.wwanEnabled) nmHandler.enableWwan(!enabledConnections.wwanEnabled)

View file

@ -171,7 +171,7 @@ NanoShell.FullScreenOverlay {
onClicked: { onClicked: {
let coords = mapToItem(flickable, 0, 0); let coords = mapToItem(flickable, 0, 0);
NanoShell.StartupFeedback.open("audio-volume-high", i18n("Audio Settings"), coords.x, coords.y, PlasmaCore.Units.iconSizes.medium); NanoShell.StartupFeedback.open("audio-volume-high", i18n("Audio Settings"), coords.x, coords.y, PlasmaCore.Units.iconSizes.medium);
plasmoid.nativeInterface.executeCommand("plasma-settings -m kcm_pulseaudio"); plasmoid.nativeInterface.executeCommand("plasma-open-settings kcm_pulseaudio");
} }
} }

View file

@ -13,7 +13,7 @@ HomeScreenComponents.QuickSetting {
text: i18n("Night Color") text: i18n("Night Color")
icon: "redshift-status-on" icon: "redshift-status-on"
enabled: compositorAdaptor.active enabled: compositorAdaptor.active
settingsCommand: "plasma-settings -m kcm_nightcolor" settingsCommand: "plasma-open-settings kcm_nightcolor"
CC.CompositorAdaptor { CC.CompositorAdaptor {
id: compositorAdaptor id: compositorAdaptor