diff --git a/shell/package/contents/configuration/pages/EffectsConfig.qml b/shell/package/contents/configuration/pages/EffectsConfig.qml index 58e145e3e..38b7d301e 100644 --- a/shell/package/contents/configuration/pages/EffectsConfig.qml +++ b/shell/package/contents/configuration/pages/EffectsConfig.qml @@ -518,10 +518,8 @@ PlasmaComponents.Page { implicitWidth: latteBtn.implicitWidth implicitHeight: latteBtn.implicitHeight - checked: parent.type === type - checkable: true + checked: checkable ? parent.type === type : false buttonExclusiveGroup: indicatorStyleGroup - buttonToolTip: i18n("Use %0 style for your indicators and download more custom indicators to use").arg(buttonText) comboBoxMinimumPopUpWidth: 1.5 * customIndicator.width } } diff --git a/shell/package/contents/controls/CustomIndicatorButton.qml b/shell/package/contents/controls/CustomIndicatorButton.qml index aca6f9e68..22bcfbe54 100644 --- a/shell/package/contents/controls/CustomIndicatorButton.qml +++ b/shell/package/contents/controls/CustomIndicatorButton.qml @@ -27,7 +27,10 @@ import org.kde.latte.components 1.0 as LatteComponents LatteComponents.ComboBoxButton{ id: custom + checkable: true + buttonToolTip: checked ? i18n("Use %0 style for your indicators").arg(buttonText) : + i18n("Download indicator styles from the internet") comboBoxTextRole: "name" comboBoxIconRole: "icon" comboBoxBlankSpaceForEmptyIcons: true @@ -37,12 +40,31 @@ LatteComponents.ComboBoxButton{ buttonText: "Unity" property string type: "org.kde.latte.unity" - Component.onCompleted: reloadModel(); + Component.onCompleted: { + reloadModel(); + updateButtonInformation(); + } ListModel { id: actionsModel } + Connections{ + target: latteView.indicator + onCustomPluginsCountChanged: custom.updateButtonInformation() + } + + function updateButtonInformation() { + if (latteView.indicator.customPluginsCount === 0) { + custom.buttonText = i18n("Download"); + custom.checkable = false; + } else { + custom.checkable = true; + custom.buttonText = actionsModel.get(0).name; + custom.type = actionsModel.get(0).pluginId; + } + } + function reloadModel() { var actions = []; @@ -77,11 +99,11 @@ LatteComponents.ComboBoxButton{ function appendDefaults() { //! add - var addElement = {pluginId: 'add:', name: 'Add Indicator...', icon: 'list-add'}; + var addElement = {pluginId: 'add:', name: i18n('Add Indicator...'), icon: 'list-add'}; actionsModel.append(addElement); //! download - var downloadElement = {pluginId: 'download:', name: 'Get New Indicators...', icon: 'favorites'}; + var downloadElement = {pluginId: 'download:', name: i18n('Get New Indicators...'), icon: 'favorites'}; actionsModel.append(downloadElement); }