Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Implemented ADR to use ContactDataObject.
[xestiaab/.git] / source / contacteditor / frmContactEditor-LoadAddress.cpp
1 // frmContactEditor-LoadAddress.cpp - frmContactEditor load address subroutines.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
21 void frmContactEditor::LoadAddress(std::map<int, wxString> *GeneralAddressList,
22         std::map<int, wxString> *GeneralAddressListTown,
23         std::map<int, wxString> *GeneralAddressListCounty,
24         std::map<int, wxString> *GeneralAddressListPostCode,
25         std::map<int, int> *GeneralAddressListPref,
26         std::map<int, wxString> *HomeAddressList,
27         std::map<int, wxString> *HomeAddressListTown,
28         std::map<int, wxString> *HomeAddressListCounty,
29         std::map<int, wxString> *HomeAddressListPostCode,
30         std::map<int, int> *HomeAddressListPref,
31         std::map<int, wxString> *BusinessAddressList,
32         std::map<int, wxString> *BusinessAddressListTown,
33         std::map<int, wxString> *BusinessAddressListCounty,
34         std::map<int, wxString> *BusinessAddressListPostCode,
35         std::map<int, int> *BusinessAddressListPref, 
36         int *AddressCount){
38         long ListCtrlIndex = -1;
40         // Deal with the general addresses.
41         
42         for (std::map<int,wxString>::iterator GenAdrListIter = GeneralAddressList->begin();
43                 GenAdrListIter != GeneralAddressList->end();
44                 GenAdrListIter++){
45         
46                 wxListItem coldata;
48                 coldata.SetId(*AddressCount);
49                 coldata.SetData(*AddressCount);
50                 coldata.SetText(GenAdrListIter->second);
51                 
52                 ListCtrlIndex = lboAddresses->InsertItem(coldata);
53                 
54                 if (MapDataExists(AddressCount, GeneralAddressListTown)){
55                 
56                         lboAddresses->SetItem(ListCtrlIndex, 1, GeneralAddressListTown->find(*AddressCount)->second);
57                 
58                 }
60                 if (MapDataExists(AddressCount, GeneralAddressListCounty)){
61                 
62                         lboAddresses->SetItem(ListCtrlIndex, 2, GeneralAddressListCounty->find(*AddressCount)->second);
63                 
64                 }
65                 
66                 if (MapDataExists(AddressCount, GeneralAddressListPostCode)){
67                 
68                         lboAddresses->SetItem(ListCtrlIndex, 3, GeneralAddressListPostCode->find(*AddressCount)->second);
69                 
70                 }
71                 
72                 if (MapDataExists(AddressCount, GeneralAddressListPref)){
73                 
74                         lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", GeneralAddressListPref->find(*AddressCount)->second));
75                 
76                 }
77         
78                 (*AddressCount)++;
79         
80         }
81         
82         // Deal with the home addresses.
83         
84         for (std::map<int,wxString>::iterator GenAdrListIter = HomeAddressList->begin();
85                 GenAdrListIter != HomeAddressList->end();
86                 GenAdrListIter++){
87         
88                 wxListItem coldata;
90                 coldata.SetId(*AddressCount);
91                 coldata.SetData(*AddressCount);
92                 coldata.SetText(GenAdrListIter->second);
93                 
94                 ListCtrlIndex = lboHomeAddresses->InsertItem(coldata);
95                 
96                 if (MapDataExists(AddressCount, HomeAddressListTown)){
97                 
98                         lboHomeAddresses->SetItem(ListCtrlIndex, 1, HomeAddressListTown->find(*AddressCount)->second);
99                 
100                 }
102                 if (MapDataExists(AddressCount, HomeAddressListCounty)){
103                 
104                         lboHomeAddresses->SetItem(ListCtrlIndex, 2, HomeAddressListCounty->find(*AddressCount)->second);
105                 
106                 }
107                 
108                 if (MapDataExists(AddressCount, HomeAddressListPostCode)){
109                 
110                         lboHomeAddresses->SetItem(ListCtrlIndex, 3, HomeAddressListPostCode->find(*AddressCount)->second);
111                 
112                 }
113                 
114                 if (MapDataExists(AddressCount, HomeAddressListPref)){
115                 
116                         lboHomeAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", HomeAddressListPref->find(*AddressCount)->second));
117                 
118                 }
119         
120                 (*AddressCount)++;
121         
122         }
123         
124         // Deal with the work addresses.
125         
126         for (std::map<int,wxString>::iterator GenAdrListIter = BusinessAddressList->begin();
127                 GenAdrListIter != BusinessAddressList->end();
128                 GenAdrListIter++){
129         
130                 wxListItem coldata;
132                 coldata.SetId(*AddressCount);
133                 coldata.SetData(*AddressCount);
134                 coldata.SetText(GenAdrListIter->second);
135                 
136                 ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata);
137                 
138                 if (MapDataExists(AddressCount, BusinessAddressListTown)){
139                 
140                         lboBusinessAddresses->SetItem(ListCtrlIndex, 1, BusinessAddressListTown->find(*AddressCount)->second);
141                 
142                 }
144                 if (MapDataExists(AddressCount, BusinessAddressListCounty)){
145                 
146                         lboBusinessAddresses->SetItem(ListCtrlIndex, 2, BusinessAddressListCounty->find(*AddressCount)->second);
147                 
148                 }
149                 
150                 if (MapDataExists(AddressCount, BusinessAddressListPostCode)){
151                 
152                         lboBusinessAddresses->SetItem(ListCtrlIndex, 3, BusinessAddressListPostCode->find(*AddressCount)->second);
153                 
154                 }
155                 
156                 if (MapDataExists(AddressCount, BusinessAddressListPref)){
157                 
158                         lboBusinessAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", BusinessAddressListPref->find(*AddressCount)->second));
159                 
160                 }
161         
162                 (*AddressCount)++;
163         
164         }
168 void frmContactEditor::LoadADR(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *ADRCount){
170         size_t intPropertyLen = wxSPropertySeg1.Len();
171         std::map<int, int> SplitPoints;
172         std::map<int, int> SplitLength;
173         std::map<int, int>::iterator SLiter;                    
174         wxString PropertyData;
175         wxString PropertyName;
176         wxString PropertyValue;
177         wxString PropertyTokens;
178         wxString AddressLabel;
179         wxString AddressLang;
180         wxString AddressAltID;
181         wxString AddressPID;
182         wxString AddressTokens;
183         wxString AddressGeo;
184         wxString AddressTimezone;
185         wxString AddressType;
186         wxString AddressMediatype;
187         wxString AddressPOBox;
188         wxString AddressExtended;
189         wxString AddressStreet;
190         wxString AddressLocality;
191         wxString AddressCity;
192         wxString AddressRegion;
193         wxString AddressPostalCode;
194         wxString AddressCountry;
195         bool FirstToken = TRUE;                 
196         int intSplitsFound = 0;
197         int intSplitSize = 0;
198         int intPrevValue = 5;
199         int intPref = 0;                        
200         int intType = 0;
201         long ListCtrlIndex;
202         
203         SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
204         
205         intPrevValue = 4;
206         
207         // Look for type before continuing.
208         
209         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
210         intiter != SplitPoints.end(); ++intiter){
211         
212                 SLiter = SplitLength.find(intiter->first);
213         
214                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
215                 
216                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
217                 PropertyName = PropertyElement.GetNextToken();                          
218                 PropertyValue = PropertyElement.GetNextToken();
219                 
220                 intPrevValue = intiter->second;
221                 
222                 if (PropertyName == wxT("TYPE")){
223                 
224                         if (PropertyValue == wxT("work")){
225                         
226                                 intType = 2;                                    
227                         
228                         } else if (PropertyValue == wxT("home")){
230                                 intType = 1;
231                         
232                         } else {
233                         
234                                 intType = 0;
235                         
236                         }
237                 
238                 }
239         
240         }
241         
242         // Setup blank lines for later on.
243         
244         if (intType == 0){
245         
246                 GeneralAddressList.insert(std::make_pair(intValueSeek, wxT("")));
247                 GeneralAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
248                 GeneralAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
249                 GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
250                 GeneralAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
251                 GeneralAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
252                 GeneralAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
253                 GeneralAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
254                 GeneralAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
255                 GeneralAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
256                 GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
257                 GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
258                 GeneralAddressListPref.insert(std::make_pair(intValueSeek, 0));
259                 GeneralAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
261         } else if (intType == 1){
262         
263                 HomeAddressList.insert(std::make_pair(intValueSeek, wxT("")));
264                 HomeAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
265                 HomeAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
266                 HomeAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
267                 HomeAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
268                 HomeAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
269                 HomeAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
270                 HomeAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
271                 HomeAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
272                 HomeAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
273                 HomeAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
274                 HomeAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
275                 HomeAddressListPref.insert(std::make_pair(intValueSeek, 0));
276                 HomeAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
277         
278         } else if (intType == 2){
280                 BusinessAddressList.insert(std::make_pair(intValueSeek, wxT("")));
281                 BusinessAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
282                 BusinessAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
283                 BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
284                 BusinessAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
285                 BusinessAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
286                 BusinessAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
287                 BusinessAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
288                 BusinessAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
289                 BusinessAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
290                 BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
291                 BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
292                 BusinessAddressListPref.insert(std::make_pair(intValueSeek, 0));
293                 BusinessAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
294         
295         }
296         
297         intPrevValue = 4;
298         
299         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
300         intiter != SplitPoints.end(); ++intiter){
301         
302                 SLiter = SplitLength.find(intiter->first);
303         
304                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
305                 
306                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
307                 PropertyName = PropertyElement.GetNextToken();                          
308                 PropertyValue = PropertyElement.GetNextToken();
309                 
310                 intPrevValue = intiter->second;
311                 
312                 ProcessCaptureStrings(&PropertyValue);
313                 
314                 // Process properties.
315                 
316                 if (PropertyName == wxT("LABEL")){
317                 
318                         if (intType == 0){ GeneralAddressListLabel.erase(intValueSeek); GeneralAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); }
319                         else if (intType == 1){ HomeAddressListLabel.erase(intValueSeek); HomeAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); }
320                         else if (intType == 2){ BusinessAddressListLabel.erase(intValueSeek); BusinessAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue));}
321                 
322                 } else if (PropertyName == wxT("LANGUAGE")){
323                 
324                         if (intType == 0){ GeneralAddressListLang.erase(intValueSeek); GeneralAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
325                         else if (intType == 1){ HomeAddressListLang.erase(intValueSeek); HomeAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
326                         else if (intType == 2){ BusinessAddressListLang.erase(intValueSeek); BusinessAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }                             
327                 
328                 } else if (PropertyName == wxT("ALTID")){
330                         if (intType == 0){ GeneralAddressListAltID.erase(intValueSeek); GeneralAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
331                         else if (intType == 1){ HomeAddressListAltID.erase(intValueSeek); HomeAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
332                         else if (intType == 2){ BusinessAddressListAltID.erase(intValueSeek); BusinessAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
333                 
334                 } else if (PropertyName == wxT("PID")){
336                         if (intType == 0){ GeneralAddressListPID.erase(intValueSeek); GeneralAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
337                         else if (intType == 1){ HomeAddressListPID.erase(intValueSeek); HomeAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
338                         else if (intType == 2){ BusinessAddressListPID.erase(intValueSeek); BusinessAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
339                 
340                 } else if (PropertyName == wxT("GEO")){
341                 
342                         if (intType == 0){ GeneralAddressListGeo.erase(intValueSeek); GeneralAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
343                         else if (intType == 1){ HomeAddressListGeo.erase(intValueSeek); HomeAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
344                         else if (intType == 2){ BusinessAddressListGeo.erase(intValueSeek); BusinessAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
345                 
346                 } else if (PropertyName == wxT("TZ")){
348                         if (intType == 0){ GeneralAddressListTimezone.erase(intValueSeek); GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
349                         else if (intType == 1){ HomeAddressListTimezone.erase(intValueSeek); HomeAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
350                         else if (intType == 2){ BusinessAddressListTimezone.erase(intValueSeek); BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
351                 
352                 } else if (PropertyName == wxT("MEDIATYPE")){
354                         if (intType == 0){ GeneralAddressListMediatype.erase(intValueSeek); GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
355                         else if (intType == 1){ HomeAddressListMediatype.erase(intValueSeek); HomeAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
356                         else if (intType == 2){ BusinessAddressListMediatype.erase(intValueSeek); BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
357                 
358                 } else if (PropertyName == wxT("PREF")){
359                         
360                         intPref = wxAtoi(PropertyValue);
361                         
362                         if (intPref > 0 && intPref < 101){
363                                                 
364                                 if (intType == 0){ GeneralAddressListPref.erase(intValueSeek); GeneralAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
365                                 else if (intType == 1){ HomeAddressListPref.erase(intValueSeek); HomeAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
366                                 else if (intType == 2){ BusinessAddressListPref.erase(intValueSeek); BusinessAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
367                                 
368                         }
369                 
370                 } else {
371                 
372                         if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
373                         
374                                 if (FirstToken == TRUE){
375                                 
376                                         PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
377                                         FirstToken = FALSE;
378                                 
379                                 } else {
380                                 
381                                         PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
382                                 
383                                 }
384                         
385                         }
386                 
387                 }
388         
389         }                       
390         
391         // Split the address. 
393         //std::map<int, int>::iterator SLiter;
394         intPropertyLen = wxSPropertySeg2.Len();
395         SplitPoints.clear();
396         SplitLength.clear();
397         intSplitsFound = 0;
398         intSplitSize = 0;
399         intPrevValue = 0;
400         
401         for (int i = 0; i <= intPropertyLen; i++){
403                 intSplitSize++;
404         
405                 if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
406         
407                         intSplitsFound++;
408                         SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
409                         
410                         if (intSplitsFound == 6){ 
411                         
412                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
413                                 break; 
414                                 
415                         } else {
416                         
417                                 SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
418                         
419                         }
420                         
421                         intSplitSize = 0;                                       
422         
423                 }
425         }
426         
427         // Split the data into several parts.                   
428         
429         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
430         intiter != SplitPoints.end(); ++intiter){
431                         
432                 if (intiter->first == 1){
433                 
434                         // Deal with PO Box.
435                         
436                         SLiter = SplitLength.find(1);
437                                                                 
438                         //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
439                         AddressPOBox = wxSPropertySeg2.Mid(0, SLiter->second);
440                         intPrevValue = intiter->second;
441                 
442                 } else if (intiter->first == 2){
443                 
444                         // Deal with extended address.
445                         
446                         SLiter = SplitLength.find(2);
447                         
448                         AddressExtended = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
449                         //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
450                         intPrevValue = intiter->second;
451                 
452                 } else if (intiter->first == 3){
453                 
454                         // Deal with street address.
455                         
456                         SLiter = SplitLength.find(3);
457                                                                 
458                         AddressStreet = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
459                         //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
460                         intPrevValue = intiter->second;
461                 
462                 } else if (intiter->first == 4){
463                 
464                         // Deal with locality
466                         SLiter = SplitLength.find(4);
467                         
468                         AddressLocality = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
469                         //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
470                         intPrevValue = intiter->second;
471                         
472                         //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
473                 
474                 } else if (intiter->first == 5){
475                 
476                         // Deal with region.
478                         SLiter = SplitLength.find(5);
479                         
480                         AddressRegion = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
481                         //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
482                         intPrevValue = intiter->second;
483                         
484                         //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
485                 
486                 } else if (intiter->first == 6){
487                 
488                         // Deal with post code.
490                         SLiter = SplitLength.find(6);
491                         
492                         AddressPostalCode = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
493                         //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
494                         intPrevValue = intiter->second;
495                         
496                         // Deal with country.
497                         
498                         AddressCountry = wxSPropertySeg2.Mid(intPrevValue);
499                         //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
500                 
501                 }
502         
503         }       
504         
505         // Add the data to the General/Home/Work address variables.
506         
507         ProcessCaptureStrings(&AddressStreet, &AddressLocality, &AddressRegion, &AddressPostalCode, &AddressCountry);
508         
509         wxListItem coldata;
511         coldata.SetId(intValueSeek);
512         coldata.SetData(intValueSeek);
513         coldata.SetText(AddressStreet);
514         
515         if (intType == 0){
516         
517                 ListCtrlIndex = lboAddresses->InsertItem(coldata);
518                 lboAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
519                 lboAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
520                 lboAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
521                 
522                 if (intPref > 0 && intPref < 101){
523                 
524                         lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), intPref));
525                         
526                 }
527                 
528                 GeneralAddressList.erase(intValueSeek);
529                 GeneralAddressListTown.erase(intValueSeek);
530                 GeneralAddressListCounty.erase(intValueSeek);
531                 GeneralAddressListPostCode.erase(intValueSeek);
532                 GeneralAddressListCountry.erase(intValueSeek);
533                 GeneralAddressListType.erase(intValueSeek);
534                 GeneralAddressListTokens.erase(intValueSeek);
535                 GeneralAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
536                 GeneralAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
537                 GeneralAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
538                 GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
539                 GeneralAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
540                 GeneralAddressListType.insert(std::make_pair(intValueSeek, wxT("")));
541                 GeneralAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
542         
543         } else if (intType == 1){ 
544         
545                 ListCtrlIndex = lboHomeAddresses->InsertItem(coldata);
546                 lboHomeAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
547                 lboHomeAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
548                 lboHomeAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
550                 if (intPref > 0 && intPref < 101){
551                 
552                         lboHomeAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
553                         
554                 }
556                 HomeAddressList.erase(intValueSeek);
557                 HomeAddressListTown.erase(intValueSeek);
558                 HomeAddressListCounty.erase(intValueSeek);
559                 HomeAddressListPostCode.erase(intValueSeek);
560                 HomeAddressListCountry.erase(intValueSeek);
561                 HomeAddressListType.erase(intValueSeek);
562                 HomeAddressListTokens.erase(intValueSeek);                              
563                 HomeAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
564                 HomeAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
565                 HomeAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
566                 HomeAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
567                 HomeAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
568                 HomeAddressListType.insert(std::make_pair(intValueSeek, wxT("home")));
569                 HomeAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
570         
571         } else if (intType == 2){ 
572         
573                 ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata);
574                 lboBusinessAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
575                 lboBusinessAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
576                 lboBusinessAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
578                 if (intPref > 0 && intPref < 101){
579                 
580                         lboBusinessAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
581                         
582                 }
583                 
584                 BusinessAddressList.erase(intValueSeek);
585                 BusinessAddressListTown.erase(intValueSeek);
586                 BusinessAddressListCounty.erase(intValueSeek);
587                 BusinessAddressListPostCode.erase(intValueSeek);
588                 BusinessAddressListCountry.erase(intValueSeek);
589                 BusinessAddressListType.erase(intValueSeek);
590                 BusinessAddressListTokens.erase(intValueSeek);
591                 BusinessAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
592                 BusinessAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
593                 BusinessAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
594                 BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
595                 BusinessAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
596                 BusinessAddressListType.insert(std::make_pair(intValueSeek, wxT("work")));
597                 BusinessAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));                         
598         
599         }
600         
601         ADRCount++;
602         intValueSeek++;
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