feat: 增加从任务栏拖动图标到回收站后移除驻留的功能

对于非驻留图标,调用unDock接口的时候,让其直接从列表中移除

Log: 增加从任务栏拖动图标到回收站后移除驻留的功能
Influence: 任务栏-拖动图标到回收站,观察该图标是否移除
Bug: https://pms.uniontech.com/bug-view-147699.html
Change-Id: I99ac17f905e10855b77bed5752b7bafa30883cee
This commit is contained in:
donghualin 2022-07-29 10:21:21 +00:00
parent d7d2f252b7
commit fd19bc4cf2
2 changed files with 14 additions and 0 deletions

View File

@ -137,6 +137,9 @@ bool Dock::dockEntry(Entry *entry, bool moveToEnd)
QString newDesktopFile;
if (app) {
QString newFile = scratchDir + app->getInnerId() + ".desktop";
// 在目标文件存在的情况下,先删除,防止出现驻留不成功的情况
if (QFile::exists(newFile))
QFile::remove(newFile);
if (file.copy(app->getFileName(), newFile))
newDesktopFile = newFile;
} else {
@ -196,6 +199,13 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
{
if (!entry->getIsDocked()) {
qInfo() << "undockEntry: " << entry->getId() << " is not docked";
// 在当前未驻留的情况下执行取消驻留操作,则让其直接从当前列表中移除
// 这种情况一般是在从最近打开应用中拖动应用到回收站的时候执行的操作
if (!entry->hasWindow()) {
// 没有子窗口的情况下,从列表中移除
removeAppEntry(entry);
saveDockedApps();
}
return;
}

View File

@ -627,6 +627,10 @@ void Entry::forceQuit()
}
}
}
// 所有的窗口已经退出后清空m_windowInfoMap内容
m_windowInfoMap.clear();
// 退出所有的进程后,及时更新当前剩余的窗口数量
updateExportWindowInfos();
}
void Entry::presentWindows()