Skip to content

Commit fda5a9b

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: update search filter logic and visibility
1. Changed Desktop ID search visibility from private to public in model configuration 2. Refactored search filter logic to simplify conditional check for package name search 3. The Desktop ID search feature is now properly exposed as a public API 4. Improved code structure by removing unnecessary nested condition for package search fix: 更新搜索过滤逻辑和可见性 1. 将模型配置中的Desktop ID搜索可见性从私有改为公开 2. 重构了搜索过滤逻辑,简化了包名搜索的条件检查 3. Desktop ID搜索功能现在作为公共API正确暴露 4. 通过移除包搜索中不必要的嵌套条件改善了代码结构
1 parent 8ba54e2 commit fda5a9b

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/models/org.deepin.ds.launchpad.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"description": "Whether to allow the search for Desktop ID during the search.",
8686
"description[zh_CN]": "在搜索时候是否允许搜索Desktop ID。",
8787
"permissions": "readwrite",
88-
"visibility": "private"
88+
"visibility": "public"
8989
}
9090
}
9191
}

src/models/searchfilterproxymodel.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,10 @@ int SearchFilterProxyModel::calculateWeight(const QModelIndex &modelIndex) const
267267
}));
268268

269269
// 包名搜索(仅在配置启用时生效)
270-
if (m_searchPackageEnabled) {
271-
matchTypes.push_back(qMakePair(QString("desktopId"), [&]() -> bool {
272-
return desktopIdLower.contains(searchPatternLower);
273-
}));
274-
}
270+
matchTypes.push_back(qMakePair(QString("desktopId"), [&]() -> bool {
271+
if (!m_searchPackageEnabled) return false;
272+
return desktopIdLower.contains(searchPatternLower);
273+
}));
275274

276275
// 计算匹配索引(索引越小优先级越高)
277276
auto it = std::find_if(matchTypes.begin(), matchTypes.end(),

0 commit comments

Comments
 (0)