Repository navigation
feat: add subpath list support to dde-dconfig-daemon - #601
18202781743 wants to merge 4 commits into
Conversation
…subpath support 1. Add virtual subpaths() to DConfigMeta for scanning one-level child directories of override dirs, with default empty implementation to preserve backward compatibility 2. Add virtual cacheSubpaths() to DConfigCache for scanning one-level child directories of cache dirs, with default empty implementation 3. Implement subpaths() override in DConfigMetaImpl to scan allOverrideDirs for child directories, deduplicating results 4. Implement cacheSubpaths() override in DConfigCacheImpl to scan cache directory for child directories 5. Make getCacheDir() const to support const cacheSubpaths() override 6. Update SPDX copyright year to 2026 feat: 添加 subpaths 和 cacheSubpaths 接口支持 dconfig override 子路径获取 1. 在 DConfigMeta 中添加虚函数 subpaths(),扫描 override 目录的一层 子目录,使用默认空实现以保持向后兼容 2. 在 DConfigCache 中添加虚函数 cacheSubpaths(),扫描 cache 目录的一层 子目录,使用默认空实现 3. 在 DConfigMetaImpl 中实现 subpaths() 重写,扫描 allOverrideDirs 的 子目录并去重 4. 在 DConfigCacheImpl 中实现 cacheSubpaths() 重写,扫描 cache 目录的 子目录 5. 将 getCacheDir() 改为 const 以支持 const cacheSubpaths() 重写 6. 更新 SPDX 版权年份至 2026 PMS: TASK-398893 Log: 添加 DConfigMeta::subpaths 和 DConfigCache::cacheSubpaths 接口,支持扫描 override 和 cache 目录的一层子路径 Influence: 外部继承 DConfigMeta/DConfigCache 的子类不受影响,默认返回空列表
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743 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 GuideAPIExpose non-virtual subpath discovery methods on DConfigFile, including the cache helper, without changing the base-class vtables.
ImplementationImplement one-level subpath scanning across metadata override directories and the global cache, and safely handle unsupported cache subclasses.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…esign 1. Remove virtual subpaths() from DConfigMeta base class to avoid ABI-incompatible vtable changes for external derived classes 2. Remove virtual cacheSubpaths() from DConfigCache base class for the same ABI compatibility reason 3. Add non-virtual subpaths() to DConfigFile, scanning allOverrideDirs(true, prefix) and allOverrideDirs(false, prefix) plus global cache directory for one-level child directories 4. Add static cacheSubpaths() to DConfigFile, using static_cast<const DConfigCacheImpl*> for safe downcast 5. Change DConfigCacheImpl::cacheSubpaths() from override to non-virtual method 6. Update SPDX copyright year to 2026 refactor: 将 subpaths/cacheSubpaths 从虚函数改为非虚函数设计 1. 移除 DConfigMeta 基类中的虚函数 subpaths(),避免对外部派生类 造成 ABI 不兼容的 vtable 变更 2. 移除 DConfigCache 基类中的虚函数 cacheSubpaths(),原因同上 3. 在 DConfigFile 中新增非虚 subpaths(),通过 allOverrideDirs(true, prefix) 和 allOverrideDirs(false, prefix) 以及全局 cache 目录扫描一层子目录 4. 在 DConfigFile 中新增 static cacheSubpaths(),使用 static_cast<const DConfigCacheImpl*> 安全向下转型 5. DConfigCacheImpl::cacheSubpaths() 从 override 改为非虚方法 6. 更新 SPDX 版权年份至 2026 PMS: TASK-398893 Log: 将 subpaths 和 cacheSubpaths 从基类虚函数改为 DConfigFile 的非虚/static 方法,避免 ABI 不兼容 Influence: 外部继承 DConfigMeta/DConfigCache 的子类不受影响,vtable 布局不变
1. Replace static_cast with dynamic_cast in DConfigFile::cacheSubpaths() to avoid undefined behavior when an externally created DConfigCache subclass is passed in. 2. Add null check after dynamic_cast, return empty list on failure. 3. Update doc comment to reflect the safer cast approach. PMS: task-view-398893 Log: dconfigfile cacheSubpaths 使用 dynamic_cast 替代 static_cast,避免向下转型 UB 风险 Influence: cacheSubpaths 在传入非 DConfigCacheImpl 类型时安全返回空列表
fix: 修复 QSet::insert().second 编译错误
1. QSet::insert() returns iterator, not std::pair<iterator,bool>
2. Replaced 4 occurrences of seen.insert(subpath).second with
if (!seen.contains(subpath)) { seen.insert(subpath); result << subpath; }
3. Fixes compilation failure on Qt6 where QSet lacks .second member
1. QSet::insert() 返回迭代器而非 std::pair<iterator,bool>
2. 将 4 处 seen.insert(subpath).second 替换为 contains 判断写法
3. 修复 Qt6 下 QSet 没有 .second 成员的编译错误
PMS: TASK-398893
Log: 修复 dtkcore 中 QSet::insert().second 导致的编译失败
Influence: src/dconfigfile.cpp 中 subpaths/cacheSubpaths 函数的去重逻辑
|
关闭此 PR:代码已迁移至新分支 agent/developer/cb163ff66d48(commit c435730),将在新分支上重新创建 PR。关联 issue: DDE-647 |
Description
Add
subpathsandcacheSubpathsinterfaces to DConfigFile for dconfig override subpath support.This is part of the dde-dconfig-daemon subpath list support feature. The dtkcore changes provide the base interfaces that
dde-dconfig-daemonuses to retrieve and manage subpath lists.Related
Summary by Sourcery
Add DConfigFile subpath enumeration interfaces for retrieving override and cache subpath lists.
New Features:
Enhancements: