Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Reviewer's GuideThis refactor standardizes and migrates folder IDs while making AppGroupManager testable with generic in-memory models, deferring reference synchronization safely, exposing QML arrangement APIs, and hardening drag/drop and pagination edge cases with comprehensive regression tests. Sequence diagram for deferred app arrangement synchronizationsequenceDiagram
participant ReferenceModel
participant AppGroupManager
participant SyncTimer
participant Config
ReferenceModel->>AppGroupManager: rowsInserted / rowsRemoved / dataChanged
AppGroupManager->>SyncTimer: scheduleReferenceSync()
SyncTimer-->>AppGroupManager: timeout
AppGroupManager->>AppGroupManager: onReferenceModelChanged()
AppGroupManager->>Config: saveAppGroupInfo()
AppGroupManager-->>AppGroupManager: notifyArrangementChanged()
Sequence diagram for legacy arrangement migrationsequenceDiagram
participant AppGroupManager
participant DConfig
participant LegacyINI
AppGroupManager->>DConfig: value(ArrangementMigrated)
alt Migration already completed
DConfig-->>AppGroupManager: true
else Migration required
AppGroupManager->>LegacyINI: read item-arrangement.ini
LegacyINI-->>AppGroupManager: legacy groups and desktop IDs
AppGroupManager->>DConfig: setValue(Groups)
AppGroupManager->>DConfig: setValue(ArrangementMigrated, true)
end
Flow diagram for folder-aware drag and dropflowchart TD
Start[rearrange dragId dropId operation pageHint] --> Normalize[Normalize desktop suffix]
Normalize --> Find[findItem]
Find --> Valid{Positions valid?}
Valid -- No --> Ignore[Ignore operation]
Valid -- Yes --> Operation{DndJoin?}
Operation -- Yes --> JoinChecks[Validate folder and page bounds]
JoinChecks --> MoveInto[Move item into destination folder]
Operation -- No --> Nested{Nested folder drop?}
Nested -- Yes --> Ignore
Nested -- No --> Reorder[Reorder or move between pages]
MoveInto --> Persist[saveAppGroupInfo]
Reorder --> Persist
Persist --> Notify[notifyArrangementChanged]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="applets/dde-apps/appgroupmanager.cpp" line_range="356-389" />
<code_context>
+ const auto saved = m_config->value("Groups").toList();
</code_context>
<issue_to_address>
**Top-level folder is missing on first run**
When the configuration has no saved Groups entry, as on a fresh install without an imported arrangement, `loadAppGroupInfo()` appends only saved records, so with no saved groups it creates no top-level folder. `onReferenceModelChanged()` then cannot add applications because `appendItemToGroup()` returns when group 0 is absent; the launcher starts with no arranged apps.
Ensure group 0 is created during loading before adding or recovering any applications.
</issue_to_address>2458733 to
7fbb039
Compare
|
TAG Bot New tag: 2.0.61 |
1. Fix folder ID parsing off-by-one bug and standardize canonical prefix
from "internal/folder/" to "internal/folders/"
2. Support legacy ID formats ("internal/folder/", "internal/group/")
during loading while always writing the canonical plural form
3. Decouple AppGroupManager from AMAppItemModel, using
QAbstractItemModel allowing in-memory test sources
4. Add DConfig injection constructor for testability with memory backend
5. Coalesce reference model changes into a single refresh using a zero-
delay timer, avoiding mutations during begin/endRemoveRows transactions
6. Guard against stale drag coordinates, out-of-range page indices, and
nested folder drops
7. Handle last-child removal from a folder when dropped onto its own
folder slot
8. Detect ready property on reference model to avoid pruning folders
before app metadata is loaded
9. Migrate legacy launchpad INI only once with ArrangementMigrated flag,
keeping INI as backup
10. Add QML-invokable APIs: itemPosition, folderInfo, pageCount,
updateFolderName, createEmptyPage, removeEmptyPages, rearrange,
bringToFront
11. Rename bringToFromt to bringToFront and accept .desktop suffix
12. Add comprehensive test suite appgroupmanagertests.cpp covering
folder creation, renaming, moves, migration, and persistence
13. Fix ItemsPage firstNItems(0) and bounds handling in insertItem/
insertItemToPage/moveItemPosition
Log: Fixed folder management stability, drag-drop edge cases, and legacy
config migration
Influence:
1. Verify folder creation by dragging one app onto another
2. Test folder rename and persistence across restarts
3. Test dragging apps in/out of folders at page boundaries
4. Verify last child app can be moved out of a folder without losing
position
5. Test folder cannot be nested into another folder
6. Verify stale drag drops are ignored gracefully
7. Test launchpad INI migration runs only once and is preserved
8. Verify apps with .desktop suffix are handled correctly
9. Test empty page creation and removal
10. Verify top-level always exists even with empty app set
11. Run appgroupmanager_tests and itemspage_tests unit tests
refactor: 修复应用分组管理和文件夹ID
1. 修复文件夹ID解析的偏移错误,并将标准前缀从 "internal/folder/" 改为
"internal/folders/"
2. 加载时支持旧格式ID("internal/folder/"、"internal/group/"),但写入时
始终使用规范的复数形式
3. 将AppGroupManager与AMAppItemModel解耦,改用QAbstractItemModel以支持内
存测试源
4. 添加DConfig注入构造函数以便使用内存后端进行测试
5. 使用零延迟定时器合并参考模型变更,避免在begin/endRemoveRows事务期间修
改数据
6. 对过期的拖拽坐标、越界页码和嵌套文件夹拖放进行防护
7. 处理文件夹中最后一个子项被拖放到其自身文件夹位置的情况
8. 检测参考模型的ready属性,避免在应用元数据加载前清理文件夹
9. 使用ArrangementMigrated标志确保旧版启动器INI仅迁移一次,同时保留INI作
为备份
10. 添加QML可调用的API:itemPosition、folderInfo、pageCount、
updateFolderName、createEmptyPage、removeEmptyPages、rearrange、
bringToFront
11. 将bringToFromt重命名为bringToFront并支持.desktop后缀
12. 添加全面的测试套件appgroupmanagertests.cpp,覆盖文件夹创建、重命名、
移动、迁移和持久化
13. 修复ItemsPage firstNItems(0)以及insertItem/insertItemToPage/
moveItemPosition的边界处理
Log: 修复文件夹管理稳定性、拖放边界情况和旧版配置迁移
Influence:
1. 验证通过将一个应用拖到另一个应用上创建文件夹
2. 测试文件夹重命名及重启后的持久化
3. 测试在页面边界处将应用拖入/拖出文件夹
4. 验证最后一个子应用可以移出文件夹且不丢失位置
5. 测试文件夹不能嵌套到另一个文件夹中
6. 验证过期拖放操作被优雅忽略
7. 测试启动器INI迁移只运行一次并被保留
8. 验证带.desktop后缀的应用被正确处理
9. 测试空页面的创建和删除
10. 验证即使应用集为空,顶层也始终存在
11. 运行appgroupmanager_tests和itemspage_tests单元测试
PMS: TASK-396759
7fbb039 to
dbea6e4
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['代码逻辑清晰,无需修改'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['建议将 commitRearrangeOperation 中的同文件夹移动、跨文件夹移动、加入文件夹三个分支提取为独立的私有方法', '建议为 launchpadArrangementConfigMigration 中的 importGroups lambda 提取为独立的私有方法'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['性能表现良好,无需优化'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['安全合规,无需加固'] 💡 改进建议代码示例// 建议:将 commitRearrangeOperation 中的分支提取为子方法以提升可读性
// 示例(appgroupmanager.cpp):
//
// void AppGroupManager::commitRearrangeOperation(const QString &dragId, const QString &dropId,
// DndOperation operation, int pageHint)
// {
// // ... 前置校验 ...
//
// if (operation != DndOperation::DndJoin) {
// if (dragOrigPos.group() == dropOrigPos.group()) {
// moveWithinFolder(dragOrigPos, dropOrigPos, operation);
// } else {
// moveAcrossFolders(dragId, dropId, dragOrigPos, dropOrigPos, operation);
// }
// } else {
// joinOrCreateFolder(dragId, dropId, dragOrigPos, dropOrigPos, pageHint);
// }
//
// saveAppGroupInfo();
// notifyArrangementChanged();
// }本报告由 AI 代码审查工具自动生成 |
Log: Fixed folder management stability, drag-drop edge cases, and legacy config migration
Influence:
refactor: 修复应用分组管理和文件夹ID
Log: 修复文件夹管理稳定性、拖放边界情况和旧版配置迁移
Influence:
PMS: TASK-396759
Summary by Sourcery
Stabilize app group and folder management with canonical IDs, safer rearrangement behavior, testable model/configuration dependencies, and one-time legacy arrangement migration.
New Features:
Bug Fixes:
Enhancements:
Tests: