From 886ef153de48e13cb0ad5e9aee6003eee59a5c90 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 21 Sep 2023 19:24:32 +0200 Subject: [PATCH] mobileshell-kcm: Port to FormCard --- kcms/mobileshell/ui/QuickSettingsForm.qml | 188 ++++++-------- kcms/mobileshell/ui/VibrationForm.qml | 180 +++++++------- kcms/mobileshell/ui/main.qml | 289 ++++++++++------------ 3 files changed, 294 insertions(+), 363 deletions(-) diff --git a/kcms/mobileshell/ui/QuickSettingsForm.qml b/kcms/mobileshell/ui/QuickSettingsForm.qml index fbd5257c..0c9ba7f1 100644 --- a/kcms/mobileshell/ui/QuickSettingsForm.qml +++ b/kcms/mobileshell/ui/QuickSettingsForm.qml @@ -9,145 +9,117 @@ import QtQuick.Controls 2.15 as QQC2 import org.kde.kirigami 2.19 as Kirigami import org.kde.kcmutils as KCM -import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm +import org.kde.kirigamiaddons.formcard as FormCard import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS -Kirigami.ScrollablePage { +FormCard.FormCardPage { id: root + title: i18n("Quick Settings") - leftPadding: 0 - rightPadding: 0 - topPadding: Kirigami.Units.gridUnit - bottomPadding: Kirigami.Units.gridUnit - - Component { - id: listItemComponent - MobileForm.AbstractFormDelegate { - id: qsDelegate + component Delegate : FormCard.AbstractFormDelegate { + id: qsDelegate - readonly property bool isEnabled: parent ? parent.parentView.isEnabled : false + property bool isEnabled: false - contentItem: RowLayout { - Kirigami.ListItemDragHandle { - visible: qsDelegate.isEnabled - Layout.rightMargin: Kirigami.Units.gridUnit - listItem: qsDelegate - listView: qsDelegate.parent ? qsDelegate.parent.parentView : null - onMoveRequested: savedQuickSettings.enabledModel.moveRow(oldIndex, newIndex) - } + width: ListView.view.width - Kirigami.Icon { - readonly property bool iconAvailable: model && model.icon !== "" + background: null + contentItem: RowLayout { + Kirigami.ListItemDragHandle { + visible: qsDelegate.isEnabled + Layout.rightMargin: Kirigami.Units.gridUnit + listItem: qsDelegate + listView: qsDelegate.ListView.view + onMoveRequested: savedQuickSettings.enabledModel.moveRow(oldIndex, newIndex) + } - visible: iconAvailable - source: model ? model.icon : "" - Layout.rightMargin: iconAvailable ? Kirigami.Units.gridUnit : 0 - implicitWidth: iconAvailable ? Kirigami.Units.iconSizes.small : 0 - implicitHeight: iconAvailable ? Kirigami.Units.iconSizes.small : 0 - } + Kirigami.Icon { + readonly property bool iconAvailable: model && model.icon !== "" - ColumnLayout { - Layout.fillWidth: true - spacing: Kirigami.Units.smallSpacing + visible: iconAvailable + source: model ? model.icon : "" + Layout.rightMargin: iconAvailable ? Kirigami.Units.gridUnit : 0 + implicitWidth: iconAvailable ? Kirigami.Units.iconSizes.small : 0 + implicitHeight: iconAvailable ? Kirigami.Units.iconSizes.small : 0 + } - QQC2.Label { - Layout.fillWidth: true - text: model ? model.name : "" - elide: Text.ElideRight - } - } + QQC2.Label { + Layout.fillWidth: true + text: model ? model.name : "" + elide: Text.ElideRight + } - QQC2.ToolButton { - icon.name: model ? qsDelegate.isEnabled ? "hide_table_row" : "show_table_row" : "" - onClicked: qsDelegate.isEnabled ? savedQuickSettings.disableQS(model.index) : savedQuickSettings.enableQS(model.index) - } + QQC2.ToolButton { + display: QQC2.AbstractButton.IconOnly + text: qsDelegate.isEnabled ? i18nc("@action:button", "Hide") : i18nc("@action:button", "Show") + icon.name: qsDelegate.isEnabled ? "hide_table_row" : "show_table_row" + onClicked: qsDelegate.isEnabled ? savedQuickSettings.disableQS(model.index) : savedQuickSettings.enableQS(model.index) + + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.text: text + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay } } } - Component { - id: listViewComponent - - ListView { - id: listView - Layout.fillWidth: true - Layout.preferredHeight: contentHeight - interactive: false - - property bool isEnabled: false - model: isEnabled ? savedQuickSettings.enabledModel : savedQuickSettings.disabledModel - - moveDisplaced: Transition { - YAnimator { - duration: Kirigami.Units.longDuration - easing.type: Easing.InOutQuad - } - } - - delegate: Kirigami.DelegateRecycler { - id: delegate - - width: listView.width - sourceComponent: listItemComponent - - readonly property ListView parentView: ListView.view - } - } - } - - QS.SavedQuickSettings { + data: QS.SavedQuickSettings { id: savedQuickSettings } - ColumnLayout { - spacing: Kirigami.Units.smallSpacing - width: root.width - - MobileForm.FormCard { - Layout.fillWidth: true - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormCardHeader { - title: i18n("Quick Settings") - subtitle: i18n("Customize the order of quick settings in the pull-down panel and hide them.") - } + FormCard.FormHeader { + title: i18n("Quick Settings") + visible: enabledRepeater.count > 0 + } - Loader { - Layout.fillWidth: true - Layout.preferredHeight: item ? item.contentHeight : 0 + FormCard.FormSectionText { + text: i18n("Customize the order of quick settings in the pull-down panel and hide them.") + visible: enabledRepeater.count > 0 + } - asynchronous: true - sourceComponent: listViewComponent + FormCard.FormCard { + visible: enabledRepeater.count > 0 - onLoaded: item.isEnabled = true - } + ListView { + id: enabledRepeater + + interactive: false + + model: savedQuickSettings.enabledModel + delegate: Delegate { + isEnabled: true } + + Layout.fillWidth: true + Layout.preferredHeight: contentHeight } + } - MobileForm.FormCard { - Layout.fillWidth: true + FormCard.FormHeader { + title: i18n("Disabled Quick Settings") + visible: disabledRepeater.count > 0 + } - contentItem: ColumnLayout { - spacing: 0 + FormCard.FormSectionText { + text: i18n("Re-enable previously disabled quick settings.") + visible: disabledRepeater.count > 0 + } - MobileForm.FormCardHeader { - title: i18n("Disabled Quick Settings") - subtitle: i18n("Re-enable previously disabled quick settings.") - } + FormCard.FormCard { + visible: disabledRepeater.count > 0 - Loader { - Layout.fillWidth: true - Layout.preferredHeight: item ? item.contentHeight : 0 + ListView { + id: disabledRepeater - asynchronous: true - sourceComponent: listViewComponent + interactive: false - onLoaded: item.isEnabled = false - } + model: savedQuickSettings.disabledModel + delegate: Delegate { + isEnabled: false } + + Layout.fillWidth: true + Layout.preferredHeight: contentHeight } } } diff --git a/kcms/mobileshell/ui/VibrationForm.qml b/kcms/mobileshell/ui/VibrationForm.qml index 9499af0c..760e677e 100644 --- a/kcms/mobileshell/ui/VibrationForm.qml +++ b/kcms/mobileshell/ui/VibrationForm.qml @@ -3,111 +3,99 @@ * SPDX-License-Identifier: LGPL-2.0-or-later */ -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 as QQC2 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls as QQC2 -import org.kde.kirigami 2.19 as Kirigami +import org.kde.kirigami as Kirigami import org.kde.kcmutils as KCM -import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm +import org.kde.kirigamiaddons.formcard 1 as FormCard import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings -Kirigami.ScrollablePage { +FormCard.FormCardPage { id: root + title: i18n("Shell Vibrations") - leftPadding: 0 - rightPadding: 0 - topPadding: Kirigami.Units.gridUnit - bottomPadding: Kirigami.Units.gridUnit - - ColumnLayout { - spacing: 0 - width: root.width - - MobileForm.FormCard { - Layout.fillWidth: true - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormSwitchDelegate { - id: shellVibrationsSwitch - text: i18n("Shell Vibrations") - description: i18n("Whether to have vibrations enabled in the shell.") - checked: ShellSettings.Settings.vibrationsEnabled - onCheckedChanged: { - if (checked != ShellSettings.Settings.vibrationsEnabled) { - ShellSettings.Settings.vibrationsEnabled = checked; - } - } - } - - MobileForm.FormDelegateSeparator { above: shellVibrationsSwitch; below: vibrationIntensityDelegate } - - MobileForm.FormComboBoxDelegate { - id: vibrationIntensityDelegate - text: i18n("Vibration Intensity") - description: i18n("How intense shell vibrations should be.") - - property string lowIntensityString: i18nc("Low intensity", "Low") - property string mediumIntensityString: i18nc("Medium intensity", "Medium") - property string highIntensityString: i18nc("High intensity", "High") - - currentIndex: indexOfValue(ShellSettings.Settings.vibrationIntensity) - model: ListModel { - // we can't use i18n with ListElement - Component.onCompleted: { - append({"name": vibrationIntensityDelegate.highIntensityString, "value": 1.0}); - append({"name": vibrationIntensityDelegate.mediumIntensityString, "value": 0.5}); - append({"name": vibrationIntensityDelegate.lowIntensityString, "value": 0.2}); - - // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here - vibrationIntensityDelegate.currentIndex = vibrationIntensityDelegate.indexOfValue(ShellSettings.Settings.vibrationIntensity) - } - } - - textRole: "name" - valueRole: "value" - - Component.onCompleted: dialog.parent = root - onCurrentValueChanged: ShellSettings.Settings.vibrationIntensity = currentValue; - } - - MobileForm.FormDelegateSeparator { above: vibrationIntensityDelegate; below: vibrationDurationDelegate } - - MobileForm.FormComboBoxDelegate { - id: vibrationDurationDelegate - text: i18n("Vibration Duration") - description: i18n("How long shell vibrations should be.") - - property string longString: i18nc("Long duration", "Long") - property string mediumString: i18nc("Medium duration", "Medium") - property string shortString: i18nc("Short duration", "Short") - - currentIndex: indexOfValue(ShellSettings.Settings.vibrationDuration) - model: ListModel { - // we can't use i18n with ListElement - Component.onCompleted: { - append({"name": vibrationDurationDelegate.longString, "value": 100}); - append({"name": vibrationDurationDelegate.mediumString, "value": 50}); - append({"name": vibrationDurationDelegate.shortString, "value": 15}); - - // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here - vibrationDurationDelegate.currentIndex = vibrationDurationDelegate.indexOfValue(ShellSettings.Settings.vibrationDuration) - } - } - - textRole: "name" - valueRole: "value" - - Component.onCompleted: dialog.parent = root - onCurrentValueChanged: ShellSettings.Settings.vibrationDuration = currentValue; + + FormCard.FormCard { + Layout.topMargin: Kirigami.Units.gridUnit + + FormCard.FormSwitchDelegate { + id: shellVibrationsSwitch + text: i18n("Shell Vibrations") + description: i18n("Whether to have vibrations enabled in the shell.") + checked: ShellSettings.Settings.vibrationsEnabled + onCheckedChanged: { + if (checked != ShellSettings.Settings.vibrationsEnabled) { + ShellSettings.Settings.vibrationsEnabled = checked; } } } - - MobileForm.FormSectionText { - text: i18n("Keyboard vibrations are controlled separately in the keyboard settings module.") + + FormCard.FormDelegateSeparator { above: shellVibrationsSwitch; below: vibrationIntensityDelegate } + + FormCard.FormComboBoxDelegate { + id: vibrationIntensityDelegate + text: i18n("Vibration Intensity") + description: i18n("How intense shell vibrations should be.") + + property string lowIntensityString: i18nc("Low intensity", "Low") + property string mediumIntensityString: i18nc("Medium intensity", "Medium") + property string highIntensityString: i18nc("High intensity", "High") + + currentIndex: indexOfValue(ShellSettings.Settings.vibrationIntensity) + model: ListModel { + // we can't use i18n with ListElement + Component.onCompleted: { + append({"name": vibrationIntensityDelegate.highIntensityString, "value": 1.0}); + append({"name": vibrationIntensityDelegate.mediumIntensityString, "value": 0.5}); + append({"name": vibrationIntensityDelegate.lowIntensityString, "value": 0.2}); + + // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here + vibrationIntensityDelegate.currentIndex = vibrationIntensityDelegate.indexOfValue(ShellSettings.Settings.vibrationIntensity) + } + } + + textRole: "name" + valueRole: "value" + + Component.onCompleted: dialog.parent = root + onCurrentValueChanged: ShellSettings.Settings.vibrationIntensity = currentValue; + } + + FormCard.FormDelegateSeparator { above: vibrationIntensityDelegate; below: vibrationDurationDelegate } + + FormCard.FormComboBoxDelegate { + id: vibrationDurationDelegate + text: i18n("Vibration Duration") + description: i18n("How long shell vibrations should be.") + + property string longString: i18nc("Long duration", "Long") + property string mediumString: i18nc("Medium duration", "Medium") + property string shortString: i18nc("Short duration", "Short") + + currentIndex: indexOfValue(ShellSettings.Settings.vibrationDuration) + model: ListModel { + // we can't use i18n with ListElement + Component.onCompleted: { + append({"name": vibrationDurationDelegate.longString, "value": 100}); + append({"name": vibrationDurationDelegate.mediumString, "value": 50}); + append({"name": vibrationDurationDelegate.shortString, "value": 15}); + + // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here + vibrationDurationDelegate.currentIndex = vibrationDurationDelegate.indexOfValue(ShellSettings.Settings.vibrationDuration) + } + } + + textRole: "name" + valueRole: "value" + + Component.onCompleted: dialog.parent = root + onCurrentValueChanged: ShellSettings.Settings.vibrationDuration = currentValue; } } + + FormCard.FormSectionText { + text: i18n("Keyboard vibrations are controlled separately in the keyboard settings module.") + } } diff --git a/kcms/mobileshell/ui/main.qml b/kcms/mobileshell/ui/main.qml index f0e083d5..d583c947 100644 --- a/kcms/mobileshell/ui/main.qml +++ b/kcms/mobileshell/ui/main.qml @@ -9,7 +9,7 @@ import QtQuick.Controls 2.15 as QQC2 import org.kde.kirigami 2.19 as Kirigami import org.kde.kcmutils as KCM -import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm +import org.kde.kirigamiaddons.formcard 1.0 as FormCard import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings KCM.SimpleKCM { @@ -17,170 +17,141 @@ KCM.SimpleKCM { title: i18n("Shell") + topPadding: 0 + bottomPadding: 0 leftPadding: 0 rightPadding: 0 - topPadding: Kirigami.Units.gridUnit - bottomPadding: Kirigami.Units.gridUnit - - ColumnLayout { - spacing: 0 - width: root.width - - MobileForm.FormCard { - Layout.fillWidth: true - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormCardHeader { - title: i18n("General") - } - - MobileForm.FormButtonDelegate { - id: shellVibrationsButton - text: i18n("Shell Vibrations") - onClicked: kcm.push("VibrationForm.qml") - } - - MobileForm.FormDelegateSeparator { above: shellVibrationsButton; below: animationsSwitch } - - MobileForm.FormSwitchDelegate { - id: animationsSwitch - text: i18n("Animations") - description: i18n("If this is off, animations will be reduced as much as possible.") - checked: ShellSettings.Settings.animationsEnabled - onCheckedChanged: { - if (checked != ShellSettings.Settings.animationsEnabled) { - ShellSettings.Settings.animationsEnabled = checked; - } - } - } - } - } - - MobileForm.FormCard { - Layout.fillWidth: true - Layout.topMargin: Kirigami.Units.gridUnit - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormCardHeader { - title: i18n("Navigation Panel") - } - - MobileForm.FormSwitchDelegate { - id: gestureDelegate - text: i18n("Gesture-only Mode") - description: i18n("Whether to hide the navigation panel.") - checked: !ShellSettings.Settings.navigationPanelEnabled - onCheckedChanged: { - if (checked != !ShellSettings.Settings.navigationPanelEnabled) { - ShellSettings.Settings.navigationPanelEnabled = !checked; - } - } - } - } - } - - MobileForm.FormCard { - Layout.fillWidth: true - Layout.topMargin: Kirigami.Units.gridUnit - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormCardHeader { - title: i18n("Task Switcher") - } - - MobileForm.FormSwitchDelegate { - text: i18n("Show Application Previews") - description: i18n("Turning this off may help improve performance.") - checked: ShellSettings.Settings.taskSwitcherPreviewsEnabled - onCheckedChanged: { - if (checked != ShellSettings.Settings.taskSwitcherPreviewsEnabled) { - ShellSettings.Settings.taskSwitcherPreviewsEnabled = checked; - } - } - } - } - } - - MobileForm.FormCard { - Layout.fillWidth: true - Layout.topMargin: Kirigami.Units.gridUnit - - contentItem: ColumnLayout { - id: parentCol - spacing: 0 - - MobileForm.FormCardHeader { - title: i18n("Action Drawer") - } - - MobileForm.FormButtonDelegate { - id: quickSettingsButton - text: i18n("Quick Settings") - onClicked: kcm.push("QuickSettingsForm.qml") - } - - MobileForm.FormDelegateSeparator { above: quickSettingsButton; below: topLeftActionDrawerModeDelegate } - - property string pinnedString: i18nc("Pinned action drawer mode", "Pinned Mode") - property string expandedString: i18nc("Expanded action drawer mode", "Expanded Mode") - - MobileForm.FormComboBoxDelegate { - id: topLeftActionDrawerModeDelegate - text: i18n("Top Left Drawer Mode") - description: i18n("Mode when opening from the top left.") - - currentIndex: indexOfValue(ShellSettings.Settings.actionDrawerTopLeftMode) - model: ListModel { - // we can't use i18n with ListElement - Component.onCompleted: { - append({"name": parentCol.pinnedString, "value": ShellSettings.Settings.Pinned}); - append({"name": parentCol.expandedString, "value": ShellSettings.Settings.Expanded}); - - // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here - topLeftActionDrawerModeDelegate.currentIndex = topLeftActionDrawerModeDelegate.indexOfValue(ShellSettings.Settings.actionDrawerTopLeftMode) - } - } - - textRole: "name" - valueRole: "value" - - Component.onCompleted: dialog.parent = root - onCurrentValueChanged: ShellSettings.Settings.actionDrawerTopLeftMode = currentValue - } - - MobileForm.FormDelegateSeparator { above: topLeftActionDrawerModeDelegate; below: topRightActionDrawerModeDelegate } - - MobileForm.FormComboBoxDelegate { - id: topRightActionDrawerModeDelegate - text: i18n("Top Right Drawer Mode") - description: i18n("Mode when opening from the top right.") - - model: ListModel { - // we can't use i18n with ListElement - Component.onCompleted: { - append({"name": parentCol.pinnedString, "value": ShellSettings.Settings.Pinned}); - append({"name": parentCol.expandedString, "value": ShellSettings.Settings.Expanded}); - // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here - topRightActionDrawerModeDelegate.currentIndex = topRightActionDrawerModeDelegate.indexOfValue(ShellSettings.Settings.actionDrawerTopRightMode) - } + ColumnLayout { + FormCard.FormHeader { + title: i18n("General") + } + + FormCard.FormCard { + FormCard.FormButtonDelegate { + id: shellVibrationsButton + text: i18n("Shell Vibrations") + onClicked: kcm.push("VibrationForm.qml") + } + + FormCard.FormDelegateSeparator { above: shellVibrationsButton; below: animationsSwitch } + + FormCard.FormSwitchDelegate { + id: animationsSwitch + text: i18n("Animations") + description: i18n("If this is off, animations will be reduced as much as possible.") + checked: ShellSettings.Settings.animationsEnabled + onCheckedChanged: { + if (checked != ShellSettings.Settings.animationsEnabled) { + ShellSettings.Settings.animationsEnabled = checked; } - - textRole: "name" - valueRole: "value" - - Component.onCompleted: { - dialog.parent = root - } - onCurrentValueChanged: ShellSettings.Settings.actionDrawerTopRightMode = currentValue } } } + + FormCard.FormHeader { + title: i18n("Navigation Panel") + } + + FormCard.FormCard { + FormCard.FormSwitchDelegate { + id: gestureDelegate + text: i18n("Gesture-only Mode") + description: i18n("Whether to hide the navigation panel.") + checked: !ShellSettings.Settings.navigationPanelEnabled + onCheckedChanged: { + if (checked != !ShellSettings.Settings.navigationPanelEnabled) { + ShellSettings.Settings.navigationPanelEnabled = !checked; + } + } + } + } + + FormCard.FormHeader { + title: i18n("Task Switcher") + } + + FormCard.FormCard { + FormCard.FormSwitchDelegate { + text: i18n("Show Application Previews") + description: i18n("Turning this off may help improve performance.") + checked: ShellSettings.Settings.taskSwitcherPreviewsEnabled + onCheckedChanged: { + if (checked != ShellSettings.Settings.taskSwitcherPreviewsEnabled) { + ShellSettings.Settings.taskSwitcherPreviewsEnabled = checked; + } + } + } + } + + FormCard.FormHeader { + title: i18n("Action Drawer") + } + + FormCard.FormCard { + id: quickSettings + + property string pinnedString: i18nc("Pinned action drawer mode", "Pinned Mode") + property string expandedString: i18nc("Expanded action drawer mode", "Expanded Mode") + + FormCard.FormButtonDelegate { + id: quickSettingsButton + text: i18n("Quick Settings") + onClicked: kcm.push("QuickSettingsForm.qml") + } + + FormCard.FormDelegateSeparator { above: quickSettingsButton; below: topLeftActionDrawerModeDelegate } + + FormCard.FormComboBoxDelegate { + id: topLeftActionDrawerModeDelegate + text: i18n("Top Left Drawer Mode") + description: i18n("Mode when opening from the top left.") + + currentIndex: indexOfValue(ShellSettings.Settings.actionDrawerTopLeftMode) + model: ListModel { + // we can't use i18n with ListElement + Component.onCompleted: { + append({"name": quickSettings.pinnedString, "value": ShellSettings.Settings.Pinned}); + append({"name": quickSettings.expandedString, "value": ShellSettings.Settings.Expanded}); + + // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here + topLeftActionDrawerModeDelegate.currentIndex = topLeftActionDrawerModeDelegate.indexOfValue(ShellSettings.Settings.actionDrawerTopLeftMode) + } + } + + textRole: "name" + valueRole: "value" + + Component.onCompleted: dialog.parent = root + onCurrentValueChanged: ShellSettings.Settings.actionDrawerTopLeftMode = currentValue + } + + FormCard.FormDelegateSeparator { above: topLeftActionDrawerModeDelegate; below: topRightActionDrawerModeDelegate } + + FormCard.FormComboBoxDelegate { + id: topRightActionDrawerModeDelegate + text: i18n("Top Right Drawer Mode") + description: i18n("Mode when opening from the top right.") + + model: ListModel { + // we can't use i18n with ListElement + Component.onCompleted: { + append({"name": quickSettings.pinnedString, "value": ShellSettings.Settings.Pinned}); + append({"name": quickSettings.expandedString, "value": ShellSettings.Settings.Expanded}); + + // indexOfValue doesn't bind to model changes unfortunately, set currentIndex manually here + topRightActionDrawerModeDelegate.currentIndex = topRightActionDrawerModeDelegate.indexOfValue(ShellSettings.Settings.actionDrawerTopRightMode) + } + } + + textRole: "name" + valueRole: "value" + + Component.onCompleted: { + dialog.parent = root + } + onCurrentValueChanged: ShellSettings.Settings.actionDrawerTopRightMode = currentValue + } + } } }