Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Implemented LoadData for even better simplification.
[xestiaab/.git] / source / contacteditor / frmContactEditor-Load.cpp
index 56e4b9f..a48d0a3 100644 (file)
@@ -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,6 +185,45 @@ bool frmContactEditor::LoadContact(wxString Filename){
                &ContactEditorData.BusinessAddressListPref,
                &ADRCount);
 
+       // Process the timezones (TZ) (frmContactEditor-LoadTimeZone.cpp)
+       
+       LoadData(&ContactEditorData.GeneralTZList,
+               &ContactEditorData.GeneralTZListPref,
+               lboTimezones,
+               &ContactEditorData.HomeTZList,
+               &ContactEditorData.HomeTZListPref,
+               lboHomeTimezones,
+               &ContactEditorData.BusinessTZList,
+               &ContactEditorData.BusinessTZListPref,
+               lboBusinessTimezones,
+               &TZCount);
+               
+       // Process the emails (EMAIL) (frmContactEditor-LoadEmail.cpp)
+       
+       LoadData(&ContactEditorData.GeneralEmailList,
+               &ContactEditorData.GeneralEmailListPref,
+               lboEmails,
+               &ContactEditorData.HomeEmailList,
+               &ContactEditorData.HomeEmailListPref,
+               lboHomeEmails,
+               &ContactEditorData.BusinessEmailList,
+               &ContactEditorData.BusinessEmailListPref,
+               lboBusinessEmail,
+               &EmailCount);
+
+       // Process the nicknames (NICKNAME) (frmContactEditor-LoadNickname.cpp)
+       
+       LoadData(&ContactEditorData.GeneralNicknamesList,
+               &ContactEditorData.GeneralNicknamesListPref,
+               lboNicknames,
+               &ContactEditorData.HomeNicknamesList,
+               &ContactEditorData.HomeNicknamesListPref,
+               lboHomeNicknames,
+               &ContactEditorData.BusinessNicknamesList,
+               &ContactEditorData.BusinessNicknamesListPref,
+               lboBusinessNicknames,
+               &NicknameCount);
+
        for (std::map<int,wxString>::iterator iter = ContactFileLines.begin(); 
         iter != ContactFileLines.end(); ++iter){
        
@@ -310,13 +349,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
                
@@ -334,25 +373,25 @@ 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
                
                        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
                
@@ -607,4 +646,91 @@ void frmContactEditor::SplitValues(wxString *PropertyLine,
 
        }
 
+}
+
+void frmContactEditor::LoadData(std::map<int, wxString> *GeneralList,
+               std::map<int, int> *GeneralListPref,
+               wxListCtrl *GeneralListCtrl,
+               std::map<int, wxString> *HomeList,
+               std::map<int, int> *HomeListPref,
+               wxListCtrl *HomeListCtrl,
+               std::map<int, wxString> *BusinessList,
+               std::map<int, int> *BusinessListPref,
+               wxListCtrl *BusinessListCtrl,
+               int *DataCount){
+
+       long ListCtrlIndex = -1;
+
+       // Deal with the general addresses.
+       
+       for (std::map<int,wxString>::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 addresses.
+       
+       for (std::map<int,wxString>::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 addresses.
+       
+       for (std::map<int,wxString>::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)++;
+       
+       }
+
 }
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy