Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Implemented all remaining elements to use ContactDataObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 1 Jan 2016 13:30:33 +0000 (13:30 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 1 Jan 2016 13:30:33 +0000 (13:30 +0000)
source/contacteditor/frmContactEditor-Load.cpp
source/contacteditor/frmContactEditor-LoadAddress.cpp
source/contacteditor/frmContactEditor-Logo.cpp
source/contacteditor/frmContactEditor-Picture.cpp
source/contacteditor/frmContactEditor-Sound.cpp
source/contacteditor/frmContactEditor.h

index d6f47ea..995bb15 100644 (file)
@@ -49,7 +49,7 @@ bool frmContactEditor::LoadContact(wxString 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
@@ -65,7 +65,7 @@ bool frmContactEditor::LoadContact(wxString Filename){
        ContactEditorData.LoadFile(Filename);
        
        ContactFile.ReadAll(&wxSContactString, wxConvAuto());
-       
+
        // Split the lines.
        
        std::map<int, wxString> ContactFileLines;
@@ -82,7 +82,41 @@ bool frmContactEditor::LoadContact(wxString Filename){
                ContactLineSeek++;              
        
        }
+*/     
+
+       ContactLoadStatus LoadResult = ContactEditorData.LoadFile(Filename);
 
+       switch(LoadResult){
+       
+               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;
+       
+       };
+       
        // Get the line.
 
        bool QuoteMode = FALSE;
@@ -321,8 +355,133 @@ bool frmContactEditor::LoadContact(wxString Filename){
                &ContactEditorData.CategoriesListPref,
                lboCategories,
                &CategoryCount);
+               
+       // 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);
+
+       // Process the instant messaging (IMPP).
+       
+       LoadData(&ContactEditorData.GeneralIMList,
+               &ContactEditorData.GeneralIMListPref,
+               &ContactEditorData.GeneralIMListTypeInfo,
+               lboIM,
+               &ContactEditorData.HomeIMList,
+               &ContactEditorData.HomeIMListPref,
+               &ContactEditorData.HomeIMListTypeInfo,
+               lboHomeIM,
+               &ContactEditorData.BusinessIMList,
+               &ContactEditorData.BusinessIMListPref,
+               &ContactEditorData.BusinessIMListTypeInfo,
+               lboBusinessIM,
+               &IMPPCount);
+
+       // 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);
+
+       // 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);
+
+       // 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-*).
+
+       LoadXTokenData(&ContactEditorData.XTokenListTokens,
+               lboXToken,
+               &XTokenCount);
+       
+       // Process the related people (RELATED).
+       
+       LoadRelatedData(&ContactEditorData.GeneralRelatedList,
+               &ContactEditorData.GeneralRelatedListPref,
+               &ContactEditorData.GeneralRelatedListType,
+               lboRelated,
+               &RelatedCount);
+               
+       // Process the full name (FN).
+       
+       LoadData(&ContactEditorData.FullNamesList,
+               cmbDisplayAs);
 
-       for (std::map<int,wxString>::iterator iter = ContactFileLines.begin(); 
+       /*for (std::map<int,wxString>::iterator iter = ContactFileLines.begin(); 
         iter != ContactFileLines.end(); ++iter){
        
                // Find the colon which splits the start bit from the data part.
@@ -435,13 +594,13 @@ bool frmContactEditor::LoadContact(wxString Filename){
 
                        LoadMember(wxSPropertySeg2, &GroupCount);               
                
-               }*/ else if (wxSProperty == wxT("FN")){
+               } else if (wxSProperty == wxT("FN")){
                
                        // See frmContactEditor-LoadName.cpp
                
                        LoadFN(wxSPropertySeg1, wxSPropertySeg2, &FNCount, &FNProcessed, &ContactData);
                
-               }/* else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
+               } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
                
                        // See frmContactEditor-LoadName.cpp
                
@@ -489,19 +648,19 @@ bool frmContactEditor::LoadContact(wxString Filename){
                        
                        LoadEmail(wxSPropertySeg1, wxSPropertySeg2, &EmailCount);       
                
-               }*/ else if (wxSProperty == wxT("IMPP")){
+               } else if (wxSProperty == wxT("IMPP")){
                
                        // See frmContactEditor-LoadIM.cpp
                
                        LoadIM(wxSPropertySeg1, wxSPropertySeg2, &IMPPCount);
                
-               } else if (wxSProperty == wxT("TEL")){
+               }/* else if (wxSProperty == wxT("TEL")){
                
                        // See frmContactEditor-LoadTelephone.cpp
                
                        LoadTelephone(wxSPropertySeg1, wxSPropertySeg2, &TelCount);
                
-               }/* else if (wxSProperty == wxT("LANG")){
+               } else if (wxSProperty == wxT("LANG")){
                
                        // See frmContactEditor-LoadLanguage.cpp
                        
@@ -513,13 +672,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
                
@@ -555,7 +714,7 @@ bool frmContactEditor::LoadContact(wxString Filename){
                
                        LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount); 
                        
-               }*/ else if (wxSProperty == wxT("PHOTO")) {
+               } else if (wxSProperty == wxT("PHOTO")) {
                
                        // See frmContactEditor-LoadPhoto.cpp
                        
@@ -597,12 +756,12 @@ bool frmContactEditor::LoadContact(wxString Filename){
                        
                        LoadKey(wxSPropertySeg1, wxSPropertySeg2, &KeyCount);
                
-               }/* else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){
+               } else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){
                
                        UIDToken = wxSPropertySeg2;
                        UIDProcessed = TRUE;
                
-               }*/ else if (wxSProperty.Mid(0, 3) == wxT("VND")){
+               } else if (wxSProperty.Mid(0, 3) == wxT("VND")){
                
                        // Split the Vendor three ways.
                        
@@ -685,7 +844,7 @@ bool frmContactEditor::LoadContact(wxString Filename){
                ContactLine.Clear();
                wxSProperty.Clear();    
        
-       }
+       }*/
        
        FMTimer.SetFilename(Filename);
        FMTimer.Start(10000, FALSE);
@@ -833,6 +992,115 @@ void frmContactEditor::LoadData(std::map<int, wxString> *GeneralList,
 
 }
 
+void frmContactEditor::LoadData(std::map<int, wxString> *GeneralList,
+               std::map<int, int> *GeneralListPref,
+               std::map<int, wxString> *GeneralListType,
+               wxListCtrl *GeneralListCtrl,
+               std::map<int, wxString> *HomeList,
+               std::map<int, int> *HomeListPref,
+               std::map<int, wxString> *HomeListType,
+               wxListCtrl *HomeListCtrl,
+               std::map<int, wxString> *BusinessList,
+               std::map<int, int> *BusinessListPref,
+               std::map<int, wxString> *BusinessListType,
+               wxListCtrl *BusinessListCtrl,
+               int *DataCount){
+
+       long ListCtrlIndex = -1;
+
+       // Deal with the general items.
+       
+       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, 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<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, 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<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, 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<int,wxString> *ItemList,
                std::map<int,int> *ItemListPref,
                wxListCtrl *ItemCtrl,
@@ -862,4 +1130,872 @@ void frmContactEditor::LoadData(std::map<int,wxString> *ItemList,
        
        }
 
+}
+
+void frmContactEditor::LoadData(std::map<int,wxString> *ItemList,
+               std::map<int,int> *ItemListPref,
+               std::map<int,wxString> *ItemListType,
+               wxListCtrl *ItemCtrl,
+               int *DataCount){
+
+       long ListCtrlIndex = -1;
+
+       for (std::map<int,wxString>::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<int,wxString> *ItemList,
+               std::map<int,int> *ItemListPref,
+               std::map<int,wxString> *ItemListType,
+               std::map<int,wxString> *ItemListDataType,
+               wxListCtrl *ItemCtrl,
+               int *DataCount){
+
+       long ListCtrlIndex = -1;
+
+       for (std::map<int,wxString>::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<int,std::string> *ItemList,
+               std::map<int,int> *ItemListPref,
+               std::map<int,wxString> *ItemListType,
+               wxListCtrl *ItemCtrl,
+               int *DataCount){
+
+       long ListCtrlIndex = -1;
+
+       for (std::map<int,std::string>::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<int,wxString> *ItemListPEN,
+               std::map<int,wxString> *ItemListElement,
+               wxListCtrl *ItemCtrl,
+               int *DataCount){
+               
+       long ListCtrlIndex = -1;
+       wxString ItemValue;
+
+       for (std::map<int,wxString>::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<int,wxString> *ItemListTokens,
+               wxListCtrl *ItemCtrl,
+               int *DataCount){
+       
+       long ListCtrlIndex = -1;
+       wxString ItemValue;
+
+       for (std::map<int,wxString>::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<int,wxString> *ItemList,
+               wxComboBox *ItemCtrl){
+
+       int ItemIndex = 0;
+
+       if (MapDataExists(&ItemIndex, ItemList)){
+       
+               cmbDisplayAs->SetValue(ItemList->find(0)->second);
+       
+       }
+               
+}
+
+void frmContactEditor::LoadRelatedData(std::map<int,wxString> *ItemList,
+               std::map<int,int> *ItemListPref,
+               std::map<int,wxString> *ItemListType,
+               wxListCtrl *ItemCtrl,
+               int *DataCount){
+
+       long ListCtrlIndex = -1;
+       wxString RelatedType;
+
+       for (std::map<int,wxString>::iterator Iter = ItemList->begin();
+               Iter != ItemList->end();
+               Iter++){
+       
+               RelatedType.clear();
+       
+               wxListItem coldata;
+
+               coldata.SetId(*DataCount);
+               coldata.SetData(*DataCount);
+       
+               if (MapDataExists(DataCount, ItemListType)){
+               
+                       std::map<int,wxString>::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){
+
+       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){
+
+       if (*BirthdayText == FALSE){
+       
+               int DateYear = 0;
+               wxDateTime::Month DateMonth;
+               unsigned int DateDay;
+               
+               wxString wxSData;
+               
+               if (Birthday.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){
+
+       if (*AnniversaryText == FALSE){
+       
+               int DateYear = 0;
+               wxDateTime::Month DateMonth;
+               int DateDay;
+               
+               wxString wxSData;
+               
+               if (Anniversary.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){
+
+       // 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){
+
+       txtTitle->SetValue(*NameTitle); 
+       txtForename->SetValue(*NameForename);
+       txtSurname->SetValue(*NameSurname);
+       txtOtherNames->SetValue(*NameOtherNames);
+       txtSuffix->SetValue(*NameSuffix);
+       
+}
+
+void frmContactEditor::LoadMember(std::map<int,wxString> *GroupList){
+
+       // 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 vcardfilenamewxs;
+       wxString vCardFilename;
+       wxString vCardFilenameFull;
+       wxString vCardDataString;
+       //wxStringTokenizer vcardfileline;
+       wxString lwxs;
+       wxString setname, setvalue;
+       wxString MemberData;
+       bool FoundContact = FALSE;
+       //vCardNames = new std::map<wxString, wxString, std::greater<wxString>>;
+       std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
+       std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
+
+       wxDir vcardaccdir(AccountDirFinal);
+
+       for (std::map<int,wxString>::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<wxString,wxString>::iterator iter = vCardNamesAsc.begin(); 
+                       iter != vCardNamesAsc.end(); ++iter){
+
+                               wxListItem ItemData;
+                       
+                               ItemData.SetId(0);
+                               ItemData.SetText(iter->first);
+       
+                               lboGroups->InsertItem(ItemData);
+
+                       }
+
+
+                   } else {
+
+                       for (std::map<wxString,wxString>::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<int, wxString> *GeneralAddressList,
+       std::map<int, wxString> *GeneralAddressListTown,
+       std::map<int, wxString> *GeneralAddressListCounty,
+       std::map<int, wxString> *GeneralAddressListPostCode,
+       std::map<int, int> *GeneralAddressListPref,
+       std::map<int, wxString> *HomeAddressList,
+       std::map<int, wxString> *HomeAddressListTown,
+       std::map<int, wxString> *HomeAddressListCounty,
+       std::map<int, wxString> *HomeAddressListPostCode,
+       std::map<int, int> *HomeAddressListPref,
+       std::map<int, wxString> *BusinessAddressList,
+       std::map<int, wxString> *BusinessAddressListTown,
+       std::map<int, wxString> *BusinessAddressListCounty,
+       std::map<int, wxString> *BusinessAddressListPostCode,
+       std::map<int, int> *BusinessAddressListPref, 
+       int *AddressCount){
+
+       long ListCtrlIndex = -1;
+
+       // Deal with the general addresses.
+       
+       for (std::map<int,wxString>::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<int,wxString>::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<int,wxString>::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
index e4a9870..8972459 100644 (file)
@@ -39,15 +39,15 @@ void frmContactEditor::LoadAddress(std::map<int, wxString> *GeneralAddressList,
 
        // Deal with the general addresses.
        
-       for (std::map<int,wxString>::iterator GenAdrListIter = GeneralAddressList->begin();
-               GenAdrListIter != GeneralAddressList->end();
-               GenAdrListIter++){
+       for (std::map<int,wxString>::iterator Iter = GeneralAddressList->begin();
+               Iter != GeneralAddressList->end();
+               Iter++){
        
                wxListItem coldata;
 
                coldata.SetId(*AddressCount);
                coldata.SetData(*AddressCount);
-               coldata.SetText(GenAdrListIter->second);
+               coldata.SetText(Iter->second);
                
                ListCtrlIndex = lboAddresses->InsertItem(coldata);
                
@@ -81,15 +81,15 @@ void frmContactEditor::LoadAddress(std::map<int, wxString> *GeneralAddressList,
        
        // Deal with the home addresses.
        
-       for (std::map<int,wxString>::iterator GenAdrListIter = HomeAddressList->begin();
-               GenAdrListIter != HomeAddressList->end();
-               GenAdrListIter++){
+       for (std::map<int,wxString>::iterator Iter = HomeAddressList->begin();
+               Iter != HomeAddressList->end();
+               Iter++){
        
                wxListItem coldata;
 
                coldata.SetId(*AddressCount);
                coldata.SetData(*AddressCount);
-               coldata.SetText(GenAdrListIter->second);
+               coldata.SetText(Iter->second);
                
                ListCtrlIndex = lboHomeAddresses->InsertItem(coldata);
                
@@ -123,15 +123,15 @@ void frmContactEditor::LoadAddress(std::map<int, wxString> *GeneralAddressList,
        
        // Deal with the work addresses.
        
-       for (std::map<int,wxString>::iterator GenAdrListIter = BusinessAddressList->begin();
-               GenAdrListIter != BusinessAddressList->end();
-               GenAdrListIter++){
+       for (std::map<int,wxString>::iterator Iter = BusinessAddressList->begin();
+               Iter != BusinessAddressList->end();
+               Iter++){
        
                wxListItem coldata;
 
                coldata.SetId(*AddressCount);
                coldata.SetData(*AddressCount);
-               coldata.SetText(GenAdrListIter->second);
+               coldata.SetText(Iter->second);
                
                ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata);
                
index 5f0eba8..8205da7 100644 (file)
@@ -35,22 +35,46 @@ void frmContactEditor::LoadLogo( wxListEvent& event )
     std::string base64dec;
     
     std::map<int,std::string>::iterator initier;
+    std::map<int,wxString>::iterator pictypeiter;
     
-    initier = LogosList.find(intSelectedData);
+    initier = ContactEditorData.LogosList.find(intSelectedData);
+    pictypeiter = ContactEditorData.LogosListPictureType.find(intSelectedData);
     
     base64dec = base64_decode(initier->second);
     
-    
     wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
     wxImage photo;
     //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
     
-    if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
+    if (pictypeiter->second == wxT("image/jpeg")){
         
-        return;
+        if (!photo.LoadFile(istream, wxBITMAP_TYPE_JPEG)){
         
-    }
+            return;
+        
+        }
+        
+    } else if (pictypeiter->second == wxT("image/png")){
+        
+        if (!photo.LoadFile(istream, wxBITMAP_TYPE_PNG)){
+            
+            return;
+            
+        }
+        
+    } else if (pictypeiter->second == wxT("image/gif")){
+        
+        if (!photo.LoadFile(istream, wxBITMAP_TYPE_GIF)){
+            
+            return;
+            
+        }
+        
+    } else {
     
+        return;
+    
+    }
     
     LogoImage = (wxBitmap)photo;
     imgLogo->SetBitmap(LogoImage);
@@ -155,8 +179,8 @@ void frmContactEditor::SaveLogo( wxCommandEvent &event )
        std::map<int,std::string>::iterator initier;
        std::map<int,wxString>::iterator logotypeiter;
     
-       initier = LogosList.find(intSelectedData);
-       logotypeiter = LogosListPictureType.find(intSelectedData);
+       initier = ContactEditorData.LogosList.find(intSelectedData);
+       logotypeiter = ContactEditorData.LogosListPictureType.find(intSelectedData);
        
        if (logotypeiter->second == wxT("image/jpeg")){
     
@@ -196,7 +220,7 @@ void frmContactEditor::SaveLogo( wxCommandEvent &event )
        
                std::string base64dec;
                
-               initier = LogosList.find(intSelectedData);
+               initier = ContactEditorData.LogosList.find(intSelectedData);
                base64dec = base64_decode(initier->second);
                
                LogoFile.Write(base64dec.c_str(), (size_t)base64dec.size());
index 68aa2cb..402f672 100644 (file)
@@ -116,8 +116,8 @@ void frmContactEditor::LoadPicture( wxListEvent& event )
     std::map<int,std::string>::iterator initier;
     std::map<int,wxString>::iterator pictypeiter;
     
-    initier = PicturesList.find(intSelectedData);
-    pictypeiter = PicturesListPictureType.find(intSelectedData);
+    initier = ContactEditorData.PicturesList.find(intSelectedData);
+    pictypeiter = ContactEditorData.PicturesListPictureType.find(intSelectedData);
     
     base64dec = base64_decode(initier->second);
     
@@ -181,8 +181,8 @@ void frmContactEditor::SavePicture( wxCommandEvent &event )
        std::map<int,std::string>::iterator initier;
        std::map<int,wxString>::iterator pictypeiter;
     
-       initier = PicturesList.find(intSelectedData);
-       pictypeiter = PicturesListPictureType.find(intSelectedData);
+       initier = ContactEditorData.PicturesList.find(intSelectedData);
+       pictypeiter = ContactEditorData.PicturesListPictureType.find(intSelectedData);
        
        if (pictypeiter->second == wxT("image/jpeg")){
     
@@ -222,7 +222,7 @@ void frmContactEditor::SavePicture( wxCommandEvent &event )
        
                std::string base64dec;
                
-               initier = PicturesList.find(intSelectedData);
+               initier = ContactEditorData.PicturesList.find(intSelectedData);
                base64dec = base64_decode(initier->second);
                
                PictureFile.Write(base64dec.c_str(), (size_t)base64dec.size());
index c19b947..2485121 100644 (file)
@@ -171,7 +171,7 @@ void frmContactEditor::PlaySound( wxCommandEvent& event )
     
     std::map<int, std::string>::iterator initier;
     
-    initier = SoundsList.find(intSelectedData);
+    initier = ContactEditorData.SoundsList.find(intSelectedData);
     
     base64dec = base64_decode(initier->second);
     base64declen = base64dec.size();
@@ -219,8 +219,8 @@ void frmContactEditor::SaveSound( wxCommandEvent &event )
        std::map<int,std::string>::iterator initier;
        std::map<int,wxString>::iterator soundtypeiter;
     
-       initier = SoundsList.find(intSelectedData);
-       soundtypeiter = SoundsListAudioType.find(intSelectedData);
+       initier = ContactEditorData.SoundsList.find(intSelectedData);
+       soundtypeiter = ContactEditorData.SoundsListAudioType.find(intSelectedData);
        
        // Open up the dialog to save the picture.
        
@@ -241,7 +241,7 @@ void frmContactEditor::SaveSound( wxCommandEvent &event )
        
                std::string base64dec;
                
-               initier = SoundsList.find(intSelectedData);
+               initier = ContactEditorData.SoundsList.find(intSelectedData);
                base64dec = base64_decode(initier->second);
                
                SoundFile.Write(base64dec.c_str(), (size_t)base64dec.size());
index 34d4cf3..c1f7547 100644 (file)
@@ -603,66 +603,15 @@ class frmContactEditor : public frmContactEditorADT
                void ResetSaveProcessData();
                void ContactFileChanged( wxCommandEvent &event );
                void ClearContact();
-               
-               /* Functions for loading contacts */
-               void LoadKind(wxString KindType);
-               void LoadMember(wxString MemberData, int *GroupCount);
-               void LoadFN(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *FNCount, 
-                       bool *FNProcessed, vCard *ContactData);
-               void LoadN(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *NameProcessed, 
-                       vCard *ContactData);
-               void LoadNickname(wxString wxSpropertySeg1, wxString wxSPropertySeg2, 
-                       int *NicknameCount, vCard *ContactData);
-               void LoadGender(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *GenderProcessed, 
-                       vCard *ContactData);
-               void LoadBDay(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *BirthdayProcessed);
-               void LoadAnniversary(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *AnniversaryProcessed);
-               void LoadTimeZone(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *TZCount);
-               void LoadADR(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *ADRCount);
-               void LoadEmail(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *ADRCount);
-               void LoadIM(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *IMPPCount);
-               void LoadTelephone(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *TelCount);
-               void LoadLanguage(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *LangCount);
-               void LoadGeo(wxString wxSProptertySeg1, wxString wxSPropertySeg2, int *GeoCount);
-               void LoadRelated(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *RelatedCount);
-               void LoadURL(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *URLCount);
-               void LoadTitle(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *TitleCount);
-               void LoadRole(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *RoleCount);
-               void LoadOrg(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *OrgCount);
-               void LoadNote(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *NoteCount);
-               void LoadCategory(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *CategoryCount);
-               void LoadPhoto(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *PhotoCount);
-               void LoadLogo(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *PhotoCount);
-               void LoadSound(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *SoundCount);
-               void LoadCalURI(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *CalAdrCount);
-               void LoadCalAdrURI(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *CalReqAdrCount);
-               void LoadCalFreeBusy(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *FreeBusyCount);
-               void LoadKey(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *KeyCount);
-               
-               void 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> *BusinessTZPref,
-                       wxListCtrl *BusinessListCtrl,
-                       int *DataCount);
-                       
-               void LoadData(std::map<int,wxString> *ItemList,
-                       std::map<int,int> *ItemListPref,
-                       wxListCtrl *ItemCtrl,
-                       int *DataCount);
-               
-               void LoadGender(wxString *GenderComponent, wxString *GenderIdentity);
+
+               void LoadKind(ContactKindType *KindType);
                void LoadBirthday(wxString *BirthdayData, bool *BirthdayText);
                void LoadAnniversary(wxString *AnniversaryData, bool *AnniversaryText);
-               void LoadKind(ContactKindType *KindType);
+               void LoadGender(wxString *GenderComponent, wxString *GenderIdentity);
                void LoadName(wxString *NameTitle, wxString *NameForename,
                        wxString *NameSurname, wxString *NameOtherNames, 
                        wxString *NameSuffix);
-               void LoadMember(std::map<int,wxString> *GroupsList);
+               void LoadMember(std::map<int,wxString> *GroupList);
                void LoadAddress(std::map<int, wxString> *GeneralAddressList,
                        std::map<int, wxString> *GeneralAddressListTown,
                        std::map<int, wxString> *GeneralAddressListCounty,
@@ -677,22 +626,77 @@ class frmContactEditor : public frmContactEditorADT
                        std::map<int, wxString> *BusinessAddressListTown,
                        std::map<int, wxString> *BusinessAddressListCounty,
                        std::map<int, wxString> *BusinessAddressListPostCode,
-                       std::map<int, int> *BusinessAddressListPref,
+                       std::map<int, int> *BusinessAddressListPref, 
                        int *AddressCount);
-               void LoadTimeZone(std::map<int, wxString> *GeneralTZListPtr,
-                       std::map<int, int> *GeneralTZListPrefPtr,
-                       std::map<int, wxString> *HomeTZListPtr,
-                       std::map<int, int> *HomeTZListPrefPtr,
-                       std::map<int, wxString> *BusinessTZListPtr,
-                       std::map<int, int> *BusinessTZListPrefPtr,
-                       int *TZCount);
-               void LoadEmail(std::map<int, wxString> *GeneralEmailListPtr,
-                       std::map<int, int> *GeneralEmailListPrefPtr,
-                       std::map<int, wxString> *HomeEmailListPtr,
-                       std::map<int, int> *HomeEmailListPrefPtr,
-                       std::map<int, wxString> *BusinessEmailListPtr,
-                       std::map<int, int> *BusinessEmailListPrefPtr,
-                       int *EmailCount);
+               
+               void 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> *BusinessTZPref,
+                       wxListCtrl *BusinessListCtrl,
+                       int *DataCount);
+               
+               void LoadData(std::map<int, wxString> *GeneralList,
+                       std::map<int, int> *GeneralListPref,
+                       std::map<int, wxString> *GeneralListType,
+                       wxListCtrl *GeneralListCtrl,
+                       std::map<int, wxString> *HomeList,
+                       std::map<int, int> *HomeListPref,
+                       std::map<int, wxString> *HomeListType,
+                       wxListCtrl *HomeListCtrl,
+                       std::map<int, wxString> *BusinessList,
+                       std::map<int, int> *BusinessListPref,
+                       std::map<int, wxString> *BusinessListType,
+                       wxListCtrl *BusinessListCtrl,
+                       int *DataCount);
+               
+               void LoadData(std::map<int,wxString> *ItemList,
+                       std::map<int,int> *ItemListPref,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
+
+               void LoadData(std::map<int,wxString> *ItemList,
+                       std::map<int,int> *ItemListPref,
+                       std::map<int,wxString> *ItemListType,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
+       
+               void LoadData(wxString ItemName,
+                       std::map<int,wxString> *ItemList,
+                       std::map<int,int> *ItemListPref,
+                       std::map<int,wxString> *ItemListType,
+                       std::map<int,wxString> *ItemListDataType,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
+                       
+               void LoadPictureData(wxString ItemName, 
+                       std::map<int,std::string> *ItemList,
+                       std::map<int,int> *ItemListPref,
+                       std::map<int,wxString> *ItemListType,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
+                       
+               void LoadVendorData(std::map<int,wxString> *ItemListPEN,
+                       std::map<int,wxString> *ItemListElement,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
+
+               void LoadXTokenData(std::map<int,wxString> *ItemListTokens,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
+                       
+               void LoadData(std::map<int,wxString> *ItemList,
+                       wxComboBox *ItemCtrl);
+                       
+               void LoadRelatedData(std::map<int,wxString> *ItemList,
+                       std::map<int,int> *ItemListPref,
+                       std::map<int,wxString> *ItemListType,
+                       wxListCtrl *ItemCtrl,
+                       int *DataCount);
        
                int intValueSeek = 1;
                bool IsGroup = FALSE;
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