diff --git a/app/view/indicator/indicator.cpp b/app/view/indicator/indicator.cpp index 411eecdb7..0a986d71c 100644 --- a/app/view/indicator/indicator.cpp +++ b/app/view/indicator/indicator.cpp @@ -343,6 +343,8 @@ void Indicator::updateScheme() if (prevConfiguration) { prevConfiguration->deleteLater(); } + + emit configurationChanged(); } void Indicator::loadConfig() diff --git a/app/view/indicator/indicator.h b/app/view/indicator/indicator.h index e9e659cd3..27bb1d4ba 100644 --- a/app/view/indicator/indicator.h +++ b/app/view/indicator/indicator.h @@ -69,7 +69,7 @@ class Indicator: public QObject /** * Configuration object: each config key will be a writable property of this object. property bindings work. */ - Q_PROPERTY(QObject *configuration READ configuration NOTIFY pluginChanged) + Q_PROPERTY(QObject *configuration READ configuration NOTIFY configurationChanged) Q_PROPERTY(QQmlComponent *component READ component NOTIFY pluginChanged) Q_PROPERTY(QQmlComponent *plasmaComponent READ plasmaComponent NOTIFY plasmaComponentChanged) @@ -129,6 +129,7 @@ signals: void customPluginsChanged(); void enabledChanged(); void enabledForAppletsChanged(); + void configurationChanged(); void customPluginChanged(); void infoChanged(); void latteTasksArePresentChanged(); diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 7bd6115a5..145cc3290 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -795,7 +795,7 @@ Item { visualParent: appletItem indicatorsHost: indicators level.isBackground: true - level.bridge: appletIndicatorObj + level.indicator: appletIndicatorObj Loader{ anchors.fill: parent @@ -844,7 +844,7 @@ Item { visualParent: appletItem indicatorsHost: indicators level.isForeground: true - level.bridge: appletIndicatorObj + level.indicator: appletIndicatorObj } //! Applet Shortcut Visual Badge diff --git a/containment/package/contents/ui/indicators/Manager.qml b/containment/package/contents/ui/indicators/Manager.qml index f470e9b8b..01414ab14 100644 --- a/containment/package/contents/ui/indicators/Manager.qml +++ b/containment/package/contents/ui/indicators/Manager.qml @@ -27,8 +27,8 @@ import org.kde.latte.abilities.items 0.1 as AbilityItem Item{ id: managerIndicator - readonly property QtObject configuration: latteView && latteView.indicator ? latteView.indicator.configuration : null - readonly property QtObject resources: latteView && latteView.indicator ? latteView.indicator.resources : null + readonly property QtObject configuration: latteView && latteView.indicator && latteView.indicator.configuration ? latteView.indicator.configuration : null + readonly property QtObject resources: latteView && latteView.indicator && latteView.indicator.resources ? latteView.indicator.resources : null readonly property bool isEnabled: latteView && latteView.indicator ? (latteView.indicator.enabled && latteView.indicator.pluginIsReady @@ -128,7 +128,7 @@ Item{ indicatorsHost: managerIndicator level.isDrawn: true level.isBackground: true - level.bridge: AbilityItem.IndicatorObject{} + level.indicator: AbilityItem.IndicatorObject{} } //! Bindings in order to inform View::Indicator diff --git a/containment/package/contents/ui/layouts/EnvironmentActions.qml b/containment/package/contents/ui/layouts/EnvironmentActions.qml index 2b5528ff3..a7092d593 100644 --- a/containment/package/contents/ui/layouts/EnvironmentActions.qml +++ b/containment/package/contents/ui/layouts/EnvironmentActions.qml @@ -212,15 +212,15 @@ Loader { onTriggered: mainArea.wheelIsBlocked = false; } - //! Background Indicator - AbilityItem.IndicatorLevel{ + //! Background Indicator + AbilityItem.IndicatorLevel { id: indicatorBackLayer anchors.fill: parent indicatorsHost: root.indicators level.isDrawn: true level.isBackground: true - level.bridge: AbilityItem.IndicatorObject{ + level.indicator: AbilityItem.IndicatorObject{ animations: root.animations metrics: root.metrics indicatorsHost: root.indicators diff --git a/declarativeimports/abilities/items/IndicatorLevel.qml b/declarativeimports/abilities/items/IndicatorLevel.qml index c9cc9d40e..b752d8d86 100644 --- a/declarativeimports/abilities/items/IndicatorLevel.qml +++ b/declarativeimports/abilities/items/IndicatorLevel.qml @@ -25,7 +25,7 @@ import "./indicators" as IndicatorItem Loader { id: indicatorLevelLoader - active: level.isDrawn && indicatorsHost.isReady && (level.isBackground || (level.isForeground && indicatorsHost.info.providesFrontLayer)) + active: level.isDrawn && indicatorsHost.isEnabled && (level.isBackground || (level.isForeground && indicatorsHost.info.providesFrontLayer)) sourceComponent: indicatorsHost.indicatorComponent property Item visualParent: null diff --git a/declarativeimports/abilities/items/indicators/LevelOptions.qml b/declarativeimports/abilities/items/indicators/LevelOptions.qml index 8081de75e..bbfece444 100644 --- a/declarativeimports/abilities/items/indicators/LevelOptions.qml +++ b/declarativeimports/abilities/items/indicators/LevelOptions.qml @@ -34,7 +34,7 @@ Item { property int iconOffsetY: 0 } - property Item bridge: null + property Item indicator: null onIsBackgroundChanged: { isForeground = !isBackground; diff --git a/declarativeimports/components/IndicatorItem.qml b/declarativeimports/components/IndicatorItem.qml index 14d7b6632..11efc5caf 100644 --- a/declarativeimports/components/IndicatorItem.qml +++ b/declarativeimports/components/IndicatorItem.qml @@ -21,7 +21,19 @@ import QtQuick 2.7 Item { readonly property Item level: parent && parent.hasOwnProperty("level") ? parent.level : null - readonly property Item indicator: parent && parent.hasOwnProperty("level") ? parent.level.bridge : null + readonly property Item indicator: { + if (!level) { + return null; + } + + if (level.hasOwnProperty("bridge")) { + return level.bridge; + } else if (level.hasOwnProperty("indicator")) { + return level.indicator.publicApi; + } + + return null; + } //! indicator is using main colors from icon e.g. unity style property bool needsIconColors: false diff --git a/plasmoid/package/contents/ui/task/indicator/Loader.qml b/plasmoid/package/contents/ui/task/indicator/Loader.qml index 7cc042a9d..51b69ba3f 100644 --- a/plasmoid/package/contents/ui/task/indicator/Loader.qml +++ b/plasmoid/package/contents/ui/task/indicator/Loader.qml @@ -32,7 +32,7 @@ Loader { anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined - active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) + active: level.bridge && level.bridge.active && indicators.isEnabled && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) sourceComponent: { if (!indicators) { return; diff --git a/shell/package/contents/configuration/pages/EffectsConfig.qml b/shell/package/contents/configuration/pages/EffectsConfig.qml index 65c89bd82..4a2b1619d 100644 --- a/shell/package/contents/configuration/pages/EffectsConfig.qml +++ b/shell/package/contents/configuration/pages/EffectsConfig.qml @@ -565,6 +565,7 @@ PlasmaComponents.Page { //! Manager / Handler of loading/showing/hiding indicator config uis LatteExtraControls.IndicatorConfigUiManager { + id: indicatorUiManager visible: false stackView: indicatorsStackView } diff --git a/shell/package/contents/controls/IndicatorConfigUiManager.qml b/shell/package/contents/controls/IndicatorConfigUiManager.qml index eefadc8e6..a77cdf1aa 100644 --- a/shell/package/contents/controls/IndicatorConfigUiManager.qml +++ b/shell/package/contents/controls/IndicatorConfigUiManager.qml @@ -23,10 +23,16 @@ import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore Item { + id: uiManager visible: false property Item stackView: null + //! it is used during first window creation in order to avoid clearing custom indicators from its views + //! when the window is created the current view indicator type is stored and restored after + //! the tabBar of indicators has completed its creation/initialization + property string typeDuringCreation: "" + Item { id: hiddenIndicatorPage anchors.fill: parent @@ -37,11 +43,6 @@ Item { readonly property Item nextPage: stackView.currentItem === page1 ? page2 : page1 readonly property Item previousPage: nextPage === page1 ? page2 : page1 - //! it is used during first window creation in order to avoid clearing custom indicators from its views - //! when the window is created the current view indicator type is stored and restored after - //! the tabBar of indicators has completed its creation/initialization - property string typeDuringCreation: "" - function showNextIndicator() { var nextIndicator; @@ -95,7 +96,7 @@ Item { tabBar.selectTab(latteView.indicator.type); if (latteView.indicator.type !== latteBtn.type) { - typeDuringCreation = latteView.indicator.type; + uiManager.typeDuringCreation = latteView.indicator.type; } viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView); @@ -105,15 +106,15 @@ Item { target: latteView.indicator onPluginChanged: { if (viewConfig.isReady) { - if (hiddenIndicatorPage.typeDuringCreation === "") { + if (uiManager.typeDuringCreation === "") { tabBar.selectTab(latteView.indicator.type); viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView); } else { //! restore the first assigned indicator after first window creation. This way we avoid //! unsetting custom indicators from views during first settings window creation. - latteView.indicator.type = hiddenIndicatorPage.typeDuringCreation; + latteView.indicator.type = uiManager.typeDuringCreation; tabBar.selectTab(latteView.indicator.type); - hiddenIndicatorPage.typeDuringCreation = ""; + uiManager.typeDuringCreation = ""; } } }