X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Load.cpp;h=d6f47ea5e803af9dec07139465c5b63ed53c57fa;hb=2b6a6878b89192f2d951511d6936d564fd8baf46;hp=4049a225fba42284358ebb7140e351cae3988e89;hpb=10578374729faf0e812c1953dee1b539a48ce091;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index 4049a22..d6f47ea 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -161,6 +161,166 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadName(&ContactEditorData.NameTitle, &ContactEditorData.NameForename, &ContactEditorData.NameSurname, &ContactEditorData.NameOtherNames, &ContactEditorData.NameSuffix); + + // Process the group members (MEMBER) (frmContactEditor-LoadGroup.cpp) + + LoadMember(&ContactEditorData.GroupsList); + + // Process the addresses (ADR) (frmContactEditor-LoadAddress.cpp) + + LoadAddress(&ContactEditorData.GeneralAddressList, + &ContactEditorData.GeneralAddressListTown, + &ContactEditorData.GeneralAddressListCounty, + &ContactEditorData.GeneralAddressListPostCode, + &ContactEditorData.GeneralAddressListPref, + &ContactEditorData.HomeAddressList, + &ContactEditorData.HomeAddressListTown, + &ContactEditorData.HomeAddressListCounty, + &ContactEditorData.HomeAddressListPostCode, + &ContactEditorData.HomeAddressListPref, + &ContactEditorData.BusinessAddressList, + &ContactEditorData.BusinessAddressListTown, + &ContactEditorData.BusinessAddressListCounty, + &ContactEditorData.BusinessAddressListPostCode, + &ContactEditorData.BusinessAddressListPref, + &ADRCount); + + // Process the timezones (TZ). + + LoadData(&ContactEditorData.GeneralTZList, + &ContactEditorData.GeneralTZListPref, + lboTimezones, + &ContactEditorData.HomeTZList, + &ContactEditorData.HomeTZListPref, + lboHomeTimezones, + &ContactEditorData.BusinessTZList, + &ContactEditorData.BusinessTZListPref, + lboBusinessTimezones, + &TZCount); + + // Process the emails (EMAIL). + + LoadData(&ContactEditorData.GeneralEmailList, + &ContactEditorData.GeneralEmailListPref, + lboEmails, + &ContactEditorData.HomeEmailList, + &ContactEditorData.HomeEmailListPref, + lboHomeEmails, + &ContactEditorData.BusinessEmailList, + &ContactEditorData.BusinessEmailListPref, + lboBusinessEmail, + &EmailCount); + + // Process the nicknames (NICKNAME). + + LoadData(&ContactEditorData.GeneralNicknamesList, + &ContactEditorData.GeneralNicknamesListPref, + lboNicknames, + &ContactEditorData.HomeNicknamesList, + &ContactEditorData.HomeNicknamesListPref, + lboHomeNicknames, + &ContactEditorData.BusinessNicknamesList, + &ContactEditorData.BusinessNicknamesListPref, + lboBusinessNicknames, + &NicknameCount); + + // Process the languages (LANG). + + LoadData(&ContactEditorData.GeneralLanguageList, + &ContactEditorData.GeneralLanguageListPref, + lboLanguages, + &ContactEditorData.HomeLanguageList, + &ContactEditorData.HomeLanguageListPref, + lboHomeLanguages, + &ContactEditorData.BusinessLanguageList, + &ContactEditorData.BusinessLanguageListPref, + lboBusinessLanguages, + &LangCount); + + // Process the geopositiosn (GEO). + + LoadData(&ContactEditorData.GeneralGeographyList, + &ContactEditorData.GeneralGeographyListPref, + lboGeoposition, + &ContactEditorData.HomeGeographyList, + &ContactEditorData.HomeGeographyListPref, + lboHomeGeoposition, + &ContactEditorData.BusinessGeographyList, + &ContactEditorData.BusinessGeographyListPref, + lboBusinessGeoposition, + &GeoCount); + + // Process the websites (URL). + + LoadData(&ContactEditorData.GeneralWebsiteList, + &ContactEditorData.GeneralWebsiteListPref, + lboWebsites, + &ContactEditorData.HomeWebsiteList, + &ContactEditorData.HomeWebsiteListPref, + lboHomeWebsites, + &ContactEditorData.BusinessWebsiteList, + &ContactEditorData.BusinessWebsiteListPref, + lboBusinessWebsites, + &URLCount); + + // Process the titles (TITLE). + + 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); + + // 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). + + LoadData(&ContactEditorData.CategoriesList, + &ContactEditorData.CategoriesListPref, + lboCategories, + &CategoryCount); for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ @@ -269,13 +429,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadKind(wxSPropertySeg2); - }*/ else if (wxSProperty == wxT("MEMBER")){ + }/* else if (wxSProperty == wxT("MEMBER")){ // See frmContactEditor-LoadGroup.cpp LoadMember(wxSPropertySeg2, &GroupCount); - } else if (wxSProperty == wxT("FN")){ + }*/ else if (wxSProperty == wxT("FN")){ // See frmContactEditor-LoadName.cpp @@ -287,13 +447,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadN(wxSPropertySeg1, wxSPropertySeg2, &NameProcessed, &ContactData); - }*/ else if (wxSProperty == wxT("NICKNAME")){ + } else if (wxSProperty == wxT("NICKNAME")){ // See frmContactEditor-LoadNickname.cpp LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData); - }/* else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ + } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ // See frmContactEditor-LoadGender.cpp @@ -311,13 +471,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed); - }*/ else if (wxSProperty == wxT("TZ")){ + } else if (wxSProperty == wxT("TZ")){ // See frmContactEditor-LoadTimeZone.cpp LoadTimeZone(wxSPropertySeg1, wxSPropertySeg2, &TZCount); - } else if (wxSProperty == wxT("ADR")){ + } else if (wxSProperty == wxT("ADR")){ // See frmContactEditor-LoadAddress.cpp @@ -329,7 +489,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadEmail(wxSPropertySeg1, wxSPropertySeg2, &EmailCount); - } else if (wxSProperty == wxT("IMPP")){ + }*/ else if (wxSProperty == wxT("IMPP")){ // See frmContactEditor-LoadIM.cpp @@ -341,7 +501,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadTelephone(wxSPropertySeg1, wxSPropertySeg2, &TelCount); - } else if (wxSProperty == wxT("LANG")){ + }/* else if (wxSProperty == wxT("LANG")){ // See frmContactEditor-LoadLanguage.cpp @@ -353,13 +513,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadGeo(wxSPropertySeg1, wxSPropertySeg2, &GeoCount); - } else if (wxSProperty == wxT("RELATED")){ + }*/ else if (wxSProperty == wxT("RELATED")){ // See fromContactEditor-LoadRelated.cpp LoadRelated(wxSPropertySeg1, wxSPropertySeg2, &RelatedCount); - } else if (wxSProperty == wxT("URL")){ + }/* else if (wxSProperty == wxT("URL")){ // See frmContactEditor-LoadURL.cpp @@ -395,7 +555,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount); - } else if (wxSProperty == wxT("PHOTO")) { + }*/ else if (wxSProperty == wxT("PHOTO")) { // See frmContactEditor-LoadPhoto.cpp @@ -584,4 +744,122 @@ void frmContactEditor::SplitValues(wxString *PropertyLine, } +} + +void frmContactEditor::LoadData(std::map *GeneralList, + std::map *GeneralListPref, + wxListCtrl *GeneralListCtrl, + std::map *HomeList, + std::map *HomeListPref, + wxListCtrl *HomeListCtrl, + std::map *BusinessList, + std::map *BusinessListPref, + wxListCtrl *BusinessListCtrl, + int *DataCount){ + + 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, 1, wxString::Format("%i", GeneralListPref->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, 1, wxString::Format("%i", HomeListPref->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, 1, wxString::Format("%i", BusinessListPref->find(*DataCount)->second)); + + } + + (*DataCount)++; + + } + +} + +void frmContactEditor::LoadData(std::map *ItemList, + std::map *ItemListPref, + wxListCtrl *ItemCtrl, + int *DataCount){ + + 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)++; + + } + } \ No newline at end of file