dde-file-manager icon indicating copy to clipboard operation
dde-file-manager copied to clipboard

fix: After adjusting the width of the dde-file-manager, other applications such as file editors open dde-file-dailog field display

Open liyigang1 opened this issue 1 year ago • 2 comments

Adjust the adaptive width strategy, and when the window width is less than the width of all columns, adjust the columns larger than the minimum width. When the window width is greater than the width of all columns, adjust the width of the filename column

Log: After adjusting the width of the dde-file-manager, other applications such as file editors open dde-file-dailog field display Bug: https://pms.uniontech.com/bug-view-273831.html

liyigang1 avatar Oct 11 '24 07:10 liyigang1

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Lighto-Ku, liyigang1, max-lvs

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

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-ci-robot avatar Oct 21 '24 01:10 deepin-ci-robot

deepin pr auto review

代码审查意见:

  1. 代码可读性

    • HeaderView::doFileNameColumnResize函数中,变量命名不够直观,例如moreThanMinisMoreThanMin,建议使用更具描述性的名称,如columnsExceedingMinWidthhasColumnExceedingMinWidth
  2. 逻辑清晰性

    • 在调整列宽度的逻辑中,resizeSection函数被多次调用,每次调用后都需要检查moreThanTotal是否小于等于0,这可能会导致不必要的循环迭代。建议将这部分逻辑合并,减少重复代码。
  3. 性能优化

    • 在循环中,view->getColumnWidth(i)被多次调用,可以考虑将其结果存储在局部变量中,以减少函数调用的开销。
  4. 边界条件处理

    • 在调整列宽度的逻辑中,没有对minimumSectionSize()的返回值进行非负性检查,如果返回负值可能会导致逻辑错误。建议添加相应的检查。
  5. 代码重复

    • 在调整列宽度的逻辑中,resizeSection函数的调用逻辑存在重复,建议提取公共逻辑到一个单独的函数中,以减少代码重复。
  6. 注释缺失

    • 代码中缺少对关键逻辑的注释,建议添加注释以提高代码的可读性和可维护性。
  7. 异常处理

    • 在调整列宽度的逻辑中,没有对可能出现的异常进行处理,例如resizeSection函数调用失败的情况。建议添加相应的异常处理逻辑。

综合以上意见,代码可以进一步优化以提高可读性、性能和健壮性。

deepin-ci-robot avatar Oct 31 '24 12:10 deepin-ci-robot

/merge

liyigang1 avatar Oct 31 '24 12:10 liyigang1