From 2b6a6878b89192f2d951511d6936d564fd8baf46 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 30 Dec 2015 01:27:51 +0000 Subject: [PATCH] Implemented CATEGORIES with ContactDataObject. --- .../contacteditor/frmContactEditor-Load.cpp | 48 ++++++++++++++++--- source/contacteditor/frmContactEditor.h | 5 ++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index 02262fe..d6f47ea 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -315,7 +315,12 @@ bool frmContactEditor::LoadContact(wxString Filename){ lboBusinessNotes, &NoteCount); - // Process the + // Process the categories (CATEGORIES). + + LoadData(&ContactEditorData.CategoriesList, + &ContactEditorData.CategoriesListPref, + lboCategories, + &CategoryCount); for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ @@ -544,13 +549,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadNote(wxSPropertySeg1, wxSPropertySeg2, &NoteCount); - }*/ else if (wxSProperty == wxT("CATEGORIES")) { + } else if (wxSProperty == wxT("CATEGORIES")) { // See frmContactEditor-LoadCategory.cpp LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount); - } else if (wxSProperty == wxT("PHOTO")) { + }*/ else if (wxSProperty == wxT("PHOTO")) { // See frmContactEditor-LoadPhoto.cpp @@ -754,7 +759,7 @@ void frmContactEditor::LoadData(std::map *GeneralList, long ListCtrlIndex = -1; - // Deal with the general addresses. + // Deal with the general items. for (std::map::iterator Iter = GeneralList->begin(); Iter != GeneralList->end(); @@ -778,7 +783,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(); @@ -802,7 +807,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(); @@ -826,4 +831,35 @@ void frmContactEditor::LoadData(std::map *GeneralList, } +} + +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 diff --git a/source/contacteditor/frmContactEditor.h b/source/contacteditor/frmContactEditor.h index a0cf860..34d4cf3 100644 --- a/source/contacteditor/frmContactEditor.h +++ b/source/contacteditor/frmContactEditor.h @@ -649,6 +649,11 @@ class frmContactEditor : public frmContactEditorADT std::map *BusinessTZPref, wxListCtrl *BusinessListCtrl, int *DataCount); + + void LoadData(std::map *ItemList, + std::map *ItemListPref, + wxListCtrl *ItemCtrl, + int *DataCount); void LoadGender(wxString *GenderComponent, wxString *GenderIdentity); void LoadBirthday(wxString *BirthdayData, bool *BirthdayText); -- 2.39.5