From: Steve Brokenshire Date: Tue, 29 Dec 2015 02:20:18 +0000 (+0000) Subject: Implemented loading for EMAIL using ContactDataObject. X-Git-Tag: release-0.09~133 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=01a3141be71e31f6eabd97d65cb630ddeaa1a5c9;p=xestiaab%2F.git Implemented loading for EMAIL using ContactDataObject. --- diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index c8e1362..aa5b0e9 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -166,7 +166,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadMember(&ContactEditorData.GroupsList); - // Process the address (ADR) (frmContactEditor-LoadAddress.cpp) + // Process the addresses (ADR) (frmContactEditor-LoadAddress.cpp) LoadAddress(&ContactEditorData.GeneralAddressList, &ContactEditorData.GeneralAddressListTown, @@ -185,7 +185,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ &ContactEditorData.BusinessAddressListPref, &ADRCount); - // Process the timezone (TZ) (frmContactEditor-LoadTimeZone.cpp) + // Process the timezones (TZ) (frmContactEditor-LoadTimeZone.cpp) LoadTimeZone(&ContactEditorData.GeneralTZList, &ContactEditorData.GeneralTZListPref, @@ -194,6 +194,16 @@ bool frmContactEditor::LoadContact(wxString Filename){ &ContactEditorData.BusinessTZList, &ContactEditorData.BusinessTZListPref, &TZCount); + + // Process the emails (frmContactEditor-LoadEmail.cpp) + + LoadEmail(&ContactEditorData.GeneralEmailList, + &ContactEditorData.GeneralEmailListPref, + &ContactEditorData.HomeEmailList, + &ContactEditorData.HomeEmailListPref, + &ContactEditorData.BusinessEmailList, + &ContactEditorData.BusinessEmailListPref, + &EmailCount); for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ @@ -356,13 +366,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadADR(wxSPropertySeg1, wxSPropertySeg2, &ADRCount); - }*/ else if (wxSProperty == wxT("EMAIL")){ + } else if (wxSProperty == wxT("EMAIL")){ // See frmContactEditor-LoadEmail.cpp LoadEmail(wxSPropertySeg1, wxSPropertySeg2, &EmailCount); - } else if (wxSProperty == wxT("IMPP")){ + }*/ else if (wxSProperty == wxT("IMPP")){ // See frmContactEditor-LoadIM.cpp diff --git a/source/contacteditor/frmContactEditor-LoadEmail.cpp b/source/contacteditor/frmContactEditor-LoadEmail.cpp index fef123b..afb08d3 100644 --- a/source/contacteditor/frmContactEditor-LoadEmail.cpp +++ b/source/contacteditor/frmContactEditor-LoadEmail.cpp @@ -18,6 +18,90 @@ #include "frmContactEditor.h" +void frmContactEditor::LoadEmail(std::map *GeneralEmailListPtr, + std::map *GeneralEmailListPrefPtr, + std::map *HomeEmailListPtr, + std::map *HomeEmailListPrefPtr, + std::map *BusinessEmailListPtr, + std::map *BusinessEmailListPrefPtr, + int *EmailCount){ + + long ListCtrlIndex = -1; + + // Deal with the general addresses. + + for (std::map::iterator Iter = GeneralEmailListPtr->begin(); + Iter != GeneralEmailListPtr->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*EmailCount); + coldata.SetData(*EmailCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = lboEmails->InsertItem(coldata); + + if (MapDataExists(EmailCount, GeneralEmailListPrefPtr)){ + + lboEmails->SetItem(ListCtrlIndex, 1, wxString::Format("%i", GeneralEmailListPrefPtr->find(*EmailCount)->second)); + + } + + (*EmailCount)++; + + } + + // Deal with the home addresses. + + for (std::map::iterator Iter = HomeEmailListPtr->begin(); + Iter != HomeEmailListPtr->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*EmailCount); + coldata.SetData(*EmailCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = lboHomeEmails->InsertItem(coldata); + + if (MapDataExists(EmailCount, HomeEmailListPrefPtr)){ + + lboHomeEmails->SetItem(ListCtrlIndex, 1, wxString::Format("%i", HomeEmailListPrefPtr->find(*EmailCount)->second)); + + } + + (*EmailCount)++; + + } + + // Deal with the work addresses. + + for (std::map::iterator Iter = BusinessEmailListPtr->begin(); + Iter != BusinessEmailListPtr->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*EmailCount); + coldata.SetData(*EmailCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = lboBusinessEmail->InsertItem(coldata); + + if (MapDataExists(EmailCount, BusinessEmailListPrefPtr)){ + + lboBusinessEmail->SetItem(ListCtrlIndex, 1, wxString::Format("%i", BusinessEmailListPrefPtr->find(*EmailCount)->second)); + + } + + (*EmailCount)++; + + } + +} + void frmContactEditor::LoadEmail(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *EmailCount){ size_t intPropertyLen = wxSPropertySeg1.Len(); diff --git a/source/contacteditor/frmContactEditor.h b/source/contacteditor/frmContactEditor.h index e5ceb88..a9f0ab5 100644 --- a/source/contacteditor/frmContactEditor.h +++ b/source/contacteditor/frmContactEditor.h @@ -670,6 +670,13 @@ class frmContactEditor : public frmContactEditorADT std::map *BusinessTZListPtr, std::map *BusinessTZListPrefPtr, int *TZCount); + void LoadEmail(std::map *GeneralEmailListPtr, + std::map *GeneralEmailListPrefPtr, + std::map *HomeEmailListPtr, + std::map *HomeEmailListPrefPtr, + std::map *BusinessEmailListPtr, + std::map *BusinessEmailListPrefPtr, + int *EmailCount); int intValueSeek = 1; bool IsGroup = FALSE;