mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
Clean up variants from bar whhen removed from plugin data
This commit is contained in:
@@ -256,6 +256,7 @@ FocusScope {
|
||||
anchors.bottomMargin: pluginDelegate.isExpanded ? settingsContainer.height : 0
|
||||
hoverEnabled: true
|
||||
cursorShape: pluginDelegate.hasSettings ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
enabled: !pluginDelegate.isExpanded || !pluginDelegate.hasSettings
|
||||
onClicked: {
|
||||
if (pluginDelegate.hasSettings) {
|
||||
pluginsTab.expandedPluginId = pluginsTab.expandedPluginId === pluginDelegate.pluginId ? "" : pluginDelegate.pluginId
|
||||
@@ -504,6 +505,10 @@ FocusScope {
|
||||
clip: true
|
||||
focus: pluginDelegate.isExpanded && pluginDelegate.hasSettings
|
||||
|
||||
Keys.onPressed: event => {
|
||||
event.accepted = true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.surfaceContainerHighest
|
||||
|
||||
@@ -402,9 +402,38 @@ Singleton {
|
||||
const variants = getPluginVariants(pluginId)
|
||||
const newVariants = variants.filter(function(v) { return v.id !== variantId })
|
||||
SettingsData.setPluginSetting(pluginId, "variants", newVariants)
|
||||
|
||||
const fullId = pluginId + ":" + variantId
|
||||
removeWidgetFromDankBar(fullId)
|
||||
|
||||
pluginDataChanged(pluginId)
|
||||
}
|
||||
|
||||
function removeWidgetFromDankBar(widgetId) {
|
||||
function filterWidget(widget) {
|
||||
const id = typeof widget === "string" ? widget : widget.id
|
||||
return id !== widgetId
|
||||
}
|
||||
|
||||
const leftWidgets = SettingsData.dankBarLeftWidgets
|
||||
const centerWidgets = SettingsData.dankBarCenterWidgets
|
||||
const rightWidgets = SettingsData.dankBarRightWidgets
|
||||
|
||||
const newLeft = leftWidgets.filter(filterWidget)
|
||||
const newCenter = centerWidgets.filter(filterWidget)
|
||||
const newRight = rightWidgets.filter(filterWidget)
|
||||
|
||||
if (newLeft.length !== leftWidgets.length) {
|
||||
SettingsData.setDankBarLeftWidgets(newLeft)
|
||||
}
|
||||
if (newCenter.length !== centerWidgets.length) {
|
||||
SettingsData.setDankBarCenterWidgets(newCenter)
|
||||
}
|
||||
if (newRight.length !== rightWidgets.length) {
|
||||
SettingsData.setDankBarRightWidgets(newRight)
|
||||
}
|
||||
}
|
||||
|
||||
function updatePluginVariant(pluginId, variantId, variantConfig) {
|
||||
const variants = getPluginVariants(pluginId)
|
||||
for (let i = 0; i < variants.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user