X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Load.cpp;h=d6f47ea5e803af9dec07139465c5b63ed53c57fa;hb=2b6a6878b89192f2d951511d6936d564fd8baf46;hp=aa5b0e9d845df99ea4c13a6cf4896ef566726efb;hpb=01a3141be71e31f6eabd97d65cb630ddeaa1a5c9;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index aa5b0e9..d6f47ea 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -185,25 +185,142 @@ bool frmContactEditor::LoadContact(wxString Filename){ &ContactEditorData.BusinessAddressListPref, &ADRCount); - // Process the timezones (TZ) (frmContactEditor-LoadTimeZone.cpp) + // Process the timezones (TZ). - LoadTimeZone(&ContactEditorData.GeneralTZList, + LoadData(&ContactEditorData.GeneralTZList, &ContactEditorData.GeneralTZListPref, + lboTimezones, &ContactEditorData.HomeTZList, &ContactEditorData.HomeTZListPref, + lboHomeTimezones, &ContactEditorData.BusinessTZList, &ContactEditorData.BusinessTZListPref, + lboBusinessTimezones, &TZCount); - // Process the emails (frmContactEditor-LoadEmail.cpp) + // Process the emails (EMAIL). - LoadEmail(&ContactEditorData.GeneralEmailList, + LoadData(&ContactEditorData.GeneralEmailList, &ContactEditorData.GeneralEmailListPref, + lboEmails, &ContactEditorData.HomeEmailList, &ContactEditorData.HomeEmailListPref, + lboHomeEmails, &ContactEditorData.BusinessEmailList, &ContactEditorData.BusinessEmailListPref, - &EmailCount); + 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){ @@ -330,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 @@ -384,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 @@ -396,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 @@ -438,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 @@ -627,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