Skip to content

Commit c311f7a

Browse files
committed
fix: use desktop-id as fallback name for ill-formed desktop entries
针对一些不规范的 desktop 文件,例如没有提供当前地区的显示名称,也没有 提供默认(无地区)显示名称的情况下,fallback到使用原始 desktop id 作为 对用户呈现的名称. PMS: BUG-349847 Log:
1 parent 2319772 commit c311f7a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/ddeintegration/appmgr.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ static AppMgr::AppItem *parseDBus2AppItem(const ObjectInterfaceMap &source)
9494
parseDBusField<QStringMap>(appInfo, u8"Name").value(),
9595
parseDBusField<QStringMap>(appInfo, u8"GenericName").value());
9696

97+
// just in case the entry is ill-formed, doesn't have a valid display name, fallback to use its desktop-id instead.
98+
if (item->displayName.isEmpty()) {
99+
item->displayName = item->id;
100+
}
101+
97102
if (auto value = parseDBusField<QStringMap>(appInfo, u8"Name")) {
98103
item->name = parseName(value.value());
99104
}

0 commit comments

Comments
 (0)