Skip to content

Commit

Permalink
Revert "fix: dock or undock abnormal function (#546)"
Browse files Browse the repository at this point in the history
  • Loading branch information
18202781743 committed Jul 17, 2024
1 parent 6bc10f1 commit bec98b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions panels/dock/tray/trayitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,18 @@ DockItemInfos TrayItem::dockItemInfos()
return m_itemInfos;
}

void TrayItem::setItemOnDock(const QString &settingKey, const QString &surfaceId, bool visible)
void TrayItem::setItemOnDock(const QString &settingKey, const QString &itemKey, bool visible)
{
Q_UNUSED(settingKey)

visible ? TraySettings::instance()->addTrayItemOnDock(surfaceId) :
TraySettings::instance()->removeTrayItemOnDock(surfaceId);
QString pluginId;
for (const DockItemInfo &itemInfo : m_itemInfos) {
if (itemInfo.itemKey == itemKey) {
pluginId = itemInfo.name;
break;
}
}
visible ? TraySettings::instance()->addTrayItemOnDock(pluginId + "::" + itemKey) :
TraySettings::instance()->removeTrayItemOnDock(pluginId + "::" + itemKey);
}

D_APPLET_CLASS(TrayItem)
Expand Down
2 changes: 1 addition & 1 deletion panels/dock/tray/trayitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TrayItem : public DS_NAMESPACE::DApplet
void setTrayPluginModel(QAbstractItemModel *newTrayPluginModel);

Q_INVOKABLE DockItemInfos dockItemInfos();
Q_INVOKABLE void setItemOnDock(const QString &settingKey, const QString &surfaceId, bool visible);
Q_INVOKABLE void setItemOnDock(const QString &settingKey, const QString &itemKey, bool visible);

Q_SIGNALS:
void trayPluginModelChanged();
Expand Down

0 comments on commit bec98b6

Please sign in to comment.