Skip to content

fix: use DSuggestButton for encryption page confirm button - #438

Draft
GongHeng2017 wants to merge 1 commit into
linuxdeepin:masterfrom
GongHeng2017:agent/agent/cae939535591
Draft

GongHeng2017 wants to merge 1 commit into
linuxdeepin:masterfrom
GongHeng2017:agent/agent/cae939535591

Conversation

@GongHeng2017

@GongHeng2017 GongHeng2017 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

The encryption page (EncryptionPage) used DPushButton (plain gray style) for the confirm button instead of DSuggestButton (blue accent style), inconsistent with the design spec used elsewhere in the project (e.g., CentralNavPage.cpp:45). Additionally, the encryption page layout minimum height (305px) exceeded the available DocSheet height at minimum window size (MainWindow.cpp:639 sets setMinimumSize(680, 300)), causing the lock icon top to be clipped by the title bar. Key evidence: EncryptionPage.cpp:51 creates DPushButton; layout height calculation shows 305px minimum vs. 260-270px available.

Fix Approach

Replace DPushButton with DSuggestButton for m_nextbutton, add #include <DSuggestButton>, and sync the connect signal type from &DPushButton::clicked to &DSuggestButton::clicked. Add setMinimumHeight(305) to EncryptionPage::InitUI() to prevent layout overflow. This matches the analysis report fix suggestion (section 10) with no deviation. MainWindow.cpp:639 setMinimumSize is not modified per review decision.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • DSuggestButton inherits DPushButton, so setEnabled/setDisabled/clicked are fully compatible — no API behavior change
  • Target code lines (EncryptionPage.cpp:49-57, layout 60-77) have been unchanged since 2020; this change does not revert any historical bug fix
  • Same project already uses DSuggestButton in CentralNavPage.cpp:45, confirming dependency availability

Business Impact Scope

Affected module: Encrypted PDF password input page — the UI shown when a user opens an encrypted PDF. Caller: DocSheet.cpp:1877 (showEncryPage), DocSheet.cpp:1698-1700 (resizeEvent sets EncryptionPage geometry). User scenarios: opening an encrypted PDF, entering password, clicking confirm button.

Verification Suggestion

Verify the confirm button on the encrypted PDF password page displays as blue suggest-button style. Verify the lock icon is fully visible at minimum window size (680×300). Verify password input and confirm button interaction (enable/disable/submit) works correctly.


根因分析

加密页面(EncryptionPage)使用 DPushButton(灰色普通样式)作为确定按钮,而非设计规范要求的 DSuggestButton(蓝色强调样式),与项目中其他页面(如 CentralNavPage.cpp:45)不一致。此外,加密页面布局最小高度(305px)超过最小窗口尺寸(MainWindow.cpp:639 设置 setMinimumSize(680, 300))下 DocSheet 可用高度,导致锁图标顶部被标题栏截断。关键证据:EncryptionPage.cpp:51 创建 DPushButton;布局高度计算 305px vs 可用 260-270px。

修复方案

将 m_nextbutton 从 DPushButton 替换为 DSuggestButton,补充 #include <DSuggestButton>,同步 connect 信号类型从 &DPushButton::clicked 到 &DSuggestButton::clicked。在 EncryptionPage::InitUI() 中添加 setMinimumHeight(305) 防止布局溢出。与分析报告修复建议(第十节)一致,无偏离。MainWindow.cpp:639 的 setMinimumSize 未修改(按复核裁决)。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • DSuggestButton 继承 DPushButton,setEnabled/setDisabled/clicked 完全兼容,无 API 行为变化
  • 目标代码行(EncryptionPage.cpp:49-57,布局 60-77)自 2020 年未修改,本次改动不撤销任何历史修复
  • 同项目 CentralNavPage.cpp:45 已使用 DSuggestButton,依赖已满足

业务影响范围

受影响模块:加密 PDF 密码输入页面 — 用户打开加密 PDF 时显示的交互界面。调用者:DocSheet.cpp:1877(showEncryPage)、DocSheet.cpp:1698-1700(resizeEvent 设置 EncryptionPage geometry)。用户场景:打开加密 PDF、输入密码、点击确定按钮。

验证建议

验证加密 PDF 密码输入页面的确定按钮显示为蓝色推荐按钮样式。验证最小窗口尺寸(680×300)下锁图标完整可见。验证密码输入与确定按钮交互功能正常。

Summary by Sourcery

Fix the encrypted PDF password page styling and sizing to match the intended design and remain fully visible at minimum window dimensions.

Bug Fixes:

  • Use the accent-style suggest button for encrypted PDF password confirmation.
  • Prevent the encryption page layout from exceeding the available window height and clipping the lock icon.

Chores:

  • Update SPDX copyright ranges for the modified encryption page files.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GongHeng2017

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

@sourcery-ai

sourcery-ai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR aligns the encrypted PDF password page’s confirm button with the standard blue suggest-button styling and enforces a 305-pixel minimum page height so the lock icon and layout remain visible at the minimum window size, while preserving existing password interaction behavior.

File-Level Changes

Change Details Files
Updated the encryption-page confirm control to use the project’s accent-styled suggest button.
  • Added the DSuggestButton dependency.
  • Changed the confirm-button member and construction type.
  • Updated the clicked signal connection to the new button type.
reader/widgets/EncryptionPage.cpp
reader/widgets/EncryptionPage.h
Adjusted the encryption page’s minimum height to prevent content clipping at the minimum window size.
  • Set the page minimum height to 305 pixels without changing the main-window minimum size.
reader/widgets/EncryptionPage.cpp

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

@GongHeng2017
GongHeng2017 marked this pull request as draft October 29, 2026 20:42

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

1. Root cause: EncryptionPage used DPushButton (plain gray style) for
   the confirm button, inconsistent with design spec requiring
   DSuggestButton (blue accent style); layout minimum height (305px)
   exceeded available DocSheet height at minimum window size (300px),
   causing the lock icon top to be clipped
2. Fix: replace DPushButton with DSuggestButton for m_nextbutton,
   add #include <DSuggestButton>, sync signal type in connect call;
   add setMinimumHeight(305) to prevent layout overflow
3. Impact: only affects encryption page UI; DSuggestButton inherits
   DPushButton so API is fully compatible; minimum height constraint
   is local to EncryptionPage and does not affect other pages

Log: fix encryption page button style and lock icon clipping

Influence:
1. Test encrypted PDF password input page button appears as blue
   suggest button style
2. Test lock icon fully visible at minimum window size (680x300)
3. Verify password input and confirm button interaction works

fix: 修复加密页面确定按钮样式及锁图标截断问题

1. 根因:EncryptionPage 使用 DPushButton(灰色普通样式)作为确定
   按钮,与设计图要求的 DSuggestButton(蓝色强调样式)不符;布局
   最小高度(305px)超过最小窗口尺寸(300px)下 DocSheet 可用高度,
   导致锁图标顶部被截断
2. 方案:将 m_nextbutton 从 DPushButton 替换为 DSuggestButton,
   补充 #include <DSuggestButton>,同步 connect 信号类型;
   添加 setMinimumHeight(305) 防止布局溢出
3. 影响:仅影响加密页面 UI;DSuggestButton 继承 DPushButton,
   API 完全兼容;最小高度约束仅作用于 EncryptionPage,不影响其他页面

Log: 修复加密页面按钮样式及锁图标截断问题

Influence:
1. 测试加密 PDF 密码输入页面的确定按钮显示为蓝色推荐按钮样式
2. 测试最小窗口尺寸(680x300)下锁图标完整可见
3. 验证密码输入与确定按钮交互功能正常

Bug: #193241
PMS: BUG-193241
@GongHeng2017
GongHeng2017 force-pushed the agent/agent/cae939535591 branch from 8582070 to cf19717 Compare October 29, 2026 21:09
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.

2 participants