Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added TZ to the SaveString function of ContactDataObject
[xestiaab/.git] / source / contacteditor / cdo / ContactDataObject-Save.cpp
index 4cc5a6f..5fbc386 100644 (file)
@@ -79,6 +79,33 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                
        }
        
+       // 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, 
@@ -86,6 +113,31 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &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();
@@ -158,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,
@@ -173,6 +240,21 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){
                &BusinessTitleListType, &BusinessTitleListPref,
                &BusinessTitleListTokens, SaveData, "work");
        
+       // Process TZ.
+       
+       SaveTimezone(&GeneralTZList, &GeneralTZListAltID, 
+               &GeneralTZListPID, &GeneralTZListType,
+               &GeneralTZListMediatype, &GeneralTZListPref, 
+               &GeneralTZListTokens, SaveData, "");
+       SaveTimezone(&HomeTZList, &HomeTZListAltID, 
+               &HomeTZListPID, &HomeTZListType,
+               &HomeTZListMediatype, &HomeTZListPref, 
+               &HomeTZListTokens, SaveData, "home");
+       SaveTimezone(&BusinessTZList, &BusinessTZListAltID, 
+               &BusinessTZListPID, &BusinessTZListType,
+               &BusinessTZListMediatype, &BusinessTZListPref, 
+               &BusinessTZListTokens, SaveData, "work");
+
        // Write the end part of the vCard data file.
        
        SaveData->Append("END:VCARD");
@@ -292,7 +374,7 @@ void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxSt
                        
                }
 
-               // Check if there is a value for LANGUAGE.
+               // Check if there is a value for MEDIATYPE.
                
                if ((*SourceListMediatype)[SourceIter->first].size() > 0){
                
@@ -339,4 +421,162 @@ void ContactDataObject::SaveSource(map<int, wxString> *SourceList, map<int, wxSt
                        
        }
                
+}
+
+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();
+                       
+       }
+               
+}
+
+void ContactDataObject::SaveTimezone(map<int, wxString> *TZList, map<int, wxString> *TZListAltID, 
+       map<int, wxString> *TZListPID, map<int, wxString> *TZListType,
+       map<int, wxString> *TZListMediatype, map<int, int> *TZListPref, 
+       map<int, wxString> *TZListTokens, wxString *SaveData, wxString DataType){
+
+       wxString ProcessData = "";
+       
+       for (std::map<int, wxString>::iterator TZIter = TZList->begin();
+               TZIter != TZList->end(); TZIter++){
+
+               ProcessData.Append("TZ");
+                       
+               // 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 ((*TZListAltID)[TZIter->first].size() > 0){
+               
+                       ProcessData.Append(";ALTID=");
+                       ProcessData.Append((*TZListAltID)[TZIter->first]);
+                       
+               }
+
+               // Check if there is a value for MEDIATYPE.
+               
+               if ((*TZListMediatype)[TZIter->first].size() > 0){
+               
+                       ProcessData.Append(";MEDIATYPE=");
+                       ProcessData.Append((*TZListMediatype)[TZIter->first]);
+                       
+               }
+               
+               // Check if there is a value for PID.
+
+               if ((*TZListPID)[TZIter->first].size() > 0){
+               
+                       ProcessData.Append(";PID=");
+                       ProcessData.Append((*TZListPID)[TZIter->first]);
+                       
+               }
+
+               // Check if there is a value for PREF.
+
+               if ((*TZListPref)[TZIter->first] > 0){
+               
+                       ProcessData.Append(";PREF=");
+                       ProcessData.Append(wxString::Format("%i", (*TZListPref)[TZIter->first]));
+                       
+               }
+
+               // Check if there is a value for tokens.
+
+               if ((*TZListTokens)[TZIter->first].size() > 0){
+               
+                       ProcessData.Append(";");
+                       ProcessData.Append((*TZListTokens)[TZIter->first]);
+                       
+               }
+                       
+               ProcessData.Append(":");
+               ProcessData.Append(TZIter->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