Skip to content

fix: SpinBox supports keyboard input#365

Merged
caixr23 merged 1 commit intolinuxdeepin:masterfrom
caixr23:master
Jul 2, 2025
Merged

fix: SpinBox supports keyboard input#365
caixr23 merged 1 commit intolinuxdeepin:masterfrom
caixr23:master

Conversation

@caixr23
Copy link
Copy Markdown
Contributor

@caixr23 caixr23 commented Jun 23, 2025

SpinBox supports keyboard input

pms: BUG-286729

Summary by Sourcery

Allow direct keyboard input in SpinBox controls by marking them as editable across VPN, Device, and IPv6 configuration sections.

Bug Fixes:

  • Enable editable property on SpinBox components in SectionVPN.qml for port, reneg-seconds, tunnel-mtu, fragment-size, and additional fields
  • Set editable: true on the MTU SpinBox in SectionDevice.qml
  • Enable editable SpinBox for prefix values in SectionIPv6.qml

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 23, 2025

Reviewer's Guide

This PR enables direct keyboard input for all D.SpinBox instances by adding the editable property across the VPN, Device, and IPv6 QML sections.

File-Level Changes

Change Details Files
Enable keyboard input on SpinBox components
  • Added “editable: true” to port SpinBox
  • Added “editable: true” to reneg-seconds SpinBox
  • Added “editable: true” to tunnel-mtu SpinBox
  • Added “editable: true” to fragment-size SpinBox
  • Added “editable: true” to weight SpinBox
  • Added “editable: true” to proxy-related SpinBox
  • Added “editable: true” to device MTU SpinBox
  • Added “editable: true” to IPv6 prefix SpinBox
dcc-network/qml/SectionVPN.qml
dcc-network/qml/SectionDevice.qml
dcc-network/qml/SectionIPv6.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @caixr23 - 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> `dcc-network/qml/SectionVPN.qml:1461` </location>
<code_context>
             visible: hasMTU
             pageType: DccObject.Editor
             page: D.SpinBox {
+                editable: true
                 value: root.config.hasOwnProperty("mtu") ? root.config.mtu : 0
                 onValueChanged: {
</code_context>

<issue_to_address>
Consider if all D.SpinBox fields should be editable by default.

Review whether 'editable' should be the default for D.SpinBox to avoid repetitive code and ensure consistency, unless there are valid cases for non-editable instances.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

visible: root.dataMap.hasOwnProperty("port")
pageType: DccObject.Editor
page: D.SpinBox {
editable: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider if all D.SpinBox fields should be editable by default.

Review whether 'editable' should be the default for D.SpinBox to avoid repetitive code and ensure consistency, unless there are valid cases for non-editable instances.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, 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

SpinBox supports keyboard input

pms: BUG-286729
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码重复

    • 在多个SpinBox组件中,editable: true属性被重复添加。建议将这个属性提取到一个公共的组件或样式表中,以减少代码重复。
  2. 逻辑判断

    • SpinBoxonValueChanged信号处理中,先检查hasMTU,然后又检查root.config.hasOwnProperty("mtu")。这两个条件可以合并,以简化逻辑。
  3. 类型转换

    • SpinBoxvalue属性中,使用parseInt进行类型转换。如果root.dataMap[dccObj.name]可能不是字符串类型,建议添加类型检查或默认值处理。
  4. 范围检查

    • SpinBoxfromto属性被设置为0和65535。建议检查这些值是否合理,以及是否有必要对用户输入进行范围限制。
  5. 可读性

    • 代码中多次出现root.dataMap.hasOwnProperty(dccObj.name)的检查,可以考虑将其提取为一个函数,以提高代码的可读性。
  6. 注释和文档

    • 考虑为SpinBox组件添加注释,说明其用途和配置项,以便其他开发者更容易理解代码。
  7. 安全性

    • 如果SpinBox的值来自用户输入,建议对输入进行验证和清理,以防止潜在的注入攻击或其他安全问题。

综合以上意见,代码可以进一步优化以提高可维护性和安全性。

@caixr23 caixr23 merged commit 9f3b624 into linuxdeepin:master Jul 2, 2025
15 of 17 checks passed
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