fix: update search filter logic and visibility#595
Conversation
Reviewer's GuideThis PR exposes the Desktop ID search as a public API by updating its visibility in the model configuration and refactors the search filter proxy logic to simplify package name filtering by inlining and removing redundant conditionals. Entity relationship diagram for Desktop ID search API visibilityerDiagram
SEARCHFILTERPROXYMODEL ||--o{ DESKTOP_ID_SEARCH : exposes
DESKTOP_ID_SEARCH {
visibility PUBLIC
}
Class diagram for updated SearchFilterProxyModel search logicclassDiagram
class SearchFilterProxyModel {
- m_searchPackageEnabled: bool
+ calculateWeight(modelIndex: QModelIndex): int
}
SearchFilterProxyModel : calculateWeight() now always adds desktopId search to matchTypes
SearchFilterProxyModel : desktopId search conditional simplified
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @wjyrich - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/models/searchfilterproxymodel.cpp:271` </location>
<code_context>
// 包名搜索(仅在配置启用时生效)
- if (m_searchPackageEnabled) {
- matchTypes.push_back(qMakePair(QString("desktopId"), [&]() -> bool {
+ matchTypes.push_back(qMakePair(QString("desktopId"), [&]() -> bool {
+ if (m_searchPackageEnabled)
return desktopIdLower.contains(searchPatternLower);
}));
</code_context>
<issue_to_address>
The lambda may return an undefined value if m_searchPackageEnabled is false.
Explicitly return false in the else branch to avoid undefined behavior and ensure the lambda always returns a boolean value.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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. 通过移除包搜索中不必要的嵌套条件改善了代码结构
14d0106 to
2086850
Compare
deepin pr auto review代码审查意见:
综上所述,代码重构提高了代码的可读性和维护性,但是可能略微影响性能。如果 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, wjyrich The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
fix: 更新搜索过滤逻辑和可见性
Summary by Sourcery
Expose Desktop ID search publicly and simplify the search filter logic by moving the enable check into the matching predicate and eliminating unnecessary nesting.
Bug Fixes:
Enhancements: