Skip to content

Fix key-file unlock link by removing translatable HTML markup#13396

Open
Copilot wants to merge 4 commits into
developfrom
copilot/fix-key-file-option
Open

Fix key-file unlock link by removing translatable HTML markup#13396
Copilot wants to merge 4 commits into
developfrom
copilot/fix-key-file-option

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 30, 2026

In 2.7.11, the “I have a key file” action in the unlock dialog could become non-functional in some translations because the translatable string embedded HTML anchor markup. This made link activation dependent on translated HTML structure instead of stable UI code.

  • Root cause correction: move markup out of translations

    • DatabaseOpenWidget.ui now stores plain text (I have a key file) instead of an HTML <a> string.
    • This removes translator-facing HTML and avoids runtime breakage from localized tag changes.
  • Behavior preservation in code

    • DatabaseOpenWidget.cpp now wraps the translated plain text in anchor markup at runtime, keeping the label clickable and preserving linkActivated -> browseKeyFile.
  • Security/robustness detail

    • The translated text is HTML-escaped before insertion into the anchor template.
m_ui->addKeyFileLinkLabel->setText(
    QStringLiteral("<a href=\"#\" style=\"text-decoration: underline\">%1</a>")
        .arg(tr("I have a key file").toHtmlEscaped()));

Copilot AI linked an issue May 30, 2026 that may be closed by this pull request
1 task
Copilot AI changed the title [WIP] Fix option 'I have a key file' not functioning Fix key-file unlock link by removing translatable HTML markup May 30, 2026
Copilot AI requested a review from droidmonkey May 30, 2026 14:15
@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.46%. Comparing base (6089679) to head (a629173).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #13396   +/-   ##
========================================
  Coverage    64.46%   64.46%           
========================================
  Files          378      378           
  Lines        39795    39797    +2     
========================================
+ Hits         25650    25652    +2     
  Misses       14145    14145           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@varjolintu varjolintu added the pr: ai-assisted Pull request contains significant contributions by generative AI label May 31, 2026
@droidmonkey droidmonkey marked this pull request as ready for review June 1, 2026 03:15
Copilot AI review requested due to automatic review settings June 1, 2026 03:15
@droidmonkey
Copy link
Copy Markdown
Member

Tested and works great

@droidmonkey droidmonkey added user interface i18n pr: bugfix Pull request fixes a bug labels Jun 1, 2026
@droidmonkey droidmonkey added this to the v2.8.0 milestone Jun 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the unlock dialog’s key-file link by moving clickable HTML anchor markup out of the translator-facing UI string and applying it in code instead.

Changes:

  • Replaces the .ui label text with plain translatable text.
  • Wraps the translated label text in a runtime-generated HTML anchor with escaping.
  • Updates the English translation catalog entry for the new plain source string.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/gui/DatabaseOpenWidget.ui Changes the key-file link label source text to plain text.
src/gui/DatabaseOpenWidget.cpp Applies stable anchor markup around the translated label text at runtime.
share/translations/keepassxc_en.ts Updates the English translation source entry for the changed label text.

Comment thread share/translations/keepassxc_en.ts
@droidmonkey droidmonkey requested a review from phoerious June 1, 2026 03:50
Copilot AI and others added 4 commits June 4, 2026 12:46
Co-authored-by: droidmonkey <2809491+droidmonkey@users.noreply.github.com>
@droidmonkey droidmonkey force-pushed the copilot/fix-key-file-option branch from bca93a2 to a629173 Compare June 4, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n pr: ai-assisted Pull request contains significant contributions by generative AI pr: bugfix Pull request fixes a bug user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The option "I have a key file" doesn't work

4 participants