fix: 修复新装应用没有排列在首位的问题
问题背景: 本地存在deb包格式应用A或者存在linglong包格式应用A时,新装应用没有排列在小窗口-所有应用列表-首位的问题 修改思路: 遍历时使用desktop全路径作为键值对的key,而不是用二进制的应用名称 Log: Influence: 启动器-新装应用-在小窗口所有应用列表中排列在首位 Bug: https://pms.uniontech.com/bug-view-150623.html Change-Id: I29a2c9d0c68f0fcf65e864c2048515e12009341f
This commit is contained in:
parent
288f7ab65f
commit
e70b17eea1
@ -531,42 +531,40 @@ void Launcher::onCheckDesktopFile(const QString &filePath, int type)
|
||||
{
|
||||
Q_UNUSED(type);
|
||||
|
||||
QString appId = getAppIdByFilePath(filePath, appDirs);
|
||||
if (appId.isEmpty())
|
||||
if (filePath.isEmpty()) {
|
||||
qWarning() << "Desktop path is empty. ";
|
||||
return;
|
||||
}
|
||||
|
||||
DesktopInfo info(filePath.toStdString());
|
||||
if (info.isValidDesktop()) {
|
||||
Item newItem = NewItemWithDesktopInfo(info);
|
||||
newItem.info.id = getAppIdByFilePath(newItem.info.path, appDirs);
|
||||
bool shouldShow = info.shouldShow() &&
|
||||
!isDeepinCustomDesktopFile(newItem.info.path) &&
|
||||
!appsHidden.contains(newItem.info.id);
|
||||
|
||||
// update item
|
||||
if (itemsMap.find(appId) != itemsMap.end()) {
|
||||
if (m_desktopAndItemMap.find(filePath) != m_desktopAndItemMap.end()) {
|
||||
if (shouldShow) {
|
||||
// update item
|
||||
addItem(newItem);
|
||||
emitItemChanged(&newItem, appStatusModified);
|
||||
} else {
|
||||
itemsMap.remove(appId);
|
||||
// hide item
|
||||
emitItemChanged(&newItem, appStatusDeleted);
|
||||
}
|
||||
} else if (shouldShow){ // add item
|
||||
} else if (shouldShow) {
|
||||
if (info.isExecutableOk()) {
|
||||
// add item
|
||||
addItem(newItem);
|
||||
emitItemChanged(&newItem, appStatusCreated);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (itemsMap.find(appId) != itemsMap.end()) {
|
||||
Item item = itemsMap[appId];
|
||||
if (m_desktopAndItemMap.find(filePath) != m_desktopAndItemMap.end()) {
|
||||
// remove item
|
||||
const Item &item = itemsMap[filePath];
|
||||
removeDesktop(filePath);
|
||||
emitItemChanged(&item, appStatusDeleted);
|
||||
itemsMap.remove(appId);
|
||||
|
||||
// 移除桌面上对应文件
|
||||
QFile file(QDir::homePath() + "/Desktop" + appId + ".desktop");
|
||||
file.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -623,13 +621,13 @@ void Launcher::handleAppHiddenChanged()
|
||||
if (itemsMap.find(appId) == itemsMap.end())
|
||||
continue;
|
||||
|
||||
DesktopInfo info = DesktopInfo(appId.toStdString());
|
||||
DesktopInfo info = DesktopInfo(itemsMap[appId].info.path.toStdString());
|
||||
if (!info.isValidDesktop()) {
|
||||
qInfo() << "appId " << appId << "is invalid app";
|
||||
qWarning() << "invalid Desktop Path";
|
||||
continue;
|
||||
}
|
||||
|
||||
Item item = NewItemWithDesktopInfo(info);
|
||||
item.info.id = getAppIdByFilePath(item.info.path, appDirs);
|
||||
|
||||
if (!(info.shouldShow() && !isDeepinCustomDesktopFile(info.getFileName().c_str())))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user