X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Save.cpp;h=693c14b79b8491e57e14812c0a904b1472e747d1;hb=04a1ebb415bc0291b376d649d0d1ff680f4c6c7c;hp=e05199d67a0aa42a32434b9ae13e54f3fee4bcff;hpb=06903ae1bd1efe17b7fa5fbc355b2f361820d8fa;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Save.cpp b/source/contacteditor/frmContactEditor-Save.cpp index e05199d..693c14b 100644 --- a/source/contacteditor/frmContactEditor-Save.cpp +++ b/source/contacteditor/frmContactEditor-Save.cpp @@ -387,91 +387,89 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) } - strValue.Clear(); - strValue2.Clear(); - strValue3.Clear(); + ResetSaveProcessData(); - boolValue = FALSE; - boolValue2 = FALSE; - intValue2 = 0; - intValue = 0; + // Build the values for the BDAY property. + + // ALTID + + if (!ContactEditorData.BirthdayAltID.IsEmpty()){ - // Process Label. + wxString DataValue; + DataValue = ContactEditorData.BirthdayAltID; - strValue3 = ContactEditorData.BirthdayAltID; + 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.BirthdayCalScale.IsEmpty()){ - strValue3 = ContactEditorData.BirthdayCalScale; + wxString DataValue; + DataValue = ContactEditorData.BirthdayCalScale; - if (!strValue3.IsEmpty()){ - - strValue3.Trim(); - strValue3.Trim(); - - if (boolValue2 == TRUE){ - - strValue2.Append(wxT(";")); - - } else { - - boolValue2 = TRUE; - - } - - strValue2.Append(wxT("CALSCALE=") + strValue3); - - boolValue = TRUE; - - } + EscapeString(&DataValue, FALSE); + + if (boolValue2 == TRUE){ + + strValue3.Append(";"); + + } + + strValue3.Append("CALSCALE="); + strValue3.Append(DataValue); + + boolValue2 = TRUE; - // Process Tokens. + } - strValue2 = ContactEditorData.BirthdayTokens; + // Extra tokens. - // Get the birthday and write it. + if (!ContactEditorData.BirthdayTokens.IsEmpty()){ - ResetSaveProcessData(); + wxString DataValue; + DataValue = ContactEditorData.BirthdayTokens; + + EscapeString(&DataValue, FALSE); + + if (boolValue2 == TRUE){ + + strValue3.Append(";"); + + } + + strValue3.Append(DataValue); + } + + // Write the BDAY property. + if (!txtBirthday->IsEmpty()){ - - strValue = txtBirthday->GetValue(); - - if (!strValue.IsEmpty() || !strValue2.IsEmpty()){ - - if (!strValue2.IsEmpty()){ - - EscapeString(&strValue2, FALSE); - EscapeString(&strValue, FALSE); - - ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue); - - } else { - - EscapeString(&strValue, FALSE); - - ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue); - - } - - } - + + if (!txtBirthday->GetValue().IsEmpty()){ + + strValue = txtBirthday->GetValue(); + + if (!strValue3.IsEmpty()){ + + ContactData.AddRaw("BDAY;VALUE=text;" + strValue3, strValue); + + } else { + + ContactData.AddRaw("BDAY;VALUE=text", strValue); + + } + + } + } else { - + // Deal with date. // Get Day, Month & Year. @@ -559,14 +557,14 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) } - if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){ + if (!FinalBirthdayString.IsEmpty() || !strValue3.IsEmpty()){ - if (!strValue2.IsEmpty()){ + if (!strValue3.IsEmpty()){ EscapeString(&strValue2, FALSE); EscapeString(&strValue, FALSE); - ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString); + ContactData.AddRaw(wxT("BDAY;") + strValue3, FinalBirthdayString); } else { @@ -579,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. - strValue2 = ContactEditorData.AnniversaryTokens; + if (!ContactEditorData.AnniversaryTokens.IsEmpty()){ - // Deal with ANNIVERSARY. + wxString DataValue; + DataValue = ContactEditorData.AnniversaryTokens; + + EscapeString(&DataValue, FALSE); + + if (boolValue2 == TRUE){ + + strValue3.Append(";"); + + } + + strValue3.Append(DataValue); + + } + + // 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. @@ -745,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 { @@ -1356,14 +1361,26 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) for (std::map::iterator iter = ContactEditorData.GeneralGeographyList.begin(); iter != ContactEditorData.GeneralGeographyList.end(); ++iter){ - wxString strAddressFinalValue = iter->second; + wxString strGeoFinalValue = iter->second; - ProcessCaptureStrings(&strAddressFinalValue); + ProcessCaptureStrings(&strGeoFinalValue); - strAddressFinalValue.insert(0, wxT("geo:")); + if (ContactEditorData.GeneralGeographyListDataType.find(iter->first) != + ContactEditorData.GeneralGeographyListDataType.end()){ + + std::map::iterator DataTypeIter = ContactEditorData.GeneralGeographyListDataType.find(iter->first); + + strGeoFinalValue.insert(0, ":"); + strGeoFinalValue.insert(0, DataTypeIter->second); + + } else { + + strGeoFinalValue.insert(0, "geo:"); + + } ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue, - &iter, &strAddressFinalValue, &ContactData, + &iter, &strGeoFinalValue, &ContactData, wxT("ALTID"), &ContactEditorData.GeneralGeographyListAltID, wxT("PID"), &ContactEditorData.GeneralGeographyListPID, wxT("MEDIATYPE"), &ContactEditorData.GeneralGeographyListMediatype, @@ -1379,14 +1396,26 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) for (std::map::iterator iter = ContactEditorData.HomeGeographyList.begin(); iter != ContactEditorData.HomeGeographyList.end(); ++iter){ - wxString strAddressFinalValue = iter->second; + wxString strGeoFinalValue = iter->second; - ProcessCaptureStrings(&strAddressFinalValue); + ProcessCaptureStrings(&strGeoFinalValue); - strAddressFinalValue.insert(0, wxT("geo:")); + if (ContactEditorData.HomeGeographyListDataType.find(iter->first) != + ContactEditorData.HomeGeographyListDataType.end()){ + + std::map::iterator DataTypeIter = ContactEditorData.HomeGeographyListDataType.find(iter->first); + + strGeoFinalValue.insert(0, ":"); + strGeoFinalValue.insert(0, DataTypeIter->second); + + } else { + + strGeoFinalValue.insert(0, "geo:"); + + } ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue, - &iter, &ContactEditorData.HomeGeographyList, &ContactData, + &iter, &strGeoFinalValue, &ContactData, wxT("ALTID"), &ContactEditorData.HomeGeographyListAltID, wxT("PID"), &ContactEditorData.HomeGeographyListPID, wxT("MEDIATYPE"), &ContactEditorData.HomeGeographyListMediatype, @@ -1402,14 +1431,26 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) for (std::map::iterator iter = ContactEditorData.BusinessGeographyList.begin(); iter != ContactEditorData.BusinessGeographyList.end(); ++iter){ - wxString strAddressFinalValue = iter->second; + wxString strGeoFinalValue = iter->second; - ProcessCaptureStrings(&strAddressFinalValue); + ProcessCaptureStrings(&strGeoFinalValue); - strAddressFinalValue.insert(0, wxT("geo:")); + if (ContactEditorData.BusinessGeographyListDataType.find(iter->first) != + ContactEditorData.BusinessGeographyListDataType.end()){ + + std::map::iterator DataTypeIter = ContactEditorData.BusinessGeographyListDataType.find(iter->first); + + strGeoFinalValue.insert(0, ":"); + strGeoFinalValue.insert(0, DataTypeIter->second); + + } else { + + strGeoFinalValue.insert(0, "geo:"); + + } ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue, - &iter, &ContactEditorData.BusinessGeographyList, &ContactData, + &iter, &strGeoFinalValue, &ContactData, wxT("ALTID"), &ContactEditorData.BusinessGeographyListAltID, wxT("PID"), &ContactEditorData.BusinessGeographyListPID, wxT("MEDIATYPE"), &ContactEditorData.BusinessGeographyListMediatype,