Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added NICKNAME to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 73fb904..b422160 100644 (file)
@@ -78,7 +78,66 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                        break;
                
        }
+       
+       // TODO: Sortout REV.
+       
+       // Process XML.
 
+       for (std::map<int, wxString>::iterator XMLIter = XMLList.begin();
+               XMLIter != XMLList.end(); XMLIter++){
+       
+               ProcessData.Append("XML");
+                       
+               if (XMLListAltID[XMLIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append(XMLListAltID[XMLIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(XMLIter->second);
+               ProcessData.Append("\n");
+               
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+       
+       // Process SOURCE.
+       
+       SaveSource(&SourceList, &SourceListAltID, 
+               &SourceListPID, &SourceListType,
+               &SourceListMediatype, &SourceListPref, 
+               &SourceListTokens, SaveData);
+       
+       // Process CLIENTPIDMAP.
+       
+       for (std::map<int, wxString>::iterator CPIDIter = ClientPIDList.begin();
+               CPIDIter != ClientPIDList.end(); CPIDIter++){
+       
+               ProcessData.Append("CLIENTPIDMAP");
+                       
+               if (ClientPIDListTokens[CPIDIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append(ClientPIDListTokens[CPIDIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(CPIDIter->second);
+               ProcessData.Append("\n");
+               
+               ProcessData = OutputText(&ProcessData);
+               
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+       
        // Process FN.
        
        for (std::map<int, wxString>::iterator FNIter = FullNamesList.begin();
@@ -151,6 +210,21 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                        
        }
        
+       // Process NICKNAME.
+       
+       SaveNickname(&GeneralNicknamesList, &GeneralNicknamesListAltID, 
+               &GeneralNicknamesListPID, &GeneralNicknamesListType,
+               &GeneralNicknamesListLanguage, &GeneralNicknamesListPref, 
+               &GeneralNicknamesListTokens, SaveData, "");
+       SaveNickname(&HomeNicknamesList, &HomeNicknamesListAltID, 
+               &HomeNicknamesListPID, &HomeNicknamesListType,
+               &HomeNicknamesListLanguage, &HomeNicknamesListPref, 
+               &HomeNicknamesListTokens, SaveData, "home");
+       SaveNickname(&BusinessNicknamesList, &BusinessNicknamesListAltID, 
+               &BusinessNicknamesListPID, &BusinessNicknamesListType,
+               &BusinessNicknamesListLanguage, &BusinessNicknamesListPref, 
+               &BusinessNicknamesListTokens, SaveData, "work");
+       
        // Process TITLE.
 
        SaveTitle(&GeneralTitleList, &GeneralTitleListLanguage,
@@ -253,4 +327,162 @@ void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxStri
                        
        }
                
+}
+
+void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxString> *SourceListAltID, 
+       map<int, wxString> *SourceListPID, map<int, wxString> *SourceListType,
+       map<int, wxString> *SourceListMediatype, map<int, int> *SourceListPref, 
+       map<int, wxString> *SourceListTokens, wxString *SaveData){
+
+       wxString ProcessData = "";
+       
+       for (std::map<int, wxString>::iterator SourceIter = SourceList->begin();
+               SourceIter != SourceList->end(); SourceIter++){
+
+               ProcessData.Append("SOURCE");
+                       
+               // Check if there is a value for TYPE.
+               
+               if ((*SourceListType)[SourceIter->first].size() > 0){
+               
+                       ProcessData.Append(";TYPE=");
+                       ProcessData.Append((*SourceListType)[SourceIter->first]);
+                       
+               }
+               
+               // Check if there is a value for ALTID.
+               
+               if ((*SourceListAltID)[SourceIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*SourceListAltID)[SourceIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*SourceListMediatype)[SourceIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*SourceListMediatype)[SourceIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*SourceListPID)[SourceIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*SourceListPID)[SourceIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*SourceListPref)[SourceIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*SourceListPref)[SourceIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*SourceListTokens)[SourceIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*SourceListTokens)[SourceIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(SourceIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+                       
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
+}
+
+void ContactDataObject::SaveNickname(map<int, wxString> *NicknameList, map<int, wxString> *NicknameListAltID, 
+       map<int, wxString> *NicknameListPID, map<int, wxString> *NicknameListType,
+       map<int, wxString> *NicknameListLanguage, map<int, int> *NicknameListPref, 
+       map<int, wxString> *NicknameListTokens, wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+       
+       for (std::map<int, wxString>::iterator NicknameIter = NicknameList->begin();
+               NicknameIter != NicknameList->end(); NicknameIter++){
+
+               ProcessData.Append("NICKNAME");
+                       
+               // 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 ((*NicknameListAltID)[NicknameIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*NicknameListAltID)[NicknameIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*NicknameListLanguage)[NicknameIter->first].size() > 0){
+               
+                       ProcessData.Append(";LANGUAGE=");
+                       ProcessData.Append((*NicknameListLanguage)[NicknameIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*NicknameListPID)[NicknameIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*NicknameListPID)[NicknameIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*NicknameListPref)[NicknameIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*NicknameListPref)[NicknameIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*NicknameListTokens)[NicknameIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*NicknameListTokens)[NicknameIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(NicknameIter->second);
+               ProcessData.Append("\n");
+
+               ProcessData = OutputText(&ProcessData);
+                       
+               SaveData->Append(ProcessData);
+               ProcessData.clear();
+                       
+       }
+               
 }
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy