diff --git a/kcmkwin/kwindecoration/package/contents/ui/ButtonGroup.qml b/kcmkwin/kwindecoration/package/contents/ui/ButtonGroup.qml index ae87767df..9a8f9d559 100644 --- a/kcmkwin/kwindecoration/package/contents/ui/ButtonGroup.qml +++ b/kcmkwin/kwindecoration/package/contents/ui/ButtonGroup.qml @@ -33,6 +33,7 @@ ListView { Drag.active: dragArea.drag.active Drag.onActiveChanged: view.dragging = Drag.active color: palette.windowText + opacity: parent.enabled ? 1.0 : 0.3 } MouseArea { id: dragArea diff --git a/kcmkwin/kwindecoration/package/contents/ui/Buttons.qml b/kcmkwin/kwindecoration/package/contents/ui/Buttons.qml index 2d1eeeda2..372baef79 100644 --- a/kcmkwin/kwindecoration/package/contents/ui/Buttons.qml +++ b/kcmkwin/kwindecoration/package/contents/ui/Buttons.qml @@ -11,6 +11,7 @@ import QtQuick.Controls 2.4 as Controls import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami 2.5 as Kirigami import org.kde.kwin.private.kdecoration 1.0 as KDecoration +import org.kde.kcm 1.3 as KCM ColumnLayout { Layout.fillWidth: true @@ -64,7 +65,24 @@ ColumnLayout { iconSize: buttonIconSize model: kcm.leftButtonsModel key: "decoButtonLeft" + + Rectangle { + visible: stateBindingButtonLeft.nonDefaultHighlightVisible + anchors.fill: parent + Layout.margins: units.smallSpacing + color: "transparent" + border.color: Kirigami.Theme.neutralTextColor + border.width: Kirigami.Units.devicePixelRatio + radius: units.smallSpacing + } + + KCM.SettingStateBinding { + id: stateBindingButtonLeft + configObject: kcm.settings + settingName: "buttonsOnLeft" + } } + Controls.Label { id: titleBarLabel Layout.fillWidth: true @@ -77,6 +95,22 @@ ColumnLayout { iconSize: buttonIconSize model: kcm.rightButtonsModel key: "decoButtonRight" + + Rectangle { + visible: stateBindingButtonRight.nonDefaultHighlightVisible + anchors.fill: parent + Layout.margins: units.smallSpacing + color: "transparent" + border.color: Kirigami.Theme.neutralTextColor + border.width: Kirigami.Units.devicePixelRatio + radius: units.smallSpacing + } + + KCM.SettingStateBinding { + id: stateBindingButtonRight + configObject: kcm.settings + settingName: "buttonsOnRight" + } } } DropArea { @@ -94,9 +128,13 @@ ColumnLayout { var left = drag.x - (leftButtonsView.x + leftButtonsView.width); var right = drag.x - rightButtonsView.x; if (Math.abs(left) <= Math.abs(right)) { - view = leftButtonsView; + if (leftButtonsView.enabled) { + view = leftButtonsView; + } } else { - view = rightButtonsView; + if (rightButtonsView.enabled) { + view = rightButtonsView; + } } if (!view) { return; diff --git a/kcmkwin/kwindecoration/package/contents/ui/Themes.qml b/kcmkwin/kwindecoration/package/contents/ui/Themes.qml index 511b8bd57..591bd5824 100644 --- a/kcmkwin/kwindecoration/package/contents/ui/Themes.qml +++ b/kcmkwin/kwindecoration/package/contents/ui/Themes.qml @@ -5,7 +5,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ import QtQuick 2.7 -import org.kde.kcm 1.1 as KCM +import org.kde.kcm 1.3 as KCM import org.kde.kirigami 2.2 as Kirigami import org.kde.kwin.private.kdecoration 1.0 as KDecoration diff --git a/kcmkwin/kwindecoration/package/contents/ui/main.qml b/kcmkwin/kwindecoration/package/contents/ui/main.qml index 49fc9f6f5..36fb88b7d 100644 --- a/kcmkwin/kwindecoration/package/contents/ui/main.qml +++ b/kcmkwin/kwindecoration/package/contents/ui/main.qml @@ -7,11 +7,13 @@ import QtQuick 2.7 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.4 as Controls -import org.kde.kcm 1.1 as KCM +import org.kde.kcm 1.3 as KCM import org.kde.kconfig 1.0 // for KAuthorized import org.kde.kirigami 2.4 as Kirigami Kirigami.Page { + id: root + KCM.ConfigModule.quickHelp: i18n("This module lets you configure the window decorations.") title: kcm.name @@ -62,54 +64,75 @@ Kirigami.Page { currentIndex: tabBar.currentIndex - ColumnLayout { - Themes { - Layout.fillWidth: true - Layout.fillHeight: true - enabled: !kcm.settings.isImmutable("pluginName") && !kcm.settings.isImmutable("theme") + Item { + KCM.SettingStateBinding { + target: themes + configObject: kcm.settings + settingName: "pluginName" } - RowLayout { - Controls.CheckBox { - id: borderSizeAutoCheckbox - // Let it elide but don't make it push the ComboBox away from it + ColumnLayout { + anchors.fill: parent + + Themes { + id: themes Layout.fillWidth: true - Layout.maximumWidth: implicitWidth - text: i18nc("checkbox label", "Use theme's default window border size") - enabled: !kcm.settings.isImmutable("borderSizeAuto") - checked: kcm.settings.borderSizeAuto - onToggled: { - kcm.settings.borderSizeAuto = checked; - borderSizeComboBox.autoBorderUpdate() - } + Layout.fillHeight: true } - Controls.ComboBox { - id: borderSizeComboBox - enabled: !borderSizeAutoCheckbox.checked && !kcm.settings.isImmutable("borderSize") - model: kcm.borderSizesModel - currentIndex: kcm.borderSize - onActivated: { - kcm.borderSize = currentIndex + + RowLayout { + Controls.CheckBox { + id: borderSizeAutoCheckbox + // Let it elide but don't make it push the ComboBox away from it + Layout.fillWidth: true + Layout.maximumWidth: implicitWidth + text: i18nc("checkbox label", "Use theme's default window border size") + checked: kcm.settings.borderSizeAuto + onToggled: { + kcm.settings.borderSizeAuto = checked; + borderSizeComboBox.autoBorderUpdate() + } + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "borderSizeAuto" + } + } - function autoBorderUpdate() { - if (borderSizeAutoCheckbox.checked) { - kcm.borderSize = kcm.recommendedBorderSize + Controls.ComboBox { + id: borderSizeComboBox + model: kcm.borderSizesModel + currentIndex: kcm.borderSize + onActivated: { + kcm.borderSize = currentIndex + } + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "borderSize" + extraEnabledConditions: !borderSizeAutoCheckbox.checked + } + + function autoBorderUpdate() { + if (borderSizeAutoCheckbox.checked) { + kcm.borderSize = kcm.recommendedBorderSize + } + } + + Connections { + target: kcm + onThemeChanged: borderSizeComboBox.autoBorderUpdate() } } - - Connections { - target: kcm - onThemeChanged: borderSizeComboBox.autoBorderUpdate() + Item { + Layout.fillWidth: true + } + Controls.Button { + text: i18nc("button text", "Get New Window Decorations...") + icon.name: "get-hot-new-stuff" + onClicked: kcm.getNewStuff(this) + visible: KAuthorized.authorize("ghns") } - } - Item { - Layout.fillWidth: true - } - Controls.Button { - text: i18nc("button text", "Get New Window Decorations...") - icon.name: "get-hot-new-stuff" - onClicked: kcm.getNewStuff(this) - visible: KAuthorized.authorize("ghns") } } } @@ -118,18 +141,21 @@ Kirigami.Page { Buttons { Layout.fillWidth: true Layout.fillHeight: true - enabled: !kcm.settings.isImmutable("buttonsOnLeft") && !kcm.settings.isImmutable("buttonsOnRight") } Controls.CheckBox { id: closeOnDoubleClickOnMenuCheckBox text: i18nc("checkbox label", "Close windows by double clicking the menu button") - enabled: !kcm.settings.isImmutable("closeOnDoubleClickOnMenu") checked: kcm.settings.closeOnDoubleClickOnMenu onToggled: { kcm.settings.closeOnDoubleClickOnMenu = checked infoLabel.visible = checked } + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "closeOnDoubleClickOnMenu" + } } Kirigami.InlineMessage { @@ -144,9 +170,13 @@ Kirigami.Page { Controls.CheckBox { id: showToolTipsCheckBox text: i18nc("checkbox label", "Show titlebar button tooltips") - enabled: !kcm.settings.isImmutable("showToolTips") checked: kcm.settings.showToolTips onToggled: kcm.settings.showToolTips = checked + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "showToolTips" + } } } }