X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2Fcdo%2FContactDataObject-Save.cpp;h=2a436cbfa0316b2b7260b47223c5a058d7ebf9ae;hb=c96aab2ca3ef9a24252dd6d09677fe7f52959fd4;hp=01af8edf9fabe69ec3806297ca4b79e9e507e1de;hpb=e2b0fc5fade7f3a6af6761ecb3c3d69d292f78b8;p=xestiaab%2F.git diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index 01af8ed..2a436cb 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -118,14 +118,18 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ // Process TITLE. - for (std::map::iterator TitleIter = GeneralTitleList.begin(); - TitleIter != GeneralTitleList.end(); TitleIter++){ - - SaveData->Append("TITLE:"); - SaveData->Append(TitleIter->second); - SaveData->Append("\n"); - - } + SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage, + &GeneralTitleListAltID, &GeneralTitleListPID, + &GeneralTitleListType, &GeneralTitleListPref, + &GeneralTitleListTokens, SaveData, ""); + SaveTitle(&HomeTitleList, &HomeTitleListLanguage, + &HomeTitleListAltID, &HomeTitleListPID, + &HomeTitleListType, &HomeTitleListPref, + &HomeTitleListTokens, SaveData, "home"); + SaveTitle(&BusinessTitleList, &BusinessTitleListLanguage, + &BusinessTitleListAltID, &BusinessTitleListPID, + &BusinessTitleListType, &BusinessTitleListPref, + &BusinessTitleListTokens, SaveData, "work"); // Write the end part of the vCard data file. @@ -135,4 +139,83 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ return SaveDataStatus; +} + +void ContactDataObject::SaveTitle(map *TitleList, map *TitleListLanguage, + map *TitleListAltID, map *TitleListPID, + map *TitleListType, map *TitleListPref, + map *TitleListTokens, wxString *SaveData, wxString DataType){ + + wxString ProcessData = ""; + + for (std::map::iterator TitleIter = TitleList->begin(); + TitleIter != TitleList->end(); TitleIter++){ + + ProcessData.Append("TITLE"); + + // Check if there is a value for TYPE. + + if (DataType.size() > 0){ + + ProcessData.Append(";TYPE="); + ProcessData.Append(DataType); + + } + + // Check if there is a value for ALTID. + + if ((*TitleListAltID)[TitleIter->first].size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append((*TitleListAltID)[TitleIter->first]); + + } + + // Check if there is a value for LANGUAGE. + + if ((*TitleListLanguage)[TitleIter->first].size() > 0){ + + ProcessData.Append(";LANGUAGE="); + ProcessData.Append((*TitleListLanguage)[TitleIter->first]); + + } + + // Check if there is a value for PID. + + if ((*TitleListPID)[TitleIter->first].size() > 0){ + + ProcessData.Append(";PID="); + ProcessData.Append((*TitleListPID)[TitleIter->first]); + + } + + // Check if there is a value for PREF. + + if ((*TitleListPref)[TitleIter->first] > 0){ + + ProcessData.Append(";PREF="); + ProcessData.Append(wxString::Format("%i", (*TitleListPref)[TitleIter->first])); + + } + + // Check if there is a value for tokens. + + if ((*TitleListTokens)[TitleIter->first].size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append((*TitleListTokens)[TitleIter->first]); + + } + + ProcessData.Append(":"); + ProcessData.Append(TitleIter->second); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } + } \ No newline at end of file