diff --git a/kcmkwin/common/effectsmodel.cpp b/kcmkwin/common/effectsmodel.cpp index 06a49f25c0..2c935d7944 100644 --- a/kcmkwin/common/effectsmodel.cpp +++ b/kcmkwin/common/effectsmodel.cpp @@ -97,6 +97,7 @@ QHash EffectsModel::roleNames() const roleNames[ConfigurableRole] = "ConfigurableRole"; roleNames[ScriptedRole] = QByteArrayLiteral("ScriptedRole"); roleNames[EnabledByDefaultRole] = "EnabledByDefaultRole"; + roleNames[EnabledByDefaultFunctionRole] = "EnabledByDefaultFunctionRole"; roleNames[ConfigModuleRole] = "ConfigModuleRole"; return roleNames; } @@ -175,6 +176,8 @@ QVariant EffectsModel::data(const QModelIndex &index, int role) const return effect.kind == Kind::Scripted; case EnabledByDefaultRole: return effect.enabledByDefault; + case EnabledByDefaultFunctionRole: + return effect.enabledByDefaultFunction; case ConfigModuleRole: return effect.configModule; default: diff --git a/kcmkwin/common/effectsmodel.h b/kcmkwin/common/effectsmodel.h index 5873fd0f87..7567f6cd6e 100644 --- a/kcmkwin/common/effectsmodel.h +++ b/kcmkwin/common/effectsmodel.h @@ -108,7 +108,11 @@ public: /** * Id of the effect's config module, empty if the effect has no config. */ - ConfigModuleRole + ConfigModuleRole, + /** + * Whether the effect has a function to determine if the effect is enabled by default. + */ + EnabledByDefaultFunctionRole, }; /** diff --git a/kcmkwin/kwineffects/package/contents/ui/Effect.qml b/kcmkwin/kwineffects/package/contents/ui/Effect.qml index cd8f2947a0..9c8082148e 100644 --- a/kcmkwin/kwineffects/package/contents/ui/Effect.qml +++ b/kcmkwin/kwineffects/package/contents/ui/Effect.qml @@ -11,6 +11,7 @@ import QtQuick.Controls 2.5 as QQC2 import QtQuick.Layouts 1.1 import org.kde.kirigami 2.5 as Kirigami +import org.kde.kcm 1.5 as KCM Kirigami.SwipeListItem { id: listItem @@ -39,6 +40,10 @@ Kirigami.SwipeListItem { } _toggled = false; } + + KCM.SettingHighlighter { + highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole + } } QQC2.CheckBox { @@ -46,6 +51,10 @@ Kirigami.SwipeListItem { visible: model.ExclusiveRole == "" onToggled: model.StatusRole = checkState + + KCM.SettingHighlighter { + highlight: model.EnabledByDefaultFunctionRole ? parent.checkState !== Qt.PartiallyChecked : parent.checked !== model.EnabledByDefaultRole + } } ColumnLayout {