From: Steve Brokenshire Date: Sun, 10 Jan 2016 21:03:40 +0000 (+0000) Subject: Reimplemented ANNIVERSARY. Simplified implementation. X-Git-Tag: release-0.09~72 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=acdf88b58fd1975ad0c38f1e2bb9fc5b89b3ed82 Reimplemented ANNIVERSARY. Simplified implementation. --- diff --git a/source/contacteditor/frmContactEditor-Save.cpp b/source/contacteditor/frmContactEditor-Save.cpp index e23bbd9..693c14b 100644 --- a/source/contacteditor/frmContactEditor-Save.cpp +++ b/source/contacteditor/frmContactEditor-Save.cpp @@ -577,85 +577,92 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) } } - + } ResetSaveProcessData(); - // Process Label. + // Build the values for the ANNIVERSARY property. + + // ALTID + + if (!ContactEditorData.AnniversaryAltID.IsEmpty()){ - strValue3 = ContactEditorData.AnniversaryAltID; + wxString DataValue; + DataValue = ContactEditorData.AnniversaryAltID; + + EscapeString(&DataValue, FALSE); + + strValue3.Append("ALTID="); + strValue3.Append(DataValue); + + boolValue2 = TRUE; - if (!strValue3.IsEmpty()){ - - strValue3.Trim(); - strValue3.Trim(); - boolValue2 = TRUE; - strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\"")); - - boolValue = TRUE; - } - //strValue3 = ContactData.Convert(GeneralAddressList, FALSE); - //strValue2 = + // CALSCALE. - // Process Language. + if (!ContactEditorData.AnniversaryCalScale.IsEmpty()){ - strValue3 = ContactEditorData.AnniversaryCalScale; + wxString DataValue; + DataValue = ContactEditorData.AnniversaryCalScale; + + EscapeString(&DataValue, FALSE); + + if (boolValue2 == TRUE){ + + strValue3.Append(";"); + + } + + strValue3.Append("CALSCALE="); + strValue3.Append(DataValue); + + boolValue2 = TRUE; - if (!strValue3.IsEmpty()){ - - strValue3.Trim(); - strValue3.Trim(); - - if (boolValue2 == TRUE){ - - strValue2.Append(wxT(";")); - - } else { - - boolValue2 = TRUE; - - } - - strValue2.Append(wxT("CALSCALE=") + strValue3); - - boolValue = TRUE; - } - // Process Tokens. + // Extra tokens. + + if (!ContactEditorData.AnniversaryTokens.IsEmpty()){ - strValue2 = ContactEditorData.AnniversaryTokens; + wxString DataValue; + DataValue = ContactEditorData.AnniversaryTokens; + + EscapeString(&DataValue, FALSE); + + if (boolValue2 == TRUE){ + + strValue3.Append(";"); + + } + + strValue3.Append(DataValue); - // Deal with ANNIVERSARY. + } + + // Write the ANNIVERSARY property. if (!txtAnniversary->IsEmpty()){ - - strValue = txtAnniversary->GetValue(); - - if (!strValue.IsEmpty() || !strValue2.IsEmpty()){ - - if (!strValue2.IsEmpty()){ - - EscapeString(&strValue2, FALSE); - EscapeString(&strValue, FALSE); - - ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue); - - } else { - - EscapeString(&strValue, FALSE); - - ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue); - - } - - } - + + if (!txtAnniversary->GetValue().IsEmpty()){ + + strValue = txtAnniversary->GetValue(); + + if (!strValue3.IsEmpty()){ + + ContactData.AddRaw("ANNIVERSARY;VALUE=text;" + strValue3, strValue); + + } else { + + ContactData.AddRaw("ANNIVERSARY;VALUE=text", strValue); + + } + + } + } else { - + // Look for T and replace data before this. // Get Day, Month & Year. @@ -743,14 +750,14 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) } - if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){ + if (!FinalAnniversaryString.IsEmpty() || !strValue3.IsEmpty()){ - if (!strValue2.IsEmpty()){ + if (!strValue3.IsEmpty()){ EscapeString(&strValue2, FALSE); EscapeString(&strValue, FALSE); - ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString); + ContactData.AddRaw(wxT("ANNIVERSARY;") + strValue3, FinalAnniversaryString); } else {