From: Steve Brokenshire Date: Sun, 3 Jul 2016 15:41:12 +0000 (+0100) Subject: Added N to the SaveString function of ContactDataObject X-Git-Tag: release-0.14~19 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=bf0c2b46bd7ce8a7d4e37e96661bb51ec95b89ab;p=xestiaab%2F.git Added N to the SaveString function of ContactDataObject --- diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index daf6159..8747ae3 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -297,6 +297,70 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ } + // Process N. + + if (!NameTitle.IsEmpty() || !NameForename.IsEmpty() || !NameSurname.IsEmpty() || + !NameOtherNames.IsEmpty() || !NameSuffix.IsEmpty()){ + + ProcessData.Append("N"); + + // Check if there is a value for ALTID. + + if (NameAltID.size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(NameAltID); + + } + + // Check if there is a value for LANGUAGE. + + if (NameLanguage.size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append(NameLanguage); + + } + + // Check if there is a value for SORT-AS. + + if (NameDisplayAs.size() > 0){ + + ProcessData.Append(";SORT-AS=\""); + ProcessData.Append(NameDisplayAs); + ProcessData.Append("\""); + + } + + // Check if there is a value for tokens. + + if (NameTokens.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(NameTokens); + + } + + ProcessData.Append(":"); + ProcessData.Append(NameSurname); + ProcessData.Append(";"); + ProcessData.Append(NameForename); + ProcessData.Append(";"); + ProcessData.Append(NameOtherNames); + ProcessData.Append(";"); + ProcessData.Append(NameTitle); + ProcessData.Append(";"); + ProcessData.Append(NameSuffix); + + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + // Process NICKNAME. SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, @@ -312,6 +376,12 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, &BusinessNicknamesListTokens, SaveData, "work"); + // TODO: Process GENDER. + + // TODO: Process BDAY. + + // TODO: Process ANNIVERSARY. + // Process TITLE. SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage, diff --git a/source/tests/xestiaab_contactsave.h b/source/tests/xestiaab_contactsave.h index d0c2cfe..414df44 100644 --- a/source/tests/xestiaab_contactsave.h +++ b/source/tests/xestiaab_contactsave.h @@ -82,6 +82,8 @@ TEST(ContactSave, ContactSaveTests){ "CLIENTPIDMAP;MEEP=MOO;WOOP=WOO:3;urn;uuid:bbbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbb\n" " bb\n" "FN;TYPE=work;LANGUAGE=kw;ALTID=500;PID=40;PREF=45;EXAMPLE=Baaa:Test Contact\n" + "N;ALTID=3;LANGUAGE=kw;SORT-AS=\"Contact,Test\";TEST=Yes:Contact;Test;Example;Ro\n" + " bot;LOONY\n" "NICKNAME;ALTID=35;LANGUAGE=kw;PID=50;PREF=40;YAY=Nope;Beep=Boop:Tester\n" "NICKNAME;TYPE=home;ALTID=17;LANGUAGE=en;PID=39;PREF=78;YAY=Yep;Beep=Boop:Test\n" " y\n"