diff --git a/demo_r1/demo_reports/change_lang_from_script.lrxml b/demo_r1/demo_reports/change_lang_from_script.lrxml index a5d3704..dd97e87 100644 --- a/demo_r1/demo_reports/change_lang_from_script.lrxml +++ b/demo_r1/demo_reports/change_lang_from_script.lrxml @@ -108,20 +108,6 @@ Dialog.exec() == 1; - - - - - - - - - - - - - - diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index a128d46..4ccaf30 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -1010,7 +1010,8 @@ void ReportEnginePrivate::activateLanguage(QLocale::Language language) BaseDesignIntf* item = page->childByName(itemTranslation->itemName); if (item) { foreach(PropertyTranslation* propertyTranslation, itemTranslation->propertyesTranslation){ - item->setProperty(propertyTranslation->propertyName.toLatin1(), propertyTranslation->value); + if (propertyTranslation->checked) + item->setProperty(propertyTranslation->propertyName.toLatin1(), propertyTranslation->value); } } } @@ -1123,11 +1124,6 @@ ReportPages ReportEnginePrivate::renderToPages() m_reportRender = ReportRender::Ptr(new ReportRender); updateTranslations(); - dataManager()->clearErrors(); - dataManager()->connectAllDatabases(); - dataManager()->setDesignTime(false); - dataManager()->updateDatasourceModel(); - connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); @@ -1152,6 +1148,11 @@ ReportPages ReportEnginePrivate::renderToPages() if (m_scriptEngineContext->runInitScript()){ + dataManager()->clearErrors(); + dataManager()->connectAllDatabases(); + dataManager()->setDesignTime(false); + dataManager()->updateDatasourceModel(); + activateLanguage(m_reportLanguage); emit renderStarted(); diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index 2f77dd1..84062da 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -232,14 +232,17 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement languageNode.appendChild(pageNode); foreach(ItemTranslation* item, page->itemsTranslation){ QDomElement itemNode = m_doc->createElement(item->itemName); - pageNode.appendChild(itemNode); foreach(PropertyTranslation* property, item->propertyesTranslation){ - QDomElement propertyNode = m_doc->createElement(property->propertyName); - propertyNode.setAttribute("Value",property->value); - propertyNode.setAttribute("SourceValue", property->sourceValue); - propertyNode.setAttribute("Checked", property->checked ? "Y":"N"); - itemNode.appendChild(propertyNode); + if (property->sourceValue.compare(property->value) != 0){ + QDomElement propertyNode = m_doc->createElement(property->propertyName); + propertyNode.setAttribute("Value",property->value); + propertyNode.setAttribute("SourceValue", property->sourceValue); + propertyNode.setAttribute("Checked", property->checked ? "Y":"N"); + itemNode.appendChild(propertyNode); + } } + if (!itemNode.childNodes().isEmpty()) + pageNode.appendChild(itemNode); } } }