mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -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
|
anchors.bottomMargin: pluginDelegate.isExpanded ? settingsContainer.height : 0
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: pluginDelegate.hasSettings ? Qt.PointingHandCursor : Qt.ArrowCursor
|
cursorShape: pluginDelegate.hasSettings ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
enabled: !pluginDelegate.isExpanded || !pluginDelegate.hasSettings
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (pluginDelegate.hasSettings) {
|
if (pluginDelegate.hasSettings) {
|
||||||
pluginsTab.expandedPluginId = pluginsTab.expandedPluginId === pluginDelegate.pluginId ? "" : pluginDelegate.pluginId
|
pluginsTab.expandedPluginId = pluginsTab.expandedPluginId === pluginDelegate.pluginId ? "" : pluginDelegate.pluginId
|
||||||
@@ -504,6 +505,10 @@ FocusScope {
|
|||||||
clip: true
|
clip: true
|
||||||
focus: pluginDelegate.isExpanded && pluginDelegate.hasSettings
|
focus: pluginDelegate.isExpanded && pluginDelegate.hasSettings
|
||||||
|
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: Theme.surfaceContainerHighest
|
color: Theme.surfaceContainerHighest
|
||||||
|
|||||||
@@ -402,9 +402,38 @@ Singleton {
|
|||||||
const variants = getPluginVariants(pluginId)
|
const variants = getPluginVariants(pluginId)
|
||||||
const newVariants = variants.filter(function(v) { return v.id !== variantId })
|
const newVariants = variants.filter(function(v) { return v.id !== variantId })
|
||||||
SettingsData.setPluginSetting(pluginId, "variants", newVariants)
|
SettingsData.setPluginSetting(pluginId, "variants", newVariants)
|
||||||
|
|
||||||
|
const fullId = pluginId + ":" + variantId
|
||||||
|
removeWidgetFromDankBar(fullId)
|
||||||
|
|
||||||
pluginDataChanged(pluginId)
|
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) {
|
function updatePluginVariant(pluginId, variantId, variantConfig) {
|
||||||
const variants = getPluginVariants(pluginId)
|
const variants = getPluginVariants(pluginId)
|
||||||
for (let i = 0; i < variants.length; i++) {
|
for (let i = 0; i < variants.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user