Commit 88ff6b48 authored by Cyril Rossi's avatar Cyril Rossi
Browse files

KCMs: port Desktoptheme and icons to use SettingStateBinding

Use new SettingStateBinding introduced by frameworks/kdeclarative!4 and
also to support highlight of non default settings

see breeze!12
parent d3d9fa3a
......@@ -25,11 +25,12 @@ import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.3 as QtControls
import org.kde.kirigami 2.8 as Kirigami
import org.kde.newstuff 1.62 as NewStuff
import org.kde.kcm 1.1 as KCM
import org.kde.kcm 1.3 as KCM
import org.kde.private.kcms.desktoptheme 1.0 as Private
KCM.GridViewKCM {
id: root
KCM.ConfigModule.quickHelp: i18n("This module lets you choose the Plasma style.")
view.model: kcm.filteredModel
......@@ -47,7 +48,11 @@ KCM.GridViewKCM {
value: filterCombo.model[filterCombo.currentIndex].filter
}
enabled: !kcm.downloadingFile && !kcm.desktopThemeSettings.isImmutable("name")
KCM.SettingStateBinding {
configObject: kcm.desktopThemeSettings
settingName: "name"
extraEnabledConditions: !kcm.downloadingFile
}
DropArea {
anchors.fill: parent
......
......@@ -22,6 +22,7 @@ import QtQuick 2.7
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.3 as QtControls
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kcm 1.3 as KCM
QtControls.Popup {
id: iconSizePopup
......@@ -110,7 +111,12 @@ QtControls.Popup {
to: sizes.length - 1
stepSize: 1.0
snapMode: QtControls.Slider.SnapAlways
enabled: sizes.length > 0 && !kcm.iconsSettings.isImmutable(iconTypeList.currentItem.configKey)
KCM.SettingStateBinding {
configObject: kcm.iconsSettings
settingName: iconTypeList.currentItem.configKey
extraEnabledConditions: parent.sizes.length > 0
}
onMoved: {
kcm.iconsSettings[iconTypeList.currentItem.configKey] = iconSizeSlider.sizes[iconSizeSlider.value] || 0
......
......@@ -26,20 +26,25 @@ import QtQuick.Controls 2.3 as QtControls
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kquickcontrolsaddons 2.0 as KQCAddons
import org.kde.newstuff 1.62 as NewStuff
import org.kde.kcm 1.1 as KCM
import org.kde.kcm 1.3 as KCM
import org.kde.private.kcms.icons 1.0 as Private
KCM.GridViewKCM {
id: root
KCM.ConfigModule.quickHelp: i18n("This module allows you to choose the icons for your desktop.")
view.model: kcm.iconsModel
view.currentIndex: kcm.pluginIndex(kcm.iconsSettings.theme)
enabled: !kcm.downloadingFile
view.enabled: !kcm.iconsSettings.isImmutable("Theme")
KCM.SettingStateBinding {
configObject: kcm.iconsSettings
settingName: "Theme"
}
DropArea {
enabled: !kcm.iconsSettings.isImmutable("Theme")
enabled: view.enabled
anchors.fill: parent
onEntered: {
if (!drag.hasUrls) {
......@@ -244,8 +249,8 @@ KCM.GridViewKCM {
}
QtControls.Button {
enabled: !kcm.iconsSettings.isImmutable("Theme")
id: installFromFileButton
enabled: root.view.enabled
text: i18n("Install from File...")
icon.name: "document-import"
onClicked: fileDialogLoader.active = true
......@@ -253,6 +258,7 @@ KCM.GridViewKCM {
NewStuff.Button {
id: newStuffButton
enabled: root.view.enabled
text: i18n("Get New Icons...")
configFile: "icons.knsrc"
viewMode: NewStuff.Page.ViewMode.Preview
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment