Skip to content

feat: display all update log details in update list#222

Open
xionglinlin wants to merge 1 commit intolinuxdeepin:masterfrom
xionglinlin:updatelog
Open

feat: display all update log details in update list#222
xionglinlin wants to merge 1 commit intolinuxdeepin:masterfrom
xionglinlin:updatelog

Conversation

@xionglinlin
Copy link
Contributor

  1. Added getDetailInfos method to UpdateListModel to retrieve detailed update information for each item
  2. Modified UpdateLogHelper to include all system update logs in detail info instead of filtering out professional edition versions
  3. Updated UpdateList.qml UI to display detailed update logs with version-specific information and release times
  4. Removed redundant version label and improved layout spacing for better readability
  5. Each update item now shows multiple detailed entries with their own info and release time

Log: Update list now displays detailed version history for each update item

Influence:

  1. Test that update list displays detailed version information for system updates
  2. Verify that all historical update logs are shown for each update item
  3. Check that links within update descriptions are clickable and open correctly
  4. Test UI layout with different theme types (light/dark)
  5. Verify that professional edition versions are no longer filtered out from details
  6. Test with multiple update items to ensure proper rendering of detailed information

feat: 在更新列表中显示所有更新日志详情

  1. 在UpdateListModel中添加getDetailInfos方法,用于获取每个更新项的详细更 新信息
  2. 修改UpdateLogHelper,将所有系统更新日志包含在详细信息中,不再过滤专业 版版本
  3. 更新UpdateList.qml界面,显示详细的更新日志,包含特定版本的信息和发布 时间
  4. 移除了冗余的版本标签,改进了布局间距以提高可读性
  5. 每个更新项现在显示多个详细条目,每个条目都有自己的信息和发布时间

Log: 更新列表现在显示每个更新项的详细版本历史记录

Influence:

  1. 测试更新列表是否显示系统更新的详细版本信息
  2. 验证每个更新项是否显示所有历史更新日志
  3. 检查更新描述中的链接是否可点击并能正确打开
  4. 测试不同主题类型(浅色/深色)下的UI布局
  5. 确认专业版版本不再从详细信息中被过滤掉
  6. 测试多个更新项以确保详细信息正确渲染

1. Added getDetailInfos method to UpdateListModel to retrieve detailed
update information for each item
2. Modified UpdateLogHelper to include all system update logs in detail
info instead of filtering out professional edition versions
3. Updated UpdateList.qml UI to display detailed update logs with
version-specific information and release times
4. Removed redundant version label and improved layout spacing for
better readability
5. Each update item now shows multiple detailed entries with their own
info and release time

Log: Update list now displays detailed version history for each update
item

Influence:
1. Test that update list displays detailed version information for
system updates
2. Verify that all historical update logs are shown for each update item
3. Check that links within update descriptions are clickable and open
correctly
4. Test UI layout with different theme types (light/dark)
5. Verify that professional edition versions are no longer filtered out
from details
6. Test with multiple update items to ensure proper rendering of
detailed information

feat: 在更新列表中显示所有更新日志详情

1. 在UpdateListModel中添加getDetailInfos方法,用于获取每个更新项的详细更
新信息
2. 修改UpdateLogHelper,将所有系统更新日志包含在详细信息中,不再过滤专业
版版本
3. 更新UpdateList.qml界面,显示详细的更新日志,包含特定版本的信息和发布
时间
4. 移除了冗余的版本标签,改进了布局间距以提高可读性
5. 每个更新项现在显示多个详细条目,每个条目都有自己的信息和发布时间

Log: 更新列表现在显示每个更新项的详细版本历史记录

Influence:
1. 测试更新列表是否显示系统更新的详细版本信息
2. 验证每个更新项是否显示所有历史更新日志
3. 检查更新描述中的链接是否可点击并能正确打开
4. 测试不同主题类型(浅色/深色)下的UI布局
5. 确认专业版版本不再从详细信息中被过滤掉
6. 测试多个更新项以确保详细信息正确渲染
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查报告

我对提供的 Git diff 进行了仔细审查,以下是关于语法逻辑、代码质量、代码性能和代码安全的改进意见:

1. 语法逻辑方面

UpdateListModel::getDetailInfos

  • 代码逻辑基本正确,但可以改进边界检查的顺序以提高可读性
  • 建议将 index >= 0 && index < m_updateLists.count() 改为 index < 0 || index >= m_updateLists.count() 的否定形式,减少嵌套层级

UpdateLogHelper::handleSystemItemInfo

  • 移除了对专业版维护线版本的特殊处理逻辑,这需要确认是否符合业务需求
  • 现在所有日志都会被添加到详细信息中,没有条件过滤,可能导致不需要的信息被显示

UpdateList.qml

  • 新增的 Repeater 组件嵌套在 ColumnLayout 中,结构合理
  • 布局调整(spacing 从 6 改为 10)需要确认是否与整体设计一致

2. 代码质量方面

UpdateListModel::getDetailInfos

  • 建议添加函数注释,说明返回值结构和用途
  • 可以考虑使用 std::transform 替代手动循环,使代码更简洁

UpdateLogHelper::handleSystemItemInfo

  • 调试日志 qCDebug 在生产环境中可能产生过多输出,建议使用条件编译或日志级别控制

UpdateList.qml

  • 新增的 Repeater 组件中有重复的布局属性设置,可以考虑提取为共享样式
  • Layout.bottomMargin: -20Layout.bottomMargin: -12 的负边距使用需要谨慎,可能影响布局稳定性

3. 代码性能方面

UpdateListModel::getDetailInfos

  • 每次调用都会创建新的 QVariantList 和 QVariantMap,对于频繁调用可能影响性能
  • 如果数据量大,考虑实现缓存机制或延迟加载

UpdateList.qml

  • Repeater 会在每次模型数据变化时重新创建所有子项,对于大量数据可能影响性能
  • 考虑使用 ListView 替代 Repeater 以获得更好的性能和滚动体验

4. 代码安全方面

UpdateListModel::getDetailInfos

  • 没有对 detailInfo 的内容进行验证,如果数据来自外部源,可能存在注入风险
  • 建议对 link 字段进行 URL 验证,防止恶意链接

UpdateList.qml

  • onLinkActivated 处理函数直接打开链接,没有验证链接安全性
  • 建议添加链接白名单或格式验证

5. 其他建议

  1. 国际化处理

    • 新增的文本内容需要确认是否已添加到翻译文件中
  2. 错误处理

    • 考虑添加更详细的错误处理机制,特别是在数据加载失败的情况下
  3. 测试覆盖

    • 建议为新功能添加单元测试,特别是边界条件和异常情况
  4. 文档更新

    • 如果这些更改影响公共 API,需要更新相关文档

6. 代码改进建议

以下是针对 UpdateListModel::getDetailInfos 的改进代码:

QVariantList UpdateListModel::getDetailInfos(int index) const
{
    QVariantList result;
    
    // 边界检查
    if (index < 0 || index >= m_updateLists.count()) {
        qCWarning(logDccUpdatePlugin) << "Invalid index for getDetailInfos:" << index;
        return result;
    }
    
    // 获取详细信息并转换为 QVariantList
    const auto& detailInfos = m_updateLists[index]->detailInfos();
    result.reserve(detailInfos.size()); // 预分配空间以提高性能
    
    for (const auto& detail : detailInfos) {
        QVariantMap map;
        map["name"] = detail.name;
        map["updateTime"] = detail.updateTime;
        map["info"] = detail.info;
        map["link"] = detail.link;
        map["vulLevel"] = detail.vulLevel;
        result.append(map);
    }
    
    return result;
}

对于 QML 部分,可以考虑以下改进:

// 详情列表
Repeater {
    model: repeater.model.getDetailInfos(index)
    
    ColumnLayout {
        Layout.fillWidth: true
        spacing: 4 // 添加适当的间距
        
        D.Label {
            Layout.alignment: Qt.AlignLeft
            Layout.fillWidth: true
            Layout.bottomMargin: -12
            font: D.DTK.fontManager.t8
            visible: modelData.info !== ""
            text: modelData.info
            wrapMode: Text.WordWrap
            color: D.DTK.themeType == D.ApplicationHelper.LightType ? 
                   Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
            
            onLinkActivated: (link)=> {
                // 添加链接验证
                if (isValidUrl(link)) {
                    dccData.work().openUrl(link)
                } else {
                    console.warn("Invalid link:", link)
                }
            }
        }

        D.Label {
            Layout.alignment: Qt.AlignLeft
            Layout.fillWidth: true
            visible: modelData.updateTime !== ""
            font: D.DTK.fontManager.t8
            color: D.DTK.themeType == D.ApplicationHelper.LightType ? 
                   Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
            text: qsTr("Release time:") + modelData.updateTime
            wrapMode: Text.WordWrap
        }
    }
}

这些改进可以提高代码的可读性、性能和安全性,同时保持原有功能。

@deepin-bot
Copy link

deepin-bot bot commented Jan 23, 2026

TAG Bot

New tag: 1.0.41
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #224

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, xionglinlin

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-bot
Copy link

deepin-bot bot commented Jan 29, 2026

TAG Bot

New tag: 1.0.42
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #227

@deepin-bot
Copy link

deepin-bot bot commented Feb 5, 2026

TAG Bot

New tag: 1.0.43
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants