// Process TITLE.
- for (std::map<int, wxString>::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.
return SaveDataStatus;
+}
+
+void ContactDataObject::SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
+ map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
+ map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
+ map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType){
+
+ wxString ProcessData = "";
+
+ for (std::map<int, wxString>::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
#include "../../vcard/vcard.h"
#include "../../common/textprocessing.h"
+using namespace std;
+
enum ContactLoadStatus{
CONTACTLOAD_UNITTESTFAIL = -1,
CONTACTLOAD_OK,
void ProcessCalendarFreeBusy(wxString PropertySeg1, wxString PropertySeg2, int *FreeBusyAddressCount);
void ProcessKey(wxString PropertySeg1, wxString PropertySeg2, int *KeyCount);
void ProcessVendor(wxString PropertySeg1, wxString PropertySeg2, int *VendorCount);
+
+ // Save functions
+
+ void SaveTitle(map<int, wxString> *TitleList, map<int, wxString> *TitleListLanguage,
+ map<int, wxString> *TitleListAltID, map<int, wxString> *TitleListPID,
+ map<int, wxString> *TitleListType, map<int, int> *TitleListPref,
+ map<int, wxString> *TitleListTokens, wxString *SaveData, wxString DataType);
public: