X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Load.cpp;h=c6ae96a6b328b061291a68ec74b005bac05a9910;hb=074e2db3331d35762f1d2dcf06d98f15200fc225;hp=14b20bda9751b0012465bb96c37404af2022ca96;hpb=2171887a85a5eca924e73c23422a9fcc91e11bb2;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index 14b20bd..c6ae96a 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -47,68 +47,45 @@ bool frmContactEditor::LoadContact(wxString Filename){ wxSContactFilename = Filename; - // Check if we are using wxWidgets version 2.8 or less and - // execute the required command accordingly. - -#if wxABI_VERSION < 20900 - ContactFile.Open(Filename.c_str(), wxT("r")); -#else - ContactFile.Open(Filename, wxT("r")); -#endif - - if (ContactFile.IsOpened() == FALSE){ - - return FALSE; - - } - - ContactEditorData.LoadFile(Filename); - - ContactFile.ReadAll(&wxSContactString, wxConvAuto()); - - // Split the lines. + ContactLoadStatus LoadResult = ContactEditorData.LoadFile(Filename); + + switch(LoadResult){ - std::map ContactFileLines; - std::map::iterator striter; + case CONTACTLOAD_OK: + break; + case CONTACTLOAD_FILEMISSING: + wxMessageBox(_("The file with the filename given does not exist."), + _("Contact not found"), wxICON_ERROR); + this->Close(); + return FALSE; + break; + case CONTACTLOAD_FILEERROR: + wxMessageBox(_("The file with the filename given cannot be opened due to an error while trying open it."), + _("Error loading contact"), wxICON_ERROR); + this->Close(); + return FALSE; + break; + case CONTACTLOAD_FILEINVALIDFORMAT: + wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."), + _("Contact not supported"), wxICON_ERROR); + this->Close(); + return FALSE; + break; + case CONTACTLOAD_FILEBASESPECFAIL: + wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."), + _("Contact not supported"), wxICON_ERROR); + this->Close(); + return FALSE; + break; - wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n")); - - int ContactLineSeek = 0; - - while (wSTContactFileLines.HasMoreTokens() == TRUE){ - - ContactLine = wSTContactFileLines.GetNextToken(); - ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine)); - ContactLineSeek++; + }; - } - // Get the line. - bool QuoteMode = FALSE; - bool PropertyFind = TRUE; - bool HasExtraNicknames = FALSE; - bool IgnoreGender = FALSE; - bool ExtraLineSeek = TRUE; - //bool BirthdayProcessed = FALSE; - //bool AnniversaryProcessed = FALSE; - bool FNProcessed = FALSE; - bool GenderProcessed = FALSE; - bool NameProcessed = FALSE; - //bool UIDProcessed = FALSE; - //bool KindProcessed = FALSE; - bool ETagFound = FALSE; - bool ETagOrigFound = FALSE; - bool VersionProcessed = FALSE; - int intExtraNickname = 0; wxString wxSProperty; wxString wxSPropertySeg1; wxString wxSPropertySeg2; wxString wxSPropertyNextLine; - size_t ContactLineLen = 0; - int QuoteBreakPoint = 0; - int FNCount = 0; - int NameCount = 0; int NicknameCount = 0; int ADRCount = 0; int EmailCount = 0; @@ -124,7 +101,6 @@ bool frmContactEditor::LoadContact(wxString Filename){ int OrgCount = 0; int NoteCount = 0; int CategoryCount = 0; - int GroupCount = 0; int PhotoCount = 0; int LogoCount = 0; int SoundCount = 0; @@ -134,12 +110,11 @@ bool frmContactEditor::LoadContact(wxString Filename){ int KeyCount = 0; int VendorCount = 0; int XTokenCount = 0; - //int intValueSeek = 1; // Process the unique ID (UID) - UIDToken = ContactEditorData.UIDToken; - + // Do nothing at the moment. + // Process the contact type (KIND) (frmContactEditor-LoadGroup.cpp) LoadKind(&ContactEditorData.ContactKind); @@ -237,7 +212,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ lboBusinessLanguages, &LangCount); - // Process the geoposition (GEO). + // Process the geopositiosn (GEO). LoadData(&ContactEditorData.GeneralGeographyList, &ContactEditorData.GeneralGeographyListPref, @@ -250,7 +225,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ lboBusinessGeoposition, &GeoCount); - // Process the website (URL). + // Process the websites (URL). LoadData(&ContactEditorData.GeneralWebsiteList, &ContactEditorData.GeneralWebsiteListPref, @@ -263,370 +238,189 @@ bool frmContactEditor::LoadContact(wxString Filename){ lboBusinessWebsites, &URLCount); - for (std::map::iterator iter = ContactFileLines.begin(); - iter != ContactFileLines.end(); ++iter){ + // Process the titles (TITLE). - // Find the colon which splits the start bit from the data part. - - ContactLine = iter->second; - - while (ExtraLineSeek == TRUE){ - - // Check if there is extra data on the next line - // (indicated by space or tab at the start) and add data. - - iter++; - - if (iter == ContactFileLines.end()){ - - iter--; - break; - - } - - wxSPropertyNextLine = iter->second; - - - if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){ - - wxSPropertyNextLine.Remove(0, 1); - //wxSPropertyNextLine.Trim(FALSE); - //ContactLine.Trim(); - ContactLine.Append(wxSPropertyNextLine); - - } else { - - iter--; - ExtraLineSeek = FALSE; - - } - - } - - ContactLineLen = ContactLine.Len(); - - // Make sure we are not in quotation mode. - // Make sure colon does not have \ or \\ before it. - - for (int i = 0; i <= ContactLineLen; i++){ - - if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){ - - PropertyFind = FALSE; - - } else if (PropertyFind == TRUE){ - - wxSProperty.Append(ContactLine.Mid(i, 1)); - - } - - if (ContactLine.Mid(i, 1) == wxT("\"")){ - - if (QuoteMode == TRUE){ - - QuoteMode = FALSE; - - } else { - - QuoteMode = TRUE; - - } - - } - - if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){ - - QuoteBreakPoint = i; - break; - - } - - } - - // Split that line at the point into two variables (ignore the colon). - - wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint); - wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); - - // Add the data into the contact editor depending on what it is. - - if (wxSProperty == wxT("VERSION") && VersionProcessed == FALSE){ - - // Check if version is 4.0, otherwise don't - // load. - - if (wxSPropertySeg2 != wxT("4.0")){ - wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."), - _("Contact not supported"), wxICON_ERROR); - this->Close(); - return FALSE; - } - - VersionProcessed = TRUE; - - }/* if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){ - - // See frmContactEditor-LoadGroup.cpp - - LoadKind(wxSPropertySeg2); - - }/* else if (wxSProperty == wxT("MEMBER")){ - - // See frmContactEditor-LoadGroup.cpp - - LoadMember(wxSPropertySeg2, &GroupCount); - - }*/ else if (wxSProperty == wxT("FN")){ - - // See frmContactEditor-LoadName.cpp - - LoadFN(wxSPropertySeg1, wxSPropertySeg2, &FNCount, &FNProcessed, &ContactData); - - }/* else if (wxSProperty == wxT("N") && NameProcessed == FALSE){ - - // See frmContactEditor-LoadName.cpp - - LoadN(wxSPropertySeg1, wxSPropertySeg2, &NameProcessed, &ContactData); - - } else if (wxSProperty == wxT("NICKNAME")){ - - // See frmContactEditor-LoadNickname.cpp - - LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData); - - } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ - - // See frmContactEditor-LoadGender.cpp - - LoadGender(wxSPropertySeg1, wxSPropertySeg2, &GenderProcessed, &ContactData); - - } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){ - - // See frmContactEditor-LoadBADays.cpp - - LoadBDay(wxSPropertySeg1, wxSPropertySeg2, &BirthdayProcessed); - - } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){ - - // See frmContactEditor-LoadBADays.cpp - - LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed); - - } else if (wxSProperty == wxT("TZ")){ - - // See frmContactEditor-LoadTimeZone.cpp - - LoadTimeZone(wxSPropertySeg1, wxSPropertySeg2, &TZCount); - - } else if (wxSProperty == wxT("ADR")){ - - // See frmContactEditor-LoadAddress.cpp - - LoadADR(wxSPropertySeg1, wxSPropertySeg2, &ADRCount); - - } else if (wxSProperty == wxT("EMAIL")){ - - // See frmContactEditor-LoadEmail.cpp - - LoadEmail(wxSPropertySeg1, wxSPropertySeg2, &EmailCount); - - }*/ else if (wxSProperty == wxT("IMPP")){ - - // See frmContactEditor-LoadIM.cpp - - LoadIM(wxSPropertySeg1, wxSPropertySeg2, &IMPPCount); - - } else if (wxSProperty == wxT("TEL")){ - - // See frmContactEditor-LoadTelephone.cpp - - LoadTelephone(wxSPropertySeg1, wxSPropertySeg2, &TelCount); - - }/* else if (wxSProperty == wxT("LANG")){ - - // See frmContactEditor-LoadLanguage.cpp - - LoadLanguage(wxSPropertySeg1, wxSPropertySeg2, &LangCount); - - } else if (wxSProperty == wxT("GEO")){ - - // See frmContactEditor-LoadGeo.cpp - - LoadGeo(wxSPropertySeg1, wxSPropertySeg2, &GeoCount); - - }*/ else if (wxSProperty == wxT("RELATED")){ - - // See fromContactEditor-LoadRelated.cpp - - LoadRelated(wxSPropertySeg1, wxSPropertySeg2, &RelatedCount); - - }/* else if (wxSProperty == wxT("URL")){ - - // See frmContactEditor-LoadURL.cpp - - LoadURL(wxSPropertySeg1, wxSPropertySeg2, &URLCount); - - }*/ else if (wxSProperty == wxT("TITLE")) { - - // See frmContactEditor-LoadTitle.cpp - - LoadTitle(wxSPropertySeg1, wxSPropertySeg2, &TitleCount); - - } else if (wxSProperty == wxT("ROLE")) { - - // See frmContactEditor-LoadRole.cpp - - LoadRole(wxSPropertySeg1, wxSPropertySeg2, &RoleCount); - - } else if (wxSProperty == wxT("ORG")) { - - // See frmContactEditor-LoadOrg.cpp - - LoadOrg(wxSPropertySeg1, wxSPropertySeg2, &OrgCount); - - } else if (wxSProperty == wxT("NOTE")) { - - // See frmContactEditor-LoadNote.cpp - - LoadNote(wxSPropertySeg1, wxSPropertySeg2, &NoteCount); - - } else if (wxSProperty == wxT("CATEGORIES")) { - - // See frmContactEditor-LoadCategory.cpp - - LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount); - - } else if (wxSProperty == wxT("PHOTO")) { - - // See frmContactEditor-LoadPhoto.cpp - - LoadPhoto(wxSPropertySeg1, wxSPropertySeg2, &PhotoCount); - - } else if (wxSProperty == wxT("LOGO")) { - - // See frmContactEditor-LoadLogo.cpp - - LoadLogo(wxSPropertySeg1, wxSPropertySeg2, &LogoCount); - - } else if (wxSProperty == wxT("SOUND")) { - - // See frmContactEditor-LoadSound.cpp - - LoadSound(wxSPropertySeg1, wxSPropertySeg2, &SoundCount); - - } else if (wxSProperty == wxT("CALURI")){ + LoadData(&ContactEditorData.GeneralTitleList, + &ContactEditorData.GeneralTitleListPref, + lboTitles, + &ContactEditorData.HomeTitleList, + &ContactEditorData.HomeTitleListPref, + lboHomeTitles, + &ContactEditorData.BusinessTitleList, + &ContactEditorData.BusinessTitleListPref, + lboBusinessTitles, + &TitleCount); + + // Process the roles (ROLE). + + LoadData(&ContactEditorData.GeneralRoleList, + &ContactEditorData.GeneralRoleListPref, + lboRoles, + &ContactEditorData.HomeRoleList, + &ContactEditorData.HomeRoleListPref, + lboHomeRoles, + &ContactEditorData.BusinessRoleList, + &ContactEditorData.BusinessRoleListPref, + lboBusinessRoles, + &RoleCount); - // See frmContactEditor-LoadCalendar.cpp - - LoadCalURI(wxSPropertySeg1, wxSPropertySeg2, &CalAdrCount); - - } else if (wxSProperty == wxT("CALADRURI")){ + // Process the roles (ORG). + + LoadData(&ContactEditorData.GeneralOrganisationsList, + &ContactEditorData.GeneralOrganisationsListPref, + lboOrganisations, + &ContactEditorData.HomeOrganisationsList, + &ContactEditorData.HomeOrganisationsListPref, + lboHomeOrganisations, + &ContactEditorData.BusinessOrganisationsList, + &ContactEditorData.BusinessOrganisationsListPref, + lboBusinessOrganisations, + &OrgCount); + + // Process the notes (NOTE). + + LoadData(&ContactEditorData.GeneralNoteList, + &ContactEditorData.GeneralNoteListPref, + lboNotes, + &ContactEditorData.HomeNoteList, + &ContactEditorData.HomeNoteListPref, + lboHomeNotes, + &ContactEditorData.BusinessNoteList, + &ContactEditorData.BusinessNoteListPref, + lboBusinessNotes, + &NoteCount); + + // Process the categories (CATEGORIES). - // See frmContactEditor-LoadCalendar.cpp - - LoadCalAdrURI(wxSPropertySeg1, wxSPropertySeg2, &CalReqAdrCount); + LoadData(&ContactEditorData.CategoriesList, + &ContactEditorData.CategoriesListPref, + lboCategories, + &CategoryCount); - } else if (wxSProperty == wxT("FBURL")){ - - // See frmContactEditor-LoadCalendar.cpp + // Process the telephone numbers (TEL). + + LoadData(&ContactEditorData.GeneralTelephoneList, + &ContactEditorData.GeneralTelephoneListPref, + &ContactEditorData.GeneralTelephoneListTypeInfo, + lboTelephone, + &ContactEditorData.HomeTelephoneList, + &ContactEditorData.HomeTelephoneListPref, + &ContactEditorData.HomeTelephoneListTypeInfo, + lboHomeTelephone, + &ContactEditorData.BusinessTelephoneList, + &ContactEditorData.BusinessTelephoneListPref, + &ContactEditorData.BusinessTelephoneListTypeInfo, + lboBusinessTelephone, + &TelCount); - LoadCalFreeBusy(wxSPropertySeg1, wxSPropertySeg2, &FreeBusyCount); + // Process the instant messaging (IMPP). + + LoadData(&ContactEditorData.GeneralIMListTypeInfo, + &ContactEditorData.GeneralIMListPref, + &ContactEditorData.GeneralIMList, + lboIM, + &ContactEditorData.HomeIMListTypeInfo, + &ContactEditorData.HomeIMListPref, + &ContactEditorData.HomeIMList, + lboHomeIM, + &ContactEditorData.BusinessIMListTypeInfo, + &ContactEditorData.BusinessIMListPref, + &ContactEditorData.BusinessIMList, + lboBusinessIM, + &IMPPCount); - } else if (wxSProperty == wxT("KEY")){ - - // See frmContactEditor-LoadKey.cpp - - LoadKey(wxSPropertySeg1, wxSPropertySeg2, &KeyCount); - - }/* else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){ - - UIDToken = wxSPropertySeg2; - UIDProcessed = TRUE; - - }*/ else if (wxSProperty.Mid(0, 3) == wxT("VND")){ - - // Split the Vendor three ways. - - wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-")); - - wxString wxSVNDID; - wxString wxSVNDPropName; - long ListCtrlIndex; + // Process the photos (PHOTO). + + LoadPictureData("PHOTO", + &ContactEditorData.PicturesList, + &ContactEditorData.PicturesListPref, + &ContactEditorData.PicturesListType, + lboPictures, + &PhotoCount); + + // Process the logos (LOGO). + + LoadPictureData("LOGO", + &ContactEditorData.LogosList, + &ContactEditorData.LogosListPref, + &ContactEditorData.LogosListType, + lboLogos, + &LogoCount); + + // Process the sounds (SOUND). + + LoadPictureData("SOUND", + &ContactEditorData.SoundsList, + &ContactEditorData.SoundsListPref, + &ContactEditorData.SoundsListType, + lboSounds, + &SoundCount); - while (wSTVendorDetails.HasMoreTokens() == TRUE){ - - wSTVendorDetails.GetNextToken(); - wxSVNDID = wSTVendorDetails.GetNextToken(); - wxSVNDPropName = wSTVendorDetails.GetNextToken(); - break; - - } - - if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){ - - // Setup the values for later processing. - - VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); - VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID)); - VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName)); - - // Add the data to the vendor variables. - - wxListItem coldata; - - coldata.SetId(intValueSeek); - coldata.SetData(intValueSeek); - coldata.SetText(wxSVNDID + wxT("-") + wxSVNDPropName); + // Process the calendar addresses (CALURI). + + LoadData("CALURI", + &ContactEditorData.CalendarList, + &ContactEditorData.CalendarListPref, + &ContactEditorData.CalendarListType, + NULL, + lboCalendarAddresses, + &CalAdrCount); + + // Process the calendar request addresses (CALADRURI). + + LoadData("CALADRURI", + &ContactEditorData.CalendarRequestList, + &ContactEditorData.CalendarRequestListPref, + &ContactEditorData.CalendarRequestListType, + NULL, + lboCalendarRequestAddress, + &CalReqAdrCount); - ListCtrlIndex = lboVendorNamespace->InsertItem(coldata); - - VendorList.erase(intValueSeek); - VendorListPEN.erase(intValueSeek); - VendorListElement.erase(intValueSeek); - - VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); - VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID)); - VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName)); - - VendorCount++; - intValueSeek++; - - } - - } else if (wxSProperty.Mid(0, 2) == wxT("X-")){ - - long ListCtrlIndex; - - XTokenList.insert(std::make_pair(intValueSeek, wxSPropertySeg2)); - XTokenListTokens.insert(std::make_pair(intValueSeek, wxSPropertySeg1.Mid(2))); - - // Add to the form. - - wxListItem coldata; - - coldata.SetId(intValueSeek); - coldata.SetData(intValueSeek); - coldata.SetText(wxSPropertySeg1.Mid(2)); + // Process the free busy addresses (FBURL). + + LoadData("FBURL", + &ContactEditorData.FreeBusyList, + &ContactEditorData.FreeBusyListPref, + &ContactEditorData.FreeBusyListType, + NULL, + lboFreeBusyAddresses, + &FreeBusyCount); + + // Process the keys. (KEY) + + LoadData("KEY", + &ContactEditorData.KeyList, + &ContactEditorData.KeyListPref, + &ContactEditorData.KeyListType, + &ContactEditorData.KeyListDataType, + lboKeys, + &KeyCount); + + // Process the vendor specific information (VND-*). + + LoadVendorData(&ContactEditorData.VendorListPEN, + &ContactEditorData.VendorListElement, + lboVendorNamespace, + &VendorCount); + + // Process the X-Tokens (X-*). - ListCtrlIndex = lboXToken->InsertItem(coldata); - - XTokenCount++; - intValueSeek++; - - - } - - // Reset the variables. + LoadXTokenData(&ContactEditorData.XTokenListTokens, + lboXToken, + &XTokenCount); + + // Process the related people (RELATED). + + LoadRelatedData(&ContactEditorData.GeneralRelatedList, + &ContactEditorData.GeneralRelatedListPref, + &ContactEditorData.GeneralRelatedListType, + lboRelated, + &RelatedCount); - QuoteMode = FALSE; - PropertyFind = TRUE; - ExtraLineSeek = TRUE; - ContactLineLen = 0; - QuoteBreakPoint = 0; - ContactLine.Clear(); - wxSProperty.Clear(); + // Process the full name (FN). - } + LoadData(&ContactEditorData.FullNamesList, + cmbDisplayAs); FMTimer.SetFilename(Filename); FMTimer.Start(10000, FALSE); @@ -641,6 +435,8 @@ void frmContactEditor::SplitValues(wxString *PropertyLine, std::map *SplitLength, int intSize){ + // Split the values. + size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; @@ -653,22 +449,22 @@ void frmContactEditor::SplitValues(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); - } else { + } else { - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); - } - - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + } - intSplitsFound++; - intSplitSeek = i; - intSplitSize = 0; + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + intSplitsFound++; + intSplitSeek = i; + intSplitSize = 0; + } } @@ -698,9 +494,12 @@ void frmContactEditor::LoadData(std::map *GeneralList, wxListCtrl *BusinessListCtrl, int *DataCount){ + // Load data into the controls (first section of data and preference + // only). + long ListCtrlIndex = -1; - // Deal with the general addresses. + // Deal with the general items. for (std::map::iterator Iter = GeneralList->begin(); Iter != GeneralList->end(); @@ -724,7 +523,7 @@ void frmContactEditor::LoadData(std::map *GeneralList, } - // Deal with the home addresses. + // Deal with the home items. for (std::map::iterator Iter = HomeList->begin(); Iter != HomeList->end(); @@ -748,7 +547,7 @@ void frmContactEditor::LoadData(std::map *GeneralList, } - // Deal with the work addresses. + // Deal with the work items. for (std::map::iterator Iter = BusinessList->begin(); Iter != BusinessList->end(); @@ -772,4 +571,1058 @@ void frmContactEditor::LoadData(std::map *GeneralList, } +} + +void frmContactEditor::LoadData(std::map *GeneralList, + std::map *GeneralListPref, + std::map *GeneralListType, + wxListCtrl *GeneralListCtrl, + std::map *HomeList, + std::map *HomeListPref, + std::map *HomeListType, + wxListCtrl *HomeListCtrl, + std::map *BusinessList, + std::map *BusinessListPref, + std::map *BusinessListType, + wxListCtrl *BusinessListCtrl, + int *DataCount){ + + // Load data into the controls (first section of data, + // type and preference). + + long ListCtrlIndex = -1; + + // Deal with the general items. + + for (std::map::iterator Iter = GeneralList->begin(); + Iter != GeneralList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = GeneralListCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, GeneralListPref)){ + + GeneralListCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", GeneralListPref->find(*DataCount)->second)); + + } + + if (MapDataExists(DataCount, GeneralListType)){ + + GeneralListCtrl->SetItem(ListCtrlIndex, 1, GeneralListType->find(*DataCount)->second); + + } + + (*DataCount)++; + + } + + // Deal with the home items. + + for (std::map::iterator Iter = HomeList->begin(); + Iter != HomeList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = HomeListCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, HomeListPref)){ + + HomeListCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", HomeListPref->find(*DataCount)->second)); + + } + + if (MapDataExists(DataCount, HomeListType)){ + + HomeListCtrl->SetItem(ListCtrlIndex, 1, HomeListType->find(*DataCount)->second); + + } + + (*DataCount)++; + + } + + // Deal with the work items. + + for (std::map::iterator Iter = BusinessList->begin(); + Iter != BusinessList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = BusinessListCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, BusinessListPref)){ + + BusinessListCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", BusinessListPref->find(*DataCount)->second)); + + } + + if (MapDataExists(DataCount, BusinessListType)){ + + BusinessListCtrl->SetItem(ListCtrlIndex, 1, BusinessListType->find(*DataCount)->second); + + } + + (*DataCount)++; + + } + +} + + +void frmContactEditor::LoadData(std::map *ItemList, + std::map *ItemListPref, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load the data (name and preference only). + + long ListCtrlIndex = -1; + + for (std::map::iterator Iter = ItemList->begin(); + Iter != ItemList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, ItemListPref)){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", ItemListPref->find(*DataCount)->second)); + + } + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadData(std::map *ItemList, + std::map *ItemListPref, + std::map *ItemListType, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load the data (name, preference and type). + + long ListCtrlIndex = -1; + + for (std::map::iterator Iter = ItemList->begin(); + Iter != ItemList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, ItemListType)){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, ItemListType->find(*DataCount)->second); + + } + + if (MapDataExists(DataCount, ItemListPref)){ + + ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second)); + + } + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadData(wxString ItemName, + std::map *ItemList, + std::map *ItemListPref, + std::map *ItemListType, + std::map *ItemListDataType, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load data (name, preference, type and data type). + + long ListCtrlIndex = -1; + + for (std::map::iterator Iter = ItemList->begin(); + Iter != ItemList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + coldata.SetText(Iter->second); + + if (ItemName == "KEY"){ + + // Get the key type, if any. + + if (MapDataExists(DataCount, ItemListDataType)){ + + if (ItemListDataType->find(*DataCount)->second == "application/pgp-keys"){ + + coldata.SetText(_("PGP Key")); + + } + + } else { + + coldata.SetText(_("Key")); + + } + + + } + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, ItemListType)){ + + if (ItemListType->find(*DataCount)->second == "home"){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, _("Home")); + + } else if (ItemListType->find(*DataCount)->second == "work"){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, _("Work")); + + } + + } + + if (MapDataExists(DataCount, ItemListPref)){ + + ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second)); + + } + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadPictureData(wxString ItemName, + std::map *ItemList, + std::map *ItemListPref, + std::map *ItemListType, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load the picture data. + + long ListCtrlIndex = -1; + + for (std::map::iterator Iter = ItemList->begin(); + Iter != ItemList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + + if (ItemName == "PHOTO"){ + + coldata.SetText("Picture"); + + } else if (ItemName == "LOGO"){ + + coldata.SetText("Logo"); + + } else if (ItemName == "SOUND"){ + + coldata.SetText("Sound"); + + } else { + + coldata.SetText("Object"); + + } + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, ItemListType)){ + + if (ItemListType->find(*DataCount)->second == "home"){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, _("Home")); + + } else if (ItemListType->find(*DataCount)->second == "work"){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, _("Work")); + + } + + } + + if (MapDataExists(DataCount, ItemListPref)){ + + ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second)); + + } + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadVendorData(std::map *ItemListPEN, + std::map *ItemListElement, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load the vendor data. + + long ListCtrlIndex = -1; + wxString ItemValue; + + for (std::map::iterator Iter = ItemListPEN->begin(); + Iter != ItemListPEN->end(); + Iter++){ + + ItemValue.clear(); + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + + ItemValue.Append(ItemListPEN->find(*DataCount)->second); + ItemValue.Append("-"); + ItemValue.Append(ItemListElement->find(*DataCount)->second); + + coldata.SetText(ItemValue); + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadXTokenData(std::map *ItemListTokens, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load the X-Token data. + + long ListCtrlIndex = -1; + wxString ItemValue; + + for (std::map::iterator Iter = ItemListTokens->begin(); + Iter != ItemListTokens->end(); + Iter++){ + + ItemValue.clear(); + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + + ItemValue.Append(ItemListTokens->find(*DataCount)->second); + + coldata.SetText(ItemValue); + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadData(std::map *ItemList, + wxComboBox *ItemCtrl){ + + // Load data into a wxComboBox. + + int ItemIndex = 0; + + if (MapDataExists(&ItemIndex, ItemList)){ + + cmbDisplayAs->SetValue(ItemList->find(0)->second); + + } + +} + +void frmContactEditor::LoadRelatedData(std::map *ItemList, + std::map *ItemListPref, + std::map *ItemListType, + wxListCtrl *ItemCtrl, + int *DataCount){ + + // Load related data (name, preference and type). + + long ListCtrlIndex = -1; + wxString RelatedType; + + for (std::map::iterator Iter = ItemList->begin(); + Iter != ItemList->end(); + Iter++){ + + RelatedType.clear(); + + wxListItem coldata; + + coldata.SetId(*DataCount); + coldata.SetData(*DataCount); + + if (MapDataExists(DataCount, ItemListType)){ + + std::map::iterator TypeIter = ItemListType->find(*DataCount); + + if (TypeIter->second == wxT("contact")){ + + RelatedType = _("Contact"); + + } else if (TypeIter->second == wxT("acquaintance")){ + + RelatedType = _("Acquaintance"); + + } else if (TypeIter->second == wxT("friend")){ + + RelatedType = _("Friend"); + + } else if (TypeIter->second == wxT("met")){ + + RelatedType = _("Met"); + + } else if (TypeIter->second == wxT("co-worker")){ + + RelatedType = _("Co-worker"); + + } else if (TypeIter->second == wxT("colleague")){ + + RelatedType = _("Colleague"); + + } else if (TypeIter->second == wxT("co-resident")){ + + RelatedType = _("Co-resident"); + + } else if (TypeIter->second == wxT("neighbor")){ + + RelatedType = _("Neighbour"); + + } else if (TypeIter->second == wxT("child")){ + + RelatedType = _("Child"); + + } else if (TypeIter->second == wxT("parent")){ + + RelatedType = _("Parent"); + + } else if (TypeIter->second == wxT("sibling")){ + + RelatedType = _("Sibling"); + + } else if (TypeIter->second == wxT("spouse")){ + + RelatedType = _("Spouse"); + + } else if (TypeIter->second == wxT("kin")){ + + RelatedType = _("Kin"); + + } else if (TypeIter->second == wxT("muse")){ + + RelatedType = _("Muse"); + + } else if (TypeIter->second == wxT("crush")){ + + RelatedType = _("Crush"); + + } else if (TypeIter->second == wxT("date")){ + + RelatedType = _("Date"); + + } else if (TypeIter->second == wxT("sweetheart")){ + + RelatedType = _("Sweetheart"); + + } else if (TypeIter->second == wxT("me")){ + + RelatedType = _("Me"); + + } else if (TypeIter->second == wxT("agent")){ + + RelatedType = _("Agent"); + + } else if (TypeIter->second == wxT("emergency")){ + + RelatedType = _("Emergency"); + + } else { + + RelatedType = TypeIter->second; + + } + + } + + coldata.SetText(RelatedType); + + ListCtrlIndex = ItemCtrl->InsertItem(coldata); + + if (MapDataExists(DataCount, ItemList)){ + + ItemCtrl->SetItem(ListCtrlIndex, 1, ItemList->find(*DataCount)->second); + + } + + if (MapDataExists(DataCount, ItemListPref)){ + + ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second)); + + } + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadKind(ContactKindType *KindType){ + + // Load contact kind. + + switch (*KindType){ + case CONTACTKIND_INDIVIDUAL: + cmbType->SetSelection(1); + break; + case CONTACTKIND_GROUP: + cmbType->SetSelection(2); + break; + case CONTACTKIND_ORGANISATION: + cmbType->SetSelection(3); + break; + case CONTACTKIND_LOCATION: + cmbType->SetSelection(4); + break; + case CONTACTKIND_NONE: + cmbType->SetSelection(0); + break; + } + + wxCommandEvent nullevent; + + UpdateMembersTab(nullevent); + +} + +void frmContactEditor::LoadBirthday(wxString *BirthdayData, bool *BirthdayText){ + + // Load Birthday. + + if (BirthdayData->IsEmpty()){ + return; + } + + if (*BirthdayText == FALSE){ + + int DateYear = 0; + wxDateTime::Month DateMonth; + unsigned int DateDay; + + wxString wxSData; + + if (BirthdayData->Mid(0, 2) == wxT("--")){ + + // Skip year. + + } else { + + DateYear = wxAtoi(BirthdayData->Mid(0,4)); + + } + + DateMonth = (wxDateTime::Month)(wxAtoi(BirthdayData->Mid(4,2)) - 1); + DateDay = wxAtoi(BirthdayData->Mid(6,2)); + + wxDateTime BDayDate(DateDay,DateMonth,DateYear); + + dapBirthday->SetValue(BDayDate); + + } else { + + txtBirthday->SetValue(*BirthdayData); + + } + +} + +void frmContactEditor::LoadAnniversary(wxString *AnniversaryData, bool *AnniversaryText){ + + // Load Anniversary. + + if (AnniversaryData->IsEmpty()){ + return; + } + + if (*AnniversaryText == FALSE){ + + int DateYear = 0; + wxDateTime::Month DateMonth; + int DateDay; + + wxString wxSData; + + if (AnniversaryData->Mid(0, 2) == wxT("--")){ + + // Skip year. + + } else { + + DateYear = wxAtoi(AnniversaryData->Mid(0,4)); + + } + + DateMonth = (wxDateTime::Month)(wxAtoi(AnniversaryData->Mid(4,2)) - 1); + DateDay = wxAtoi(AnniversaryData->Mid(6,2)); + + wxDateTime ADayDate(DateDay,DateMonth,DateYear); + + dapAnniversary->SetValue(ADayDate); + + } else { + + txtAnniversary->SetValue(*AnniversaryData); + + } + +} + +void frmContactEditor::LoadGender(wxString *GenderComponent, wxString *GenderIdentity){ + + // Load Gender. + + // Deal with the Gender Component. + + if (*GenderComponent == wxT("M")){ + + // Gender is Male. + + cmbGender->SetSelection(1); + + } else if (*GenderComponent == wxT("F")){ + + // Gender is Female. + + cmbGender->SetSelection(2); + + } else if (*GenderComponent == wxT("O")){ + + // Gender is Other. + + cmbGender->SetSelection(3); + + } else if (*GenderComponent == wxT("N")){ + + // Gender is None/Not Applicable. + + cmbGender->SetSelection(4); + + } else if (*GenderComponent == wxT("U")){ + + // Gender is Unknown. + + cmbGender->SetSelection(5); + + } + + // Deal with the Gender Identity. + + txtGenderDescription->SetValue(*GenderIdentity); + +} + +void frmContactEditor::LoadName(wxString *NameTitle, wxString *NameForename, + wxString *NameSurname, wxString *NameOtherNames, + wxString *NameSuffix){ + + // Load Name. + + txtTitle->SetValue(*NameTitle); + txtForename->SetValue(*NameForename); + txtSurname->SetValue(*NameSurname); + txtOtherNames->SetValue(*NameOtherNames); + txtSuffix->SetValue(*NameSuffix); + +} + +void frmContactEditor::LoadMember(std::map *GroupList){ + + // Load group data. + + // Go through the list of contacts for the account and find the matching UID. + // If contact with UID doesn't match then say (unknown contact). + + XABViewMode XVMData; + if (StartupEditMode == FALSE){ + XVMData = MainPtr->GetViewMode(); + } + + wxString AccountDirFinal = GetAccountDir(wxSContactAccount, FALSE); + + wxString vCardFilename; + wxString vCardFilenameFull; + wxString vCardDataString; + wxString lwxs; + wxString setname, setvalue; + wxString MemberData; + bool FoundContact = FALSE; + std::multimap> vCardNamesAsc; + std::multimap> vCardNamesDsc; + + wxDir vcardaccdir(AccountDirFinal); + + for (std::map::iterator MemberIter = GroupList->begin(); + MemberIter != GroupList->end(); + MemberIter++){ + + MemberData = MemberIter->second; + + bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES); + while(ProcFiles){ + + if (vCardFilename.Right(4) == wxT(".vcf") || + vCardFilename.Right(4) == wxT(".VCF") || + vCardFilename.Right(5) == wxT(".vcard") || + vCardFilename.Right(5) == wxT(".VCARD")){ + + vCard Person; + + vCardFilenameFull.Append(AccountDirFinal); + vCardFilenameFull.Append(wxT("/")); + vCardFilenameFull.Append(vCardFilename); + + Person.LoadFile(vCardFilenameFull); + + if (MemberData.Left(9) == wxT("urn:uuid:")){ + + wxString NewPropValue; + NewPropValue = MemberData.Mid(9, wxString::npos); + MemberData = NewPropValue; + + } + + if (Person.MeetBaseSpecification()){ + + wxString KindStatus = Person.Get(wxT("KIND")); + + if (KindStatus == wxT("group")){ + + vCardFilename.Clear(); + vCardFilenameFull.Clear(); + vCardDataString.Clear(); + ProcFiles = vcardaccdir.GetNext(&vCardFilename); + continue; + + } + + wxString PersonName = Person.Get(wxT("N")); + wxString PersonUID = Person.Get(wxT("UID")); + wxString PersonFilename = vCardFilenameFull; + + if (PersonUID != MemberData){ + + vCardFilename.Clear(); + vCardFilenameFull.Clear(); + vCardDataString.Clear(); + ProcFiles = vcardaccdir.GetNext(&vCardFilename); + continue; + + } else { + + FoundContact = TRUE; + + } + + //ContactsNames.insert(std::make_pair(PersonName, ContactIndex)); + //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID)); + + if (XVMData.SortMode == 1){ + + // Split the name into sections. + + vCardDataString = Person.Get(wxT("N")); + + vCardName NameData = Person.GetName(); + + vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname; + + } else if (XVMData.SortMode == 2){ + + // Split the name into sections. + + vCardName NameData = Person.GetName(); + + vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename; + + } else if (XVMData.SortMode == 3){ + + // Check and make sure that the top most nickname is used. + + vCardDataString = Person.Get(wxT("NICKNAME")); + + if (vCardDataString.IsEmpty()){ + + vCardDataString = wxT("(no nickname)"); + + } + + } else if (XVMData.SortMode == 4){ + + vCardDataString = Person.Get(wxT("FN")); + + } + + if (XVMData.AscendingMode == TRUE){ + + vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID)); + + } else { + + vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID)); + + } + + } else { + + } + + } + + vCardFilename.Clear(); + vCardFilenameFull.Clear(); + vCardDataString.Clear(); + ProcFiles = vcardaccdir.GetNext(&vCardFilename); + + } + + if (FoundContact == FALSE){ + + if (XVMData.AscendingMode == TRUE){ + + vCardNamesAsc.insert(std::make_pair(MemberIter->second, MemberIter->second)); + + } else { + + vCardNamesDsc.insert(std::make_pair(MemberIter->second, MemberIter->second)); + + } + + } + + if (XVMData.AscendingMode == TRUE){ + + for (std::map::iterator iter = vCardNamesAsc.begin(); + iter != vCardNamesAsc.end(); ++iter){ + + wxListItem ItemData; + + ItemData.SetId(0); + ItemData.SetText(iter->first); + lboGroups->InsertItem(ItemData); + + } + + } else { + + for (std::map::iterator iter = vCardNamesDsc.begin(); + iter != vCardNamesDsc.end(); ++iter){ + + wxListItem ItemData; + + ItemData.SetId(0); + ItemData.SetText(iter->first); + + lboGroups->InsertItem(ItemData); + + } + + } + + } + +} + +void frmContactEditor::LoadAddress(std::map *GeneralAddressList, + std::map *GeneralAddressListTown, + std::map *GeneralAddressListCounty, + std::map *GeneralAddressListPostCode, + std::map *GeneralAddressListPref, + std::map *HomeAddressList, + std::map *HomeAddressListTown, + std::map *HomeAddressListCounty, + std::map *HomeAddressListPostCode, + std::map *HomeAddressListPref, + std::map *BusinessAddressList, + std::map *BusinessAddressListTown, + std::map *BusinessAddressListCounty, + std::map *BusinessAddressListPostCode, + std::map *BusinessAddressListPref, + int *AddressCount){ + + // Load address. + + long ListCtrlIndex = -1; + + // Deal with the general addresses. + + for (std::map::iterator Iter = GeneralAddressList->begin(); + Iter != GeneralAddressList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*AddressCount); + coldata.SetData(*AddressCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = lboAddresses->InsertItem(coldata); + + if (MapDataExists(AddressCount, GeneralAddressListTown)){ + + lboAddresses->SetItem(ListCtrlIndex, 1, GeneralAddressListTown->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, GeneralAddressListCounty)){ + + lboAddresses->SetItem(ListCtrlIndex, 2, GeneralAddressListCounty->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, GeneralAddressListPostCode)){ + + lboAddresses->SetItem(ListCtrlIndex, 3, GeneralAddressListPostCode->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, GeneralAddressListPref)){ + + lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", GeneralAddressListPref->find(*AddressCount)->second)); + + } + + (*AddressCount)++; + + } + + // Deal with the home addresses. + + for (std::map::iterator Iter = HomeAddressList->begin(); + Iter != HomeAddressList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*AddressCount); + coldata.SetData(*AddressCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = lboHomeAddresses->InsertItem(coldata); + + if (MapDataExists(AddressCount, HomeAddressListTown)){ + + lboHomeAddresses->SetItem(ListCtrlIndex, 1, HomeAddressListTown->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, HomeAddressListCounty)){ + + lboHomeAddresses->SetItem(ListCtrlIndex, 2, HomeAddressListCounty->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, HomeAddressListPostCode)){ + + lboHomeAddresses->SetItem(ListCtrlIndex, 3, HomeAddressListPostCode->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, HomeAddressListPref)){ + + lboHomeAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", HomeAddressListPref->find(*AddressCount)->second)); + + } + + (*AddressCount)++; + + } + + // Deal with the work addresses. + + for (std::map::iterator Iter = BusinessAddressList->begin(); + Iter != BusinessAddressList->end(); + Iter++){ + + wxListItem coldata; + + coldata.SetId(*AddressCount); + coldata.SetData(*AddressCount); + coldata.SetText(Iter->second); + + ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata); + + if (MapDataExists(AddressCount, BusinessAddressListTown)){ + + lboBusinessAddresses->SetItem(ListCtrlIndex, 1, BusinessAddressListTown->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, BusinessAddressListCounty)){ + + lboBusinessAddresses->SetItem(ListCtrlIndex, 2, BusinessAddressListCounty->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, BusinessAddressListPostCode)){ + + lboBusinessAddresses->SetItem(ListCtrlIndex, 3, BusinessAddressListPostCode->find(*AddressCount)->second); + + } + + if (MapDataExists(AddressCount, BusinessAddressListPref)){ + + lboBusinessAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", BusinessAddressListPref->find(*AddressCount)->second)); + + } + + (*AddressCount)++; + + } + } \ No newline at end of file