Task: Land version-navigation UI as a qt-profile detail_dialog template capability

Table of Contents

This page documents a task in the Commission: currency story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Generalise currency's full version-navigation UI (first/prev/next/last/revert, currently 100% hand-written in CurrencyDetailDialog) into a detail_dialog qt-profile template capability, with currency as the first real consumer. Step 4 of the regenerate plan (task 6E0CD16E).

Status

Field Value
State DONE
Parent story Commission: currency
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-07-07

Acceptance

  • Version-navigation UI (first/prev/next/last/revert) is an opt-in detail_dialog template capability.
  • Regenerating currency's detail_dialog reproduces equivalent navigation behaviour to the current hand-written code.
  • Build passes.

Plan

Followed the same minimal-footprint pattern as the setting-gated-actions capability (task D9CB6853): add an opt-in has_version_navigation mustache section to the detail_dialog hpp/cpp templates (and their ores.cpp.qt.detail_dialog_{header,impl}.org literate sources), flip it on for currency's model, regenerate, diff against the hand-written file to verify equivalence, then discard the regenerated currency files — currency itself stays hand-written until the final mechanical sync task (EA647CBC, step 9).

Landed capability, gated by domain_entity.qt.has_version_navigation (plus version_history_include / version_history_type properties):

  • Header: setReadOnly(bool, int = 0) overload (replaces the 1-arg form), setHistory, revert signal, 5 nav/revert slots, 3 private helpers (displayCurrentVersion, updateVersionNavButtonStates, showVersionNavActions), and the toolbar/action/history members.
  • Impl: toolbar + 5 QActions built in setupUi() (mirrors currency's hand-rolled toolbar construction verbatim, entity-name substituted), setReadOnly extended to toggle revertAction_ visibility, setHistory=/=displayCurrentVersion=/nav slots/=onRevertClicked implemented generically off history_.versions[i].{data,version_number} (the shape currency's hand-written currency_version struct already uses).

Verified via ./codegen.sh generate --model .../currency.org --address ores.cpp.qt then diffing the regenerated CurrencyDetailDialog.{hpp,cpp} against the repo: the generated version-nav/revert methods reproduce the hand-written behaviour exactly (same toolbar order, same enable/disable logic, same slot bodies) modulo formatting; the rest of the diff is pre-existing unrelated Qt-layer drift tracked by the sync task. Also regenerated a peer without the flag (party_status) and confirmed zero version-nav leakage. Discarded both regenerated trees after verification (git checkout=/=git clean) — no C++ source changed by this task, only templates/org-model/org-docs.

Notes

Currency's actual setReadOnly(bool, int) signature was already 2-argument (matching what this capability now generates); the template's prior 1-argument setReadOnly(bool) was the outlier, confirming the divergence this capability was meant to close.

PRs

PR Title
#1458 [codegen] Land has_version_navigation as a qt-profile capability

Review

Comment summary File Decision Notes
       

Result

Version-navigation UI (first/prev/next/last/revert) landed as an opt-in has_version_navigation capability in the detail_dialog qt-profile template, currency flipped on as first consumer. Verified by regenerating and diffing against the hand-written file — behaviour matches exactly. Currency's own file is untouched (mechanical reconciliation is the sync task's job); 4 of 6 prerequisites for "Sync Qt codegen for currency" (EA647CBC) are now DONE.

Emacs 29.3 (Org mode 9.6.15)