void SkypeProfile::SetDefaultLanguage() { bool bRslt; XmlParser parser; wstring file, account; if (_readDefaultAccount(account) == false) return; _getConfigFile(file, account); if (parser.Load(file) == false) { g_log.Log(L"SkypeProfile::SetDefaultLanguage. Could not open '%s'", (wchar_t *) file.c_str()); return; } XmlNode currentNode(parser.getDocument()); bRslt = parser.FindNode(L"//Language", currentNode); if (bRslt) { XmlNode newNode(parser.getDocument()); newNode.SetName(L"Language"); newNode.SetText(CATALAN_LANG_PROFILE); newNode.CreateElement(); parser.ReplaceNode(newNode, currentNode); bRslt = parser.Save(file); g_log.Log(L"SkypeProfile::SetDefaultLanguage. Saved file '%s', result %u", (wchar_t *)file.c_str(), (wchar_t *) bRslt); } else { g_log.Log(L"SkypeProfile::SetDefaultLanguage. Could not find language node."); } }
void OpenOfficeAction::_setDefaultLanguage() { XmlParser parser; wstring file; bool bRslt; _getPreferencesFile(file); if (parser.Load(file) == false) { g_log.Log(L"OpenOfficeAction::_setDefaultLanguage. Could not open '%s'", (wchar_t *) file.c_str()); return; } /* XML fragment to generate <item oor:path="/org.openoffice.Office.Linguistic/General"> <prop oor:name="UILocale" oor:op="fuse"> <value>DEFAULT_LANGUAGE</value> </prop> </item> */ XmlNode item(parser.getDocument()), prop(parser.getDocument()), value(parser.getDocument()); value.SetName(wstring(L"value")); value.SetText(wstring(DEFAULT_LANGUAGE)); prop.SetName(wstring(L"prop")); prop.AddAttribute(XmlAttribute(L"oor:name", L"UILocale")); prop.AddAttribute(XmlAttribute(L"oor:op", L"fuse")); prop.AddChildren(value); item.SetName(wstring(L"item")); item.AddAttribute(XmlAttribute(L"oor:path", L"/org.openoffice.Office.Linguistic/General")); item.AddChildren(prop); parser.AppendNode(item); bRslt = parser.Save(file); g_log.Log(L"OpenOfficeAction::_setDefaultLanguage. Saved file '%s', result %u", (wchar_t *)file.c_str(), (wchar_t *) bRslt); }