From f4877406e3d08e0007c5f0f9da7eb5d5e83db1a4 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Fri, 18 Nov 2022 17:37:07 -0500 Subject: [PATCH] shell: Update to new usage of FormComboBoxDelegate --- .../qml/actiondrawer/ActionDrawerWindow.qml | 4 ++ .../ConfigurationContainmentAppearance.qml | 69 +++++++------------ 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml b/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml index b0ed2a51..c2f63b97 100644 --- a/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml +++ b/components/mobileshell/qml/actiondrawer/ActionDrawerWindow.qml @@ -33,6 +33,10 @@ NanoShell.FullScreenOverlay { width: Screen.width height: Screen.height + onVisibleChanged: { + blurBackground = visible; + } + color: "transparent" onActiveChanged: { diff --git a/shell/contents/configuration/ConfigurationContainmentAppearance.qml b/shell/contents/configuration/ConfigurationContainmentAppearance.qml index 591036ee..2b0feb9c 100644 --- a/shell/contents/configuration/ConfigurationContainmentAppearance.qml +++ b/shell/contents/configuration/ConfigurationContainmentAppearance.qml @@ -72,32 +72,22 @@ ColumnLayout { description: i18n("The homescreen layout to use.") visible: model.count > 1 // only show if there are multiple plugins - currentValue: { + model: configDialog.containmentPluginsConfigModel + textRole: "name" + valueRole: "pluginName" + currentIndex: determineCurrentIndex() + onCurrentIndexChanged: { + root.containmentPlugin = configDialog.containmentPluginsConfigModel.get(currentIndex).pluginName; + } + + function determineCurrentIndex() { for (var i = 0; i < configDialog.containmentPluginsConfigModel.count; ++i) { var data = configDialog.containmentPluginsConfigModel.get(i); if (configDialog.containmentPlugin === data.pluginName) { - return data.name; - } - } - return ""; - } - model: configDialog.containmentPluginsConfigModel - dialogDelegate: QQC2.RadioDelegate { - implicitWidth: Kirigami.Units.gridUnit * 16 - topPadding: Kirigami.Units.smallSpacing * 2 - bottomPadding: Kirigami.Units.smallSpacing * 2 - - text: model.name - checked: layoutSelectComboBox.currentValue === model.name - onCheckedChanged: { - if (checked) { - layoutSelectComboBox.currentValue = name; - var model = configDialog.containmentPluginsConfigModel.get(index); - root.containmentPlugin = pluginName; - // don't apply configuration immediately - //root.configurationChanged(); + return i; } } + return -1; } } @@ -108,33 +98,26 @@ ColumnLayout { text: i18nd("plasma_shell_org.kde.plasma.desktop", "Wallpaper Plugin") description: i18n("The wallpaper plugin to use.") - currentValue: { + model: configDialog.wallpaperConfigModel + textRole: "name" + valueRole: "pluginName" + currentIndex: determineCurrentIndex() + onCurrentIndexChanged: { + var model = configDialog.wallpaperConfigModel.get(currentIndex); + root.currentWallpaper = model.pluginName; + configDialog.currentWallpaper = model.pluginName; + main.sourceFile = model.source; + root.configurationChanged(); + } + + function determineCurrentIndex() { for (var i = 0; i < configDialog.wallpaperConfigModel.count; ++i) { var data = configDialog.wallpaperConfigModel.get(i); if (configDialog.currentWallpaper === data.pluginName) { - return data.name; - } - } - return ""; - } - model: configDialog.wallpaperConfigModel - dialogDelegate: QQC2.RadioDelegate { - implicitWidth: Kirigami.Units.gridUnit * 16 - topPadding: Kirigami.Units.smallSpacing * 2 - bottomPadding: Kirigami.Units.smallSpacing * 2 - - text: model.name - checked: wallpaperPluginSelectComboBox.currentValue === model.name - onCheckedChanged: { - if (checked) { - wallpaperPluginSelectComboBox.currentValue = name; - var model = configDialog.wallpaperConfigModel.get(index); - root.currentWallpaper = pluginName; - configDialog.currentWallpaper = pluginName; - main.sourceFile = source; - root.configurationChanged(); + return i; } } + return -1; } }