X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;ds=inline;f=source%2Fcontacteditor%2FfrmContactEditor-LoadAddress.cpp;h=e4a987067fbba87c1b3246177c092fcdd9a56753;hb=c4a1208ebda76c1db6ede791808dcec6a77afecc;hp=16e8dbf2506aa0d34544b2a878216aa671ead420;hpb=0f855c5d57f952d2aae11759a60de90146e03c68;p=xestiaab%2F.git
diff --git a/source/contacteditor/frmContactEditor-LoadAddress.cpp b/source/contacteditor/frmContactEditor-LoadAddress.cpp
index 16e8dbf..e4a9870 100644
--- a/source/contacteditor/frmContactEditor-LoadAddress.cpp
+++ b/source/contacteditor/frmContactEditor-LoadAddress.cpp
@@ -1,5 +1,170 @@
+// frmContactEditor-LoadAddress.cpp - frmContactEditor load address subroutines.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see
+
#include "frmContactEditor.h"
+void frmContactEditor::LoadAddress(std::map *GeneralAddressList,
+ std::map *GeneralAddressListTown,
+ std::map *GeneralAddressListCounty,
+ std::map *GeneralAddressListPostCode,
+ std::map *GeneralAddressListPref,
+ std::map *HomeAddressList,
+ std::map *HomeAddressListTown,
+ std::map *HomeAddressListCounty,
+ std::map *HomeAddressListPostCode,
+ std::map *HomeAddressListPref,
+ std::map *BusinessAddressList,
+ std::map *BusinessAddressListTown,
+ std::map *BusinessAddressListCounty,
+ std::map *BusinessAddressListPostCode,
+ std::map *BusinessAddressListPref,
+ int *AddressCount){
+
+ long ListCtrlIndex = -1;
+
+ // Deal with the general addresses.
+
+ for (std::map::iterator GenAdrListIter = GeneralAddressList->begin();
+ GenAdrListIter != GeneralAddressList->end();
+ GenAdrListIter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*AddressCount);
+ coldata.SetData(*AddressCount);
+ coldata.SetText(GenAdrListIter->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::iterator GenAdrListIter = HomeAddressList->begin();
+ GenAdrListIter != HomeAddressList->end();
+ GenAdrListIter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*AddressCount);
+ coldata.SetData(*AddressCount);
+ coldata.SetText(GenAdrListIter->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::iterator GenAdrListIter = BusinessAddressList->begin();
+ GenAdrListIter != BusinessAddressList->end();
+ GenAdrListIter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*AddressCount);
+ coldata.SetData(*AddressCount);
+ coldata.SetText(GenAdrListIter->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)++;
+
+ }
+
+}
+
void frmContactEditor::LoadADR(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *ADRCount){
size_t intPropertyLen = wxSPropertySeg1.Len();