diff --git a/containments/desktop/package/contents/config/main.xml b/containments/desktop/package/contents/config/main.xml --- a/containments/desktop/package/contents/config/main.xml +++ b/containments/desktop/package/contents/config/main.xml @@ -95,13 +95,21 @@ - + 0 - + 4 + + + 1 + + + + 1 + 1 diff --git a/containments/desktop/package/contents/ui/ConfigIcons.qml b/containments/desktop/package/contents/ui/ConfigIcons.qml --- a/containments/desktop/package/contents/ui/ConfigIcons.qml +++ b/containments/desktop/package/contents/ui/ConfigIcons.qml @@ -52,9 +52,14 @@ property alias cfg_previews: previews.checked property alias cfg_previewPlugins: previewPluginsDialog.previewPlugins property alias cfg_viewMode: viewMode.currentIndex - property alias cfg_iconSize: iconSize.value + property alias cfg_labelWidth: labelWidth.currentIndex property alias cfg_textLines: textLines.value + + property int cfg_listViewIconSize + property int cfg_gridViewIconSize + property int cfg_iconSize + readonly property bool lockedByKiosk: !KAuthorized.authorize("editable_desktop_icons") @@ -218,39 +223,79 @@ Kirigami.FormData.label: i18nc("whether to use icon or list view", "View mode:") model: [i18n("List"), i18n("Icons")] - } + + function readIconSize() { + if (viewMode.currentIndex === 1 ) { + iconSize.value = cfg_gridViewIconSize; + return; + } + if (viewMode.currentIndex === 0 ) { + iconSize.value = cfg_listViewIconSize; + return; + } + } + onCurrentIndexChanged: { + readIconSize(); + } + } + // Size section Slider { id: iconSize - Layout.fillWidth: true - visible: !isPopup || viewMode.currentIndex === 1 Kirigami.FormData.label: i18n("Icon size:") from: 0 to: 5 stepSize: 1 snapMode: Slider.SnapAlways + + function initIconSize() { + if (viewMode.currentIndex === 1 && value == cfg_gridViewIconSize) + return; + if (viewMode.currentIndex === 0 && value == cfg_listViewIconSize) + return; + value = cfg_iconSize; + } + function updateIconSize() { + cfg_iconSize = value; + + if (viewMode.currentIndex === 1 ) { + cfg_gridViewIconSize = value; + return; + } + + if (viewMode.currentIndex === 0 ) { + cfg_listViewIconSize = value; + return; + } + } + + Component.onCompleted: { + initIconSize(); + } + onValueChanged: { + updateIconSize(); + } + } RowLayout { Layout.fillWidth: true Label { Layout.alignment: Qt.AlignLeft - visible: !isPopup || viewMode.currentIndex === 1 text: i18n("Small") } Item { Layout.fillWidth: true } Label { Layout.alignment: Qt.AlignRight - visible: !isPopup || viewMode.currentIndex === 1 text: i18n("Large") } diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml --- a/containments/desktop/package/contents/ui/FolderView.qml +++ b/containments/desktop/package/contents/ui/FolderView.qml @@ -773,10 +773,11 @@ } function makeIconSize() { - if (root.useListViewMode) { - return units.iconSizes.small; + if (plasmoid.configuration.viewMode == 0 && + plasmoid.configuration.iconSize != 1 && + plasmoid.configuration.iconSize != plasmoid.configuration.listViewIconSize) { + plasmoid.configuration.iconSize = 1; } - return FolderTools.iconSizeFromTheme(plasmoid.configuration.iconSize); }