fix: 在Dock接收到EntryAdded信号时,先判断是否存在相同appID的应用

Dock的Daemon守护进程在应用打开时,有时会连续发送多次EntryAdded信号,Dock在接收到多个信号时,会在界面上创建多个相同的应用
图标,因此在接收到此信号时,先判断下是否已经存在相同appID的应用图标,如果存在则不再创建图标。

Log: 修复反复启动画板,任务栏会出现双图标问题(bug: 38782)
Bug: https://pms.uniontech.com/zentao/bug-view-38782.html
Change-Id: I730ca14be1c466f50f579d3237e989fd95a4756e
This commit is contained in:
chenjun 2020-07-22 17:08:59 +08:00
parent 40af8358d5
commit 0187ab1151
2 changed files with 10 additions and 0 deletions

View File

@ -190,6 +190,12 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
}
AppItem *item = new AppItem(path);
if (m_appIDist.contains(item->appId())) {
delete item;
return;
}
manageItem(item);
connect(item, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection);
@ -197,6 +203,7 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
connect(item, &AppItem::requestCancelPreview, m_appInter, &DBusDock::CancelPreviewWindow);
m_itemList.insert(insertIndex, item);
m_appIDist.append(item->appId());
if (index != -1) {
emit itemInserted(insertIndex - 1, item);
@ -220,6 +227,8 @@ void DockItemManager::appItemRemoved(const QString &appId)
appItemRemoved(app);
}
}
m_appIDist.removeAll(appId);
}
void DockItemManager::appItemRemoved(AppItem *appItem)

View File

@ -79,6 +79,7 @@ private:
static DockItemManager *INSTANCE;
QList<QPointer<DockItem>> m_itemList;
QList<QString> m_appIDist;
};
#endif // DOCKITEMMANAGER_H