Populate folio_counter rows from the document, not just write-through

Habit 4: a folio that is only parsed, never built into a live
Diagram scene by a numbering edit, still needs its folio_counter
rows. Diagram::folioSequentialsFromXml() now writes the rows it
just parsed, the same way insertFolioSeqHash() does for an edit
made in a built scene.

Adds the fixture used to prove this: folio_counters_multi.qet, 3
folios, an element and a conductor numbering scheme both using a
tenfolio part, exercising insertFolioSeqHash()'s write-through and
this load-time path. Resave-of-resave is byte-identical; ctest
clean on the 4 directly relevant tests.

Found in passing, not fixed here (pre-existing on master, outside
2b-4's scope): the conductor side's folio-sequential XML ends up
saved under <elementautonumfoliosequentials> instead of its own
<conductorautonumfoliosequentials> tag -- the fixture's 'Wires'
scheme reads back with owner=element for exactly that reason.
Worth a FINDINGS entry before anyone trusts the conductor side of
this mechanism.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-20 17:40:14 +13:00
parent 8d5c164d09
commit 6225b20f32
3 changed files with 433 additions and 8 deletions
+29 -7
View File
@@ -2154,34 +2154,46 @@ bool Diagram::fromXml(QDomElement &document,
QStringLiteral("elementunitfolioseq"),
QStringLiteral("sequf_"),
QStringLiteral("unitfolioseq"),
QStringLiteral("elementautonumfoliosequentials"));
QStringLiteral("elementautonumfoliosequentials"),
QStringLiteral("element"),
QStringLiteral("unitfolio"));
folioSequentialsFromXml(root, &m_elmt_tenfolio_max,
QStringLiteral("elementtenfolioseq"),
QStringLiteral("seqtf_"),
QStringLiteral("tenfolioseq"),
QStringLiteral("elementautonumfoliosequentials"));
QStringLiteral("elementautonumfoliosequentials"),
QStringLiteral("element"),
QStringLiteral("tenfolio"));
folioSequentialsFromXml(root, &m_elmt_hundredfolio_max,
QStringLiteral("elementhundredfolioseq"),
QStringLiteral("seqhf_"),
QStringLiteral("hundredfolioseq"),
QStringLiteral("elementautonumfoliosequentials"));
QStringLiteral("elementautonumfoliosequentials"),
QStringLiteral("element"),
QStringLiteral("hundredfolio"));
//Load Conductor Folio Sequential
folioSequentialsFromXml(root, &m_cnd_unitfolio_max,
QStringLiteral("conductorunitfolioseq"),
QStringLiteral("sequf_"),
QStringLiteral("unitfolioseq"),
QStringLiteral("conductorautonumfoliosequentials"));
QStringLiteral("conductorautonumfoliosequentials"),
QStringLiteral("conductor"),
QStringLiteral("unitfolio"));
folioSequentialsFromXml(root, &m_cnd_tenfolio_max,
QStringLiteral("conductortenfolioseq"),
QStringLiteral("seqtf_"),
QStringLiteral("tenfolioseq"),
QStringLiteral("conductorautonumfoliosequentials"));
QStringLiteral("conductorautonumfoliosequentials"),
QStringLiteral("conductor"),
QStringLiteral("tenfolio"));
folioSequentialsFromXml(root, &m_cnd_hundredfolio_max,
QStringLiteral("conductorhundredfolioseq"),
QStringLiteral("seqhf_"),
QStringLiteral("hundredfolioseq"),
QStringLiteral("conductorautonumfoliosequentials"));
QStringLiteral("conductorautonumfoliosequentials"),
QStringLiteral("conductor"),
QStringLiteral("hundredfolio"));
}
// if child haven't got a child, loading is finish (diagram is empty)
@@ -2587,7 +2599,9 @@ void Diagram::folioSequentialsFromXml(const QDomElement &root,
const QString& folioSeq,
const QString& seq,
const QString& type,
const QString& autonumFolioSeqType) {
const QString& autonumFolioSeqType,
const QString& owner,
const QString& level) {
foreach (QDomElement folioSeqAutoNum,
QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
for(QDomElement folioseq
@@ -2604,6 +2618,14 @@ void Diagram::folioSequentialsFromXml(const QDomElement &root,
i++;
}
hash->insert(title,list);
//2b-4, habit 4: populate the row from the
//document being parsed, not from a built
//scene -- this runs whether or not the
//folio ever becomes one.
if (!owner.isEmpty() && project()) {
project()->dataBase()->setFolioCounterValues(
uuid(), owner, level, title, list);
}
}
}
}