From f0ed701d8f39a9ca15c9501f76a8912ffdc19730 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sat, 12 Apr 2014 20:29:00 -0700 Subject: [PATCH] Fix pfLocalizationDataMgr's SetElementPlainTextData to work properly without a database re-load. --- .../FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp | 3 ++- Sources/Tools/plLocalizationEditor/plEditDlg.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp index a82c4d89..2c1dcde9 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp @@ -157,7 +157,8 @@ void pfLocalizedString::IParameterize(const plString & inString) void pfLocalizedString::IConvertFromPlainText(const plString & plainText) { - IParameterize(plainText); + fPlainTextRep = plainText; + IParameterize(fPlainTextRep); IUpdateXML(); } diff --git a/Sources/Tools/plLocalizationEditor/plEditDlg.cpp b/Sources/Tools/plLocalizationEditor/plEditDlg.cpp index 248f47b1..462d9e90 100644 --- a/Sources/Tools/plLocalizationEditor/plEditDlg.cpp +++ b/Sources/Tools/plLocalizationEditor/plEditDlg.cpp @@ -116,6 +116,9 @@ void EditDialog::SaveLocalizationText() plString ageName, setName, elementName, elementLanguage; SplitLocalizationPath(fCurrentLocPath, ageName, setName, elementName, elementLanguage); + if (ageName.IsEmpty() || setName.IsEmpty() || elementName.IsEmpty() || elementLanguage.IsEmpty()) + return; + plString name = plString::Format("%s.%s.%s", ageName.c_str(), setName.c_str(), elementName.c_str()); pfLocalizationDataMgr::Instance().SetElementPlainTextData(name, elementLanguage, text); } @@ -351,7 +354,7 @@ void EditDialog::DeleteClicked() QMessageBox::critical(this, tr("Error"), tr("Couldn't delete localization!")); else { - plString path = fCurrentLocPath; + plString path = key + ".English"; fCurrentLocPath = ""; fUI->fLocalizationTree->clear(); fUI->fLocalizationTree->LoadData(path);