[TD]respect locale for date autofill (#18132)

* [TD]respect locale for date autofill

* [TD]fix merge conflict

* Apply suggestions from code review

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
WandererFan
2024-12-13 12:07:54 -05:00
committed by GitHub
parent d835cde3a5
commit 8b7cbae43b
6 changed files with 344 additions and 307 deletions

View File

@@ -77,14 +77,21 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
ui.setFieldName(fieldNameStr);
ui.setFieldContent(tmplte->EditableTexts[fieldNameStr]);
auto qName = QString::fromStdString(fieldNameStr);
auto svgTemplate = dynamic_cast<DrawSVGTemplate*>(tmplte);
if (svgTemplate) {
// preset the autofill with the current value - something might have changed since this field was created
m_autofillString = svgTemplate->getAutofillByEditableName(qName);
}
ui.setAutofillContent(m_autofillString.toStdString());
if (ui.exec() == QDialog::Accepted) {
QString qsClean = ui.getFieldContent();
std::string utf8Content = qsClean.toUtf8().constData();
if (ui.getAutofillState()) {
auto svgTemplate = dynamic_cast<DrawSVGTemplate*>(tmplte);
if (svgTemplate) {
// unlikely, but something could have changed since we grabbed the autofill value
QString fieldName = QString::fromStdString(fieldNameStr);
QString autofillValue = svgTemplate->getAutofillByEditableName(fieldName);
if (!autofillValue.isEmpty()) {