Conversation
原因:登录界面使用Thin字体渲染中文更宽,在SFAWidget固定280px容器内 提示文案超出可用宽度,setWordWrap(true)导致文本换行为两行,与锁屏 界面行为不一致。 方法:将m_textLabel的setWordWrap改为false并设置setElideMode(Qt::ElideNone), 禁用自动换行,使提示文案以一行展示。 Log: 修复登录界面FIDO认证提示文案换行问题 Bug: https://pms.uniontech.com/bug-view-370733.html Influence: 登录界面和锁屏界面的安全密钥FIDO认证提示文案显示
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy 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 guide (collapsed on small PRs)Reviewer's GuideThe PR updates the FIDO prompt label configuration to display authentication text on a single line, resolving wrapping caused by the login greeter’s wider Thin font within the fixed-width widget and aligning its behavior with the lock screen. Flow diagram for single-line FIDO prompt renderingflowchart LR
A["FIDO authentication prompt"] --> B["AuthPasskey::initUI()"]
B --> C["setWordWrap(false)"]
B --> D["setElideMode(Qt::ElideNone)"]
C --> E["Single-line prompt in fixed-width SFAWidget"]
D --> E
E --> F["Login greeter behavior matches lock screen"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/session-widgets/auth_passkey.cpp" line_range="40-41" />
<code_context>
/* 文案提示 */
m_textLabel->setText(tr("Please plug in the security key"));
- m_textLabel->setWordWrap(true);
+ m_textLabel->setWordWrap(false);
+ m_textLabel->setElideMode(Qt::ElideNone);
/* 旋转提示和文案提示布局 */
</code_context>
<issue_to_address>
**issue (bug_risk):** When the translated prompt is wider than the fixed authentication row, disabling word wrapping leaves the label constrained to one line, and `Qt::ElideNone` prevents any indication of omitted text; the right side of the FIDO instruction is clipped instead of being displayed in full.
**Triggers:** When using the Chinese locale and the prompt exceeds the available label width, as described in the change rationale.
**Suggested fix:** Increase the available width or reduce the font size; otherwise use an elision mode such as `Qt::ElideRight` and ensure the full instruction is available through accessibility or another UI element.
```suggestion
m_textLabel->setWordWrap(false);
m_textLabel->setElideMode(Qt::ElideRight);
```
</issue_to_address>| m_textLabel->setWordWrap(false); | ||
| m_textLabel->setElideMode(Qt::ElideNone); |
There was a problem hiding this comment.
issue (bug_risk): When the translated prompt is wider than the fixed authentication row, disabling word wrapping leaves the label constrained to one line, and Qt::ElideNone prevents any indication of omitted text; the right side of the FIDO instruction is clipped instead of being displayed in full.
Triggers: When using the Chinese locale and the prompt exceeds the available label width, as described in the change rationale.
Suggested fix: Increase the available width or reduce the font size; otherwise use an elision mode such as Qt::ElideRight and ensure the full instruction is available through accessibility or another UI element.
| m_textLabel->setWordWrap(false); | |
| m_textLabel->setElideMode(Qt::ElideNone); | |
| m_textLabel->setWordWrap(false); | |
| m_textLabel->setElideMode(Qt::ElideRight); |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 修复已正确,无需额外修复代码本报告由 AI 代码审查工具自动生成 |
|
在这里跟踪,此PR关闭:#78 |
Root Cause Analysis
In the login interface (lightdm-deepin-greeter), the "Noto Sans CJK SC-Thin" 10.5pt font is explicitly set, which renders Chinese characters wider than the system default font used in the lock screen (dde-lock). The FIDO authentication prompt text (e.g., "请验证安全密钥,触摸或轻扫设备") exceeds the available width (~240px) within the fixed 280px SFAWidget container, and
setWordWrap(true)inAuthPasskey::initUI()causes the text to wrap into two lines. The lock screen uses the default font where the same text fits in one line, resulting in inconsistent behavior.Key evidence:
auth_passkey.cpp:40(setWordWrap(true)),lightdm-deepin-greeter.cpp:57-59(Thin font setup),sfa_widget.cpp:47(fixed 280px width).Fix
Changed
m_textLabel->setWordWrap(true)tosetWordWrap(false)and addedsetElideMode(Qt::ElideNone)inAuthPasskey::initUI(). This disables automatic word wrapping and text elision, ensuring the FIDO authentication prompt text displays in a single line, consistent with the lock screen behavior. The actual implementation matches the analysis recommendation exactly.Change Safety Assessment
Code Safety
setWordWrap(true)was introduced in the original FIDO2 feature commit (b6a1a6e, 2023-10-11), not a prior bug fix — this change does not revert any historical fix.m_textLabelis a private member ofAuthPasskey, only accessed withininitUI()andsetAuthState(). No external callers depend on the word wrap behavior.Business Impact Scope
The change affects the FIDO/security key authentication prompt text display in both the login interface and lock screen. Specifically, the prompt text label's wrapping behavior is modified. Users will see the authentication prompt in a single line on the login screen, matching the lock screen's behavior.
Verification Suggestion
Verify that the FIDO authentication prompt text displays in a single line on both the login interface and lock screen. Test with Chinese locale to confirm the Thin font rendering no longer causes wrapping.
根因分析
登录界面(lightdm-deepin-greeter)显式设置了 "Noto Sans CJK SC-Thin" 10.5pt 字体,渲染中文字符比锁屏界面(dde-lock)使用的系统默认字体更宽。FIDO 认证提示文案(如"请验证安全密钥,触摸或轻扫设备")在 SFAWidget 固定 280px 容器内超出可用宽度(约 240px),
AuthPasskey::initUI()中的setWordWrap(true)导致文本换行为两行。锁屏界面使用默认字体,相同文案宽度足够保持一行,导致登录与锁屏行为不一致。关键证据:
auth_passkey.cpp:40(setWordWrap(true))、lightdm-deepin-greeter.cpp:57-59(Thin 字体设置)、sfa_widget.cpp:47(固定 280px 宽度)。修复方案
将
AuthPasskey::initUI()中的m_textLabel->setWordWrap(true)改为setWordWrap(false),并新增setElideMode(Qt::ElideNone)。禁用自动换行和文本截断,确保 FIDO 认证提示文案以一行展示,与锁屏界面行为一致。实际实现与分析建议完全一致。改动安全评估
代码安全评估
setWordWrap(true)由 FIDO2 功能初始提交(b6a1a6ef, 2023-10-11)引入,非此前 bug 修复产物——本次修改不会撤销历史修复。m_textLabel是AuthPasskey的私有成员,仅在initUI()和setAuthState()中使用,无外部调用者依赖换行行为。业务影响范围
本次改动影响登录界面和锁屏界面的 FIDO/安全密钥认证提示文案显示。具体修改了提示文本标签的换行行为。用户在登录界面将看到认证提示以一行展示,与锁屏界面行为一致。
验证建议
验证登录界面和锁屏界面下 FIDO 认证提示文案均以一行显示。使用中文环境测试,确认 Thin 字体渲染下不再出现换行。
Summary by Sourcery
Keep FIDO authentication prompts on a single line for consistent display across login surfaces.
Bug Fixes:
Enhancements: