Skip to content

Add pinned attributes to entry preview panel - #13574

Open
eric-lemesre wants to merge 1 commit into
keepassxreboot:developfrom
eric-lemesre:feature/pinned-attributes
Open

Add pinned attributes to entry preview panel#13574
eric-lemesre wants to merge 1 commit into
keepassxreboot:developfrom
eric-lemesre:feature/pinned-attributes

Conversation

@eric-lemesre

@eric-lemesre eric-lemesre commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This PR adds the ability to pin additional attributes (custom strings) so they are displayed on the entry preview panel, below the password field.

  • A new Pin checkbox sits next to Protect in the entry edit Advanced tab.
  • Pinned attributes are stored per entry in the standard KDBX4 entry CustomData under the key KPXC_PINNED_ATTRIBUTES, as a compact JSON array of attribute names (JSON because attribute names may contain any character, including commas and quotes). The KDBX schema and the way custom strings are stored are unchanged.
  • On the preview panel, protected attributes are masked with a reveal toggle (same pattern as the Advanced tab); double click copies the value to the clipboard.
  • The pinned list follows attribute renames and removals in the editor. Pinned names that no longer exist (e.g. after a merge or an edit by another client) are silently ignored at display time.
  • The user guide (Additional Attributes section) is updated.

Design decisions we would like to flag explicitly for review:

  1. The preview stays read-only (labels + copy on double click), consistent with the rest of the preview panel — we deliberately did not add in-place editing.
  2. Double click copies the clear value even while masked, which mirrors the existing behaviour of the attributes table in the preview's Advanced tab.
  3. Pinning writes entry CustomData, so a KDBX3 database will be upgraded to KDBX4 on save — the same behaviour as the browser integration settings.
  4. Pinned names can become orphaned if an attribute is renamed/removed outside the entry editor; they are ignored at display time and never purged automatically.

Note: this PR is independent of #13573 (Entry::beginUpdate() CustomData fix), but that fix is required for the pinned state to be carried into and restored from entry history.

Screenshots

Capture d’écran du 2026-08-06 21-13-27 Capture d’écran du 2026-08-06 21-14-13 Capture d’écran du 2026-08-06 21-15-18

Testing strategy

  • New unit test TestEntry::testPinnedAttributes: round-trip including names with commas/quotes/newlines/unicode, empty-name filtering, duplicate removal, empty list removing the key, malformed JSON tolerated, null-pointer safety.
  • Extended TestGui::testEditEntry: pin checkbox, persistence, preview panel display, masking and reveal toggle, rename sync, removal sync and section hiding.
  • Locally ran testentry, testmodified, testgroup, testkdbx2/3/4, testmerge, testcli, testbrowser and the full testgui suite — all passing. clang-format clean; translation strings pushed via lupdate.

Type of change

  • ✅ New feature (change that adds functionality)

AI usage disclosure

Per the contribution guidelines: development was done with Claude Code (model: Claude Fable 5, Anthropic); an additional critical code review pass was performed with Kimi-k3. All changes were reviewed, built and tested locally by the submitter.


We would very much welcome your feedback: if there are changes you would like, or points we may have missed — naming, UX of the Pin checkbox, the design decisions above, or anything else — we will gladly rework them.

🤖 Generated with Claude Code

Allow pinning additional attributes (custom strings) so they show on
the entry preview panel below the password field. Pinned attributes are
stored per entry in CustomData under the KPXC_PINNED_ATTRIBUTES key as
a compact JSON array, leaving the KDBX schema untouched.

* Add a "Pin" checkbox next to "Protect" in the entry edit Advanced tab
* Show pinned attributes on the preview General tab; protected values
  are masked with a reveal toggle, double click copies the value
* Keep the pinned list in sync on attribute rename and removal;
  pinned names that no longer exist are silently ignored
* Add TestEntry::testPinnedAttributes, extend TestGui::testEditEntry
  (pin, preview display, masking, rename and removal sync)
* Document the feature in the user guide

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@eric-lemesre
eric-lemesre marked this pull request as ready for review August 6, 2026 19:21
@droidmonkey

Copy link
Copy Markdown
Member

Cool, this is a good solution to the request

@varjolintu varjolintu added the pr: ai-assisted Pull request contains significant contributions by generative AI label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: ai-assisted Pull request contains significant contributions by generative AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants