Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Removed srand subroutine when saving a contact as it doesn't do anything useful.
[xestiaab/.git] / source / contacteditor / frmContactEditor.cpp
1 #include <map>
2 #include <string>
3 #include <thread>
4 #include <vector>
5 #include <stdlib.h>
7 #include <wx/wx.h>
8 #include <wx/ffile.h>
9 #include <wx/tokenzr.h>
10 #include <wx/mstream.h>
11 #include <wx/fs_mem.h>
12 #include <wx/datetime.h>
14 #include <SFML/Audio.hpp>
16 #include "frmContactEditor.h"
17 #include "frmContactEditorNickname.h"
18 #include "frmContactEditorAddress.h"
19 #include "frmContactEditorEmail.h"
20 #include "frmContactEditorIM.h"
21 #include "frmContactEditorTelephone.h"
22 #include "frmContactEditorLanguages.h"
23 #include "frmContactEditorTimezones.h"
24 #include "frmContactEditorRelated.h"
25 #include "frmContactEditorWebsites.h"
26 #include "frmContactEditorTitles.h"
27 #include "frmContactEditorRoles.h"
28 #include "frmContactEditorGeoposition.h"
29 #include "frmContactEditorGroups.h"
31 #include "frmContactEditorOrganisations.h"
32 #include "frmContactEditorNotes.h"
33 #include "frmContactEditorCategory.h"
34 #include "frmContactEditorSound.h"
35 #include "frmContactEditorPicture.h"
36 #include "frmContactEditorCalAdr.h"
37 #include "frmContactEditorKey.h"
38 #include "frmContactEditorVendor.h"
39 #include "frmContactEditorXToken.h"
40 #include "../frmMain.h"
42 #include "../enums.h"
43 #include "../version.h"
44 #include "../vcard/vcard.h"
45 #include "../vcard/vcard34conv.h"
46 #include "../bitmaps.h"
47 #include "../common/base64.h"
48 #include "../common/textprocessing.h"
49 #include "../common/preferences.h"
50 #include "../common/uuid.h"
51 #include "../common/dirs.h"
53 #define CE_NICKNAME wxT("Nickname")
54 #define CE_ADDRESS wxT("Address")
55 #define CE_EMAIL wxT("Email")
56 #define CE_IM wxT("IM")
57 #define CE_TELEPHONE wxT("Telephone")
58 #define CE_LANG wxT("Languages")
59 #define CE_TZ wxT("Timezone")
60 #define CE_RELATED wxT("Related")
61 #define CE_WEBSITE wxT("Websites")
62 #define CE_TITLE wxT("Titles")
63 #define CE_GEOPOSITION wxT("Geoposition")
64 #define CE_ROLE wxT("Roles")
65 #define CE_ORG wxT("Organisations")
66 #define CE_NOTE wxT("Notes")
67 #define CE_CATEGORIES wxT("Categories")
68 #define CE_GROUPS wxT("Groups")
69 #define CE_PICTURES wxT("Pictures")
70 #define CE_SOUNDS wxT("Sounds")
71 #define CE_CALENDAR wxT("Calendar")
72 #define CE_KEY wxT("Key")
73 #define CE_TOKEN wxT("Token")
75 // TODO: Investigate problems with SFML & PulseAudio - CPU usage problems when
76 // not being used.
78 // Replace intResult with intValueSeek.
80 BEGIN_EVENT_TABLE(frmContactEditor, wxFrame)
81 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, frmContactEditor::ContactFileChanged)
82 END_EVENT_TABLE()
84 frmContactEditor::frmContactEditor( wxWindow* parent )
85 :
86 frmContactEditorADT( parent )
87 {
88     boolContactModified = FALSE;
89     wxDateTime NoDate;
90     dapAnniversary->SetValue(NoDate);
91     dapBirthday->SetValue(NoDate);
92     tabMembers->Hide();
93     
94     // Setup the buttons.
95     
96     wxMemoryInputStream istream(buttons_play_png, sizeof(buttons_play_png));
97     wxImage button_play_pngi(istream, wxBITMAP_TYPE_PNG);
98     wxBitmap playiconbmp(button_play_pngi, -1);
99     btnPlay->SetBitmapLabel(playiconbmp);
100     
101     wxMemoryInputStream istream2(buttons_stop_png, sizeof(buttons_stop_png));
102     wxImage button_stop_pngi(istream2, wxBITMAP_TYPE_PNG);
103     wxBitmap stopiconbmp(button_stop_pngi, -1);
104     btnStop->SetBitmapLabel(stopiconbmp);
105     btnStop->Disable();
106     FMTimer.SetupPointers(this);
107     //wxIcon contacticon;
108     //contacticon.CopyFromBitmap(contacticonbmp);
109     
112 void frmContactEditor::AddGeneralNickname( wxCommandEvent& event )
114     int intResult = 0;
115     
116     frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
117     frameCENickname->SetEditorMode(FALSE, CE_GENERAL);
118     intResult = GetLastInt(&GeneralNicknamesList);
119     frameCENickname->SetupPointers(&GeneralNicknamesList,
120                                    &GeneralNicknamesListAltID,
121                                    &GeneralNicknamesListPID,
122                                    &GeneralNicknamesListType,
123                                    &GeneralNicknamesListLanguage,
124                                    &GeneralNicknamesListTokens,
125                                    &GeneralNicknamesListPref,
126                                    lboNicknames,
127                                    (intValueSeek));
128     frameCENickname->ShowModal();
129     delete frameCENickname;
130     frameCENickname = NULL;
133 void frmContactEditor::ModifyGeneralNickname( wxCommandEvent& event )
135     
136     long longSelected = -1;
137     int intSelectedData = 0;
138     
139     if (!GetSelectedItem(lboNicknames,
140                          &longSelected,
141                          &intSelectedData)){
142         return;
143     }
144     
145     frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
146     frameCENickname->SetupPointers(&GeneralNicknamesList,
147                                    &GeneralNicknamesListAltID,
148                                    &GeneralNicknamesListPID,
149                                    &GeneralNicknamesListType,
150                                    &GeneralNicknamesListLanguage,
151                                    &GeneralNicknamesListTokens,
152                                    &GeneralNicknamesListPref,
153                                    lboNicknames,
154                                    intSelectedData);
155     frameCENickname->SetEditorMode(TRUE, CE_GENERAL);
156     frameCENickname->ShowModal();
157     delete frameCENickname;
158     frameCENickname = NULL;
159     
162 void frmContactEditor::DeleteGeneralNickname( wxCommandEvent& event )
164     
165     long longSelected = -1;
166     int intSelectedData = 0;
167     
168     if (!GetSelectedItem(lboNicknames,
169                          &longSelected,
170                          &intSelectedData)){
171         return;
172     }
173     
174     lboNicknames->DeleteItem(longSelected);
175     
176     DeleteMapData(intSelectedData,
177                   &GeneralNicknamesList,
178                   &GeneralNicknamesListLanguage,
179                   &GeneralNicknamesListAltID,
180                   &GeneralNicknamesListPID,
181                   &GeneralNicknamesListTokens,
182                   &GeneralNicknamesListType,
183                   &GeneralNicknamesListPref);
184     
187 void frmContactEditor::AddGeneralAddress( wxCommandEvent& event )
189     
190     int intResult = 0;
191     
192     frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
193     frameCEAddress->SetEditorMode(FALSE, CE_GENERAL);
194     intResult = GetLastInt(&GeneralAddressList);
195     frameCEAddress->SetupPointers(&GeneralAddressList,
196                                   &GeneralAddressListTown,
197                                   &GeneralAddressListCounty,
198                                   &GeneralAddressListPostCode,
199                                   &GeneralAddressListCountry,
200                                   &GeneralAddressListLabel,
201                                   &GeneralAddressListLang,
202                                   &GeneralAddressListAltID,
203                                   &GeneralAddressListPID,
204                                   &GeneralAddressListTokens,
205                                   &GeneralAddressListGeo,
206                                   &GeneralAddressListTimezone,
207                                   &GeneralAddressListType,
208                                   &GeneralAddressListMediatype,
209                                   &GeneralAddressListPref,
210                                   lboAddresses,
211                                   (intValueSeek));
212     frameCEAddress->ShowModal();
213     delete frameCEAddress;
214     frameCEAddress = NULL;
217 void frmContactEditor::ModifyGeneralAddress( wxCommandEvent& event )
219     
220     long longSelected = -1;
221     int intSelectedData = 0;
222     
223     if (!GetSelectedItem(lboAddresses,
224                          &longSelected,
225                          &intSelectedData)){
226         return;
227     }
228     
229     if (longSelected == -1){
230         return;
231     }
232     
233     frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
234     frameCEAddress->SetupPointers(&GeneralAddressList,
235                                   &GeneralAddressListTown,
236                                   &GeneralAddressListCounty,
237                                   &GeneralAddressListPostCode,
238                                   &GeneralAddressListCountry,
239                                   &GeneralAddressListLabel,
240                                   &GeneralAddressListLang,
241                                   &GeneralAddressListAltID,
242                                   &GeneralAddressListPID,
243                                   &GeneralAddressListTokens,
244                                   &GeneralAddressListGeo,
245                                   &GeneralAddressListTimezone,
246                                   &GeneralAddressListType,
247                                   &GeneralAddressListMediatype,
248                                   &GeneralAddressListPref,
249                                   lboAddresses,
250                                   intSelectedData);
251     frameCEAddress->SetEditorMode(TRUE, CE_GENERAL);
252     frameCEAddress->ShowModal();
253     delete frameCEAddress;
254     frameCEAddress = NULL;
255     
258 void frmContactEditor::DeleteGeneralAddress( wxCommandEvent& event )
260     
261     long longSelected = -1;
262     int intSelectedData = 0;
263     
264     if (!GetSelectedItem(lboAddresses,
265                          &longSelected,
266                          &intSelectedData)){
267         return;
268     }
269     
270     lboAddresses->DeleteItem(longSelected);
271     
272     DeleteMapData(intSelectedData, &GeneralAddressList,
273                   &GeneralAddressListTown, &GeneralAddressListCounty,
274                   &GeneralAddressListPostCode, &GeneralAddressListCountry,
275                   &GeneralAddressList, &GeneralAddressListLabel,
276                   &GeneralAddressListLang, &GeneralAddressListAltID,
277                   &GeneralAddressListPID, &GeneralAddressListTokens,
278                   &GeneralAddressListGeo, &GeneralAddressListTimezone,
279                   &GeneralAddressListType, &GeneralAddressListMediatype,
280                   &GeneralAddressListPref);
281     
284 void frmContactEditor::AddGeneralEmail( wxCommandEvent& event )
286     int intResult = 0;
287     
288     frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
289     frameCEEmail->SetEditorMode(FALSE, CE_GENERAL);
290     intResult = GetLastInt(&GeneralAddressList);
291     frameCEEmail->SetupPointers(&GeneralEmailList,
292                                 &GeneralEmailListAltID,
293                                 &GeneralEmailListPID,
294                                 &GeneralEmailListType,
295                                 &GeneralEmailListTokens,
296                                 &GeneralEmailListPref,
297                                 lboEmails,
298                                 (intValueSeek));
299     frameCEEmail->ShowModal();
300     delete frameCEEmail;
301     frameCEEmail = NULL;
304 void frmContactEditor::ModifyGeneralEmail( wxCommandEvent& event )
306     long longSelected = -1;
307     int intSelectedData = 0;
308     
309     if (!GetSelectedItem(lboEmails,
310                          &longSelected,
311                          &intSelectedData)){
312         return;
313     }
314     
315     frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
316     frameCEEmail->SetupPointers(&GeneralEmailList,
317                                 &GeneralEmailListAltID,
318                                 &GeneralEmailListPID,
319                                 &GeneralEmailListType,
320                                 &GeneralEmailListTokens,
321                                 &GeneralEmailListPref,
322                                 lboEmails,
323                                 intSelectedData);
324     frameCEEmail->SetEditorMode(TRUE, CE_GENERAL);
325     frameCEEmail->ShowModal();
326     delete frameCEEmail;
327     frameCEEmail = NULL;
330 void frmContactEditor::DeleteGeneralEmail( wxCommandEvent& event )
332     long longSelected = -1;
333     int intSelectedData = 0;
334     
335     if (!GetSelectedItem(lboEmails,
336                          &longSelected,
337                          &intSelectedData)){
338         return;
339     }
340     
341     lboEmails->DeleteItem(longSelected);
342     
343     DeleteMapData(intSelectedData, &GeneralEmailList,
344                   &GeneralEmailListAltID, &GeneralEmailListPID,
345                   &GeneralEmailListType, &GeneralEmailListTokens,
346                   &GeneralEmailListPref);
347     
350 void frmContactEditor::AddGeneralIM( wxCommandEvent& event )
352     int intResult = 0;
353     
354     frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
355     frameCEIM->SetEditorMode(FALSE, CE_GENERAL);
356     intResult = GetLastInt(&GeneralIMList);
357     frameCEIM->SetupPointers(&GeneralIMList,
358                              &GeneralIMListAltID,
359                              &GeneralIMListPID,
360                              &GeneralIMListType,
361                              &GeneralIMListTokens,
362                              &GeneralIMListMediatype,
363                              &GeneralIMListPref,
364                              lboIM,
365                              (intValueSeek));
366     frameCEIM->ShowModal();
367     delete frameCEIM;
368     frameCEIM = NULL;
371 void frmContactEditor::ModifyGeneralIM( wxCommandEvent& event )
373     long longSelected = -1;
374     int intSelectedData = 0;
375     
376     if (!GetSelectedItem(lboIM,
377                          &longSelected,
378                          &intSelectedData)){
379         return;
380     }
381     
382     frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
383     frameCEIM->SetupPointers(&GeneralIMList,
384                              &GeneralIMListAltID,
385                              &GeneralIMListPID,
386                              &GeneralIMListType,
387                              &GeneralIMListTokens,
388                              &GeneralIMListMediatype,
389                              &GeneralIMListPref,
390                              lboIM,
391                              intSelectedData);
392     frameCEIM->SetEditorMode(TRUE, CE_GENERAL);
393     frameCEIM->ShowModal();
394     delete frameCEIM;
395     frameCEIM = NULL;
398 void frmContactEditor::DeleteGeneralIM( wxCommandEvent& event )
400     long longSelected = -1;
401     int intSelectedData = 0;
402     
403     if (!GetSelectedItem(lboIM,
404                          &longSelected,
405                          &intSelectedData)){
406         return;
407     }
408     
409     lboIM->DeleteItem(longSelected);
410     
411     DeleteMapData(intSelectedData, &GeneralIMList,
412                   &GeneralIMListAltID, &GeneralIMListPID,
413                   &GeneralIMListType, &GeneralIMListTokens,
414                   &GeneralIMListMediatype, &GeneralIMListPref);
415     
418 void frmContactEditor::AddGeneralTelephone( wxCommandEvent& event )
420     int intResult = 0;
421     
422     frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
423     frameCETel->SetEditorMode(FALSE, CE_GENERAL);
424     intResult = GetLastInt(&GeneralTelephoneList);
425     frameCETel->SetupPointers(&GeneralTelephoneList,
426                               &GeneralTelephoneListAltID,
427                               &GeneralTelephoneListPID,
428                               &GeneralTelephoneListType,
429                               &GeneralTelephoneListTokens,
430                               &GeneralTelephoneListPref,
431                               lboTelephone,
432                               (intValueSeek));
433     frameCETel->ShowModal();
434     delete frameCETel;
435     frameCETel = NULL;
438 void frmContactEditor::ModifyGeneralTelephone( wxCommandEvent& event )
440     long longSelected = -1;
441     int intSelectedData = 0;
442     
443     if (!GetSelectedItem(lboTelephone,
444                          &longSelected,
445                          &intSelectedData)){
446         return;
447     }
448     
449     frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
450     frameCETel->SetupPointers(&GeneralTelephoneList,
451                               &GeneralTelephoneListAltID,
452                               &GeneralTelephoneListPID,
453                               &GeneralTelephoneListType,
454                               &GeneralTelephoneListTokens,
455                               &GeneralTelephoneListPref,
456                               lboTelephone,
457                               intSelectedData);
458     frameCETel->SetEditorMode(TRUE, CE_GENERAL);
459     frameCETel->ShowModal();
460     delete frameCETel;
461     frameCETel = NULL;
464 void frmContactEditor::DeleteGeneralTelephone( wxCommandEvent& event )
466     long longSelected = -1;
467     int intSelectedData = 0;
468     
469     if (!GetSelectedItem(lboTelephone,
470                          &longSelected,
471                          &intSelectedData)){
472         return;
473     }
474     
475     lboTelephone->DeleteItem(longSelected);
476     
477     DeleteMapData(intSelectedData, &GeneralTelephoneList,
478                   &GeneralTelephoneListAltID, &GeneralTelephoneListPID,
479                   &GeneralTelephoneListType, &GeneralTelephoneListTokens,
480                   &GeneralTelephoneListPref);
481     
484 void frmContactEditor::AddGeneralLanguages( wxCommandEvent& event )
486     int intResult = 0;
487     
488     frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
489     frameCELang->SetEditorMode(FALSE, CE_GENERAL);
490     intResult = GetLastInt(&GeneralLanguageList);
491     frameCELang->SetupPointers(&GeneralLanguageList,
492                                &GeneralLanguageListAltID,
493                                &GeneralLanguageListPID,
494                                &GeneralLanguageListType,
495                                &GeneralLanguageListTokens,
496                                &GeneralLanguageListPref,
497                                lboLanguages,
498                                (intValueSeek));
499     frameCELang->ShowModal();
500     delete frameCELang;
501     frameCELang = NULL;
504 void frmContactEditor::ModifyGeneralLanguages( wxCommandEvent& event )
506     long longSelected = -1;
507     int intSelectedData = 0;
508     
509     if (!GetSelectedItem(lboLanguages,
510                          &longSelected,
511                          &intSelectedData)){
512         return;
513     }
514     
515     frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
516     frameCELang->SetupPointers(&GeneralLanguageList,
517                                &GeneralLanguageListAltID,
518                                &GeneralLanguageListPID,
519                                &GeneralLanguageListType,
520                                &GeneralLanguageListTokens,
521                                &GeneralLanguageListPref,
522                                lboLanguages,
523                                intSelectedData);
524     frameCELang->SetEditorMode(TRUE, CE_GENERAL);
525     frameCELang->ShowModal();
526     delete frameCELang;
527     frameCELang = NULL;
530 void frmContactEditor::DeleteGeneralLanguage( wxCommandEvent& event )
532     long longSelected = -1;
533     int intSelectedData = 0;
534     
535     if (!GetSelectedItem(lboLanguages,
536                          &longSelected,
537                          &intSelectedData)){
538         return;
539     }
540     
541     lboLanguages->DeleteItem(longSelected);
542     
543     DeleteMapData(intSelectedData, &GeneralLanguageList,
544                   &GeneralLanguageListAltID, &GeneralLanguageListPID,
545                   &GeneralLanguageListType, &GeneralLanguageListTokens,
546                   &GeneralLanguageListPref);
547     
550 void frmContactEditor::AddGeneralTimezone( wxCommandEvent& event )
552     int intResult = 0;
553     
554     frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
555     frameCETZ->SetEditorMode(FALSE, CE_GENERAL);
556     intResult = GetLastInt(&GeneralTZList);
557     frameCETZ->SetupPointers(&GeneralTZList,
558                              &GeneralTZListAltID,
559                              &GeneralTZListPID,
560                              &GeneralTZListType,
561                              &GeneralTZListTokens,
562                              &GeneralTZListMediatype,
563                              &GeneralTZListPref,
564                              lboTimezones,
565                              (intValueSeek));
566     frameCETZ->ShowModal();
567     delete frameCETZ;
568     frameCETZ = NULL;
571 void frmContactEditor::ModifyGeneralTimezone( wxCommandEvent& event )
573     long longSelected = -1;
574     int intSelectedData = 0;
575     
576     if (!GetSelectedItem(lboTimezones,
577                          &longSelected,
578                          &intSelectedData)){
579         return;
580     }
581     
582     frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
583     frameCETZ->SetupPointers(&GeneralTZList,
584                              &GeneralTZListAltID,
585                              &GeneralTZListPID,
586                              &GeneralTZListType,
587                              &GeneralTZListTokens,
588                              &GeneralTZListMediatype,
589                              &GeneralTZListPref,
590                              lboTimezones,
591                              intSelectedData);
592     frameCETZ->SetEditorMode(TRUE, CE_GENERAL);
593     frameCETZ->ShowModal();
594     delete frameCETZ;
595     frameCETZ = NULL;
598 void frmContactEditor::DeleteGeneralTimezone( wxCommandEvent& event )
600     long longSelected = -1;
601     int intSelectedData = 0;
602     
603     if (!GetSelectedItem(lboTimezones,
604                          &longSelected,
605                          &intSelectedData)){
606         return;
607     }
608     
609     lboTimezones->DeleteItem(longSelected);
610     
611     DeleteMapData(intSelectedData, &GeneralTZList,
612                   &GeneralTZListAltID, &GeneralTZListPID,
613                   &GeneralTZListType, &GeneralTZListTokens,
614                   &GeneralTZListMediatype, &GeneralTZListPref);
615     
618 void frmContactEditor::AddGeneralGeoposition( wxCommandEvent& event )
620     int intResult = 0;
621     
622     frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
623     frameCEGeo->SetEditorMode(FALSE, CE_GENERAL);
624     intResult = GetLastInt(&GeneralGeographyList);
625     frameCEGeo->SetupPointers(&GeneralGeographyList,
626                               &GeneralGeographyListAltID,
627                               &GeneralGeographyListPID,
628                               &GeneralGeographyListType,
629                               &GeneralGeographyListTokens,
630                               &GeneralGeographyListMediatype,
631                               &GeneralGeographyListPref,
632                               lboGeoposition,
633                               (intValueSeek));
634     frameCEGeo->ShowModal();
635     delete frameCEGeo;
636     frameCEGeo = NULL;
639 void frmContactEditor::ModifyGeneralGeoposition( wxCommandEvent& event )
641     long longSelected = -1;
642     int intSelectedData = 0;
643     
644     if (!GetSelectedItem(lboGeoposition,
645                          &longSelected,
646                          &intSelectedData)){
647         return;
648     }
649     
650     frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
651     frameCEGeo->SetupPointers(&GeneralGeographyList,
652                               &GeneralGeographyListAltID,
653                               &GeneralGeographyListPID,
654                               &GeneralGeographyListType,
655                               &GeneralGeographyListTokens,
656                               &GeneralGeographyListMediatype,
657                               &GeneralGeographyListPref,
658                               lboGeoposition,
659                               intSelectedData);
660     frameCEGeo->SetEditorMode(TRUE, CE_GENERAL);
661     frameCEGeo->ShowModal();
662     delete frameCEGeo;
663     frameCEGeo = NULL;
666 void frmContactEditor::DeleteGeneralGeoposition( wxCommandEvent& event )
668     long longSelected = -1;
669     int intSelectedData = 0;
670     
671     if (!GetSelectedItem(lboGeoposition,
672                          &longSelected,
673                          &intSelectedData)){
674         return;
675     }
676     
677     lboGeoposition->DeleteItem(longSelected);
678     
679     DeleteMapData(intSelectedData, &GeneralGeographyList,
680                   &GeneralGeographyListAltID, &GeneralGeographyListPID,
681                   &GeneralGeographyListType, &GeneralGeographyListTokens,
682                   &GeneralGeographyListMediatype, &GeneralGeographyListPref);
683     
686 void frmContactEditor::AddGeneralRelated( wxCommandEvent& event )
688     int intResult = 0;
689     
690     frmContactEditorRelated *frameCERel = new frmContactEditorRelated ( this );
691     frameCERel->SetEditorMode(FALSE, CE_GENERAL);
692     intResult = GetLastInt(&GeneralRelatedList);
693     frameCERel->SetupPointers(&GeneralRelatedList,
694                               &GeneralRelatedListRelType,
695                               &GeneralRelatedListAltID,
696                               &GeneralRelatedListPID,
697                               &GeneralRelatedListType,
698                               &GeneralRelatedListTokens,
699                               &GeneralRelatedListPref,
700                               lboRelated,
701                               (intValueSeek));
702     frameCERel->ShowModal();
703     delete frameCERel;
704     frameCERel = NULL;
707 void frmContactEditor::ModifyGeneralRelated( wxCommandEvent& event )
709     long longSelected = -1;
710     int intSelectedData = 0;
711     
712     if (!GetSelectedItem(lboRelated,
713                          &longSelected,
714                          &intSelectedData)){
715         return;
716     }
717     
718     frmContactEditorRelated *frameCERel = new frmContactEditorRelated ( this );
719     frameCERel->SetupPointers(&GeneralRelatedList,
720                               &GeneralRelatedListRelType,
721                               &GeneralRelatedListAltID,
722                               &GeneralRelatedListPID,
723                               &GeneralRelatedListType,
724                               &GeneralRelatedListTokens,
725                               &GeneralRelatedListPref,
726                               lboRelated,
727                               intSelectedData);
728     frameCERel->SetEditorMode(TRUE, CE_GENERAL);
729     frameCERel->ShowModal();
730     delete frameCERel;
731     frameCERel = NULL;
734 void frmContactEditor::DeleteGeneralRelated( wxCommandEvent& event )
736     long longSelected = -1;
737     int intSelectedData = 0;
738     
739     if (!GetSelectedItem(lboRelated,
740                          &longSelected,
741                          &intSelectedData)){
742         return;
743     }
744     
745     lboRelated->DeleteItem(longSelected);
746     
747     GeneralRelatedList.erase(intSelectedData);
748     GeneralRelatedListRelType.erase(intSelectedData);
749     GeneralRelatedListAltID.erase(intSelectedData);
750     GeneralRelatedListPID.erase(intSelectedData);
751     GeneralRelatedListType.erase(intSelectedData);
752     GeneralRelatedListTokens.erase(intSelectedData);
753     GeneralRelatedListPref.erase(intSelectedData);
756 void frmContactEditor::AddGeneralWebsite( wxCommandEvent& event )
758     int intResult = 0;
759     
760     frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
761     frameCEWeb->SetEditorMode(FALSE, CE_GENERAL);
762     intResult = GetLastInt(&GeneralWebsiteList);
763     frameCEWeb->SetupPointers(&GeneralWebsiteList,
764                               &GeneralWebsiteListAltID,
765                               &GeneralWebsiteListPID,
766                               &GeneralWebsiteListType,
767                               &GeneralWebsiteListTokens,
768                               &GeneralWebsiteListMediatype,
769                               &GeneralWebsiteListPref,
770                               lboWebsites,
771                               (intValueSeek));
772     frameCEWeb->ShowModal();
773     delete frameCEWeb;
774     frameCEWeb = NULL;
777 void frmContactEditor::ModifyGeneralWebsite( wxCommandEvent& event )
779     long longSelected = -1;
780     int intSelectedData = 0;
781     
782     if (!GetSelectedItem(lboWebsites,
783                          &longSelected,
784                          &intSelectedData)){
785         return;
786     }
787     
788     frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
789     frameCEWeb->SetupPointers(&GeneralWebsiteList,
790                               &GeneralWebsiteListAltID,
791                               &GeneralWebsiteListPID,
792                               &GeneralWebsiteListType,
793                               &GeneralWebsiteListTokens,
794                               &GeneralWebsiteListMediatype,
795                               &GeneralWebsiteListPref,
796                               lboWebsites,
797                               intSelectedData);
798     frameCEWeb->SetEditorMode(TRUE, CE_GENERAL);
799     frameCEWeb->ShowModal();
800     delete frameCEWeb;
801     frameCEWeb = NULL;
804 void frmContactEditor::DeleteGeneralWebsite( wxCommandEvent& event )
806     long longSelected = -1;
807     int intSelectedData = 0;
808     
809     if (!GetSelectedItem(lboWebsites,
810                          &longSelected,
811                          &intSelectedData)){
812         return;
813     }
814     
815     lboWebsites->DeleteItem(longSelected);
816     
817     DeleteMapData(intSelectedData, &GeneralWebsiteList,
818                   &GeneralWebsiteListAltID, &GeneralWebsiteListPID,
819                   &GeneralWebsiteListType, &GeneralWebsiteListTokens,
820                   &GeneralWebsiteListMediatype, &GeneralWebsiteListPref);
821     
824 void frmContactEditor::AddGeneralTitle( wxCommandEvent& event )
826     int intResult = 0;
827     
828     frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
829     frameCETitle->SetEditorMode(FALSE, CE_GENERAL);
830     intResult = GetLastInt(&GeneralTitleList);
831     frameCETitle->SetupPointers(&GeneralTitleList,
832                                 &GeneralTitleListLanguage,
833                                 &GeneralTitleListAltID,
834                                 &GeneralTitleListPID,
835                                 &GeneralTitleListType,
836                                 &GeneralTitleListTokens,
837                                 &GeneralTitleListPref,
838                                 lboTitles,
839                                 (intValueSeek));
840     frameCETitle->ShowModal();
841     delete frameCETitle;
842     frameCETitle = NULL;
845 void frmContactEditor::ModifyGeneralTitle( wxCommandEvent& event )
847     long longSelected = -1;
848     int intSelectedData = 0;
849     
850     if (!GetSelectedItem(lboTitles,
851                          &longSelected,
852                          &intSelectedData)){
853         return;
854     }
855     
856     frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
857     frameCETitle->SetupPointers(&GeneralTitleList,
858                                 &GeneralTitleListLanguage,
859                                 &GeneralTitleListAltID,
860                                 &GeneralTitleListPID,
861                                 &GeneralTitleListType,
862                                 &GeneralTitleListTokens,
863                                 &GeneralTitleListPref,
864                                 lboTitles,
865                                 intSelectedData);
866     frameCETitle->SetEditorMode(TRUE, CE_GENERAL);
867     frameCETitle->ShowModal();
868     delete frameCETitle;
869     frameCETitle = NULL;
872 void frmContactEditor::DeleteGeneralTitle( wxCommandEvent& event )
874     long longSelected = -1;
875     int intSelectedData = 0;
876     
877     if (!GetSelectedItem(lboTitles,
878                          &longSelected,
879                          &intSelectedData)){
880         return;
881     }
882     
883     lboTitles->DeleteItem(longSelected);
884     
885     DeleteMapData(intSelectedData, &GeneralTitleList,
886                   &GeneralTitleListLanguage, &GeneralTitleListAltID,
887                   &GeneralTitleListPID, &GeneralTitleListType,
888                   &GeneralTitleListTokens, &GeneralTitleListPref);
889     
892 void frmContactEditor::AddGeneralRole( wxCommandEvent& event )
894     int intResult = 0;
895     
896     frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
897     frameCERole->SetEditorMode(FALSE, CE_GENERAL);
898     intResult = GetLastInt(&GeneralRoleList);
899     frameCERole->SetupPointers(&GeneralRoleList,
900                                &GeneralRoleListLanguage,
901                                &GeneralRoleListAltID,
902                                &GeneralRoleListPID,
903                                &GeneralRoleListType,
904                                &GeneralRoleListTokens,
905                                &GeneralRoleListPref,
906                                lboRoles,
907                                (intValueSeek));
908     frameCERole->ShowModal();
909     delete frameCERole;
910     frameCERole = NULL;
913 void frmContactEditor::ModifyGeneralRole( wxCommandEvent& event )
915     long longSelected = -1;
916     int intSelectedData = 0;
917     
918     if (!GetSelectedItem(lboRoles,
919                          &longSelected,
920                          &intSelectedData)){
921         return;
922     }
923     
924     frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
925     frameCERole->SetupPointers(&GeneralRoleList,
926                                &GeneralRoleListLanguage,
927                                &GeneralRoleListAltID,
928                                &GeneralRoleListPID,
929                                &GeneralRoleListType,
930                                &GeneralRoleListTokens,
931                                &GeneralRoleListPref,
932                                lboRoles,
933                                intSelectedData);
934     frameCERole->SetEditorMode(TRUE, CE_GENERAL);
935     frameCERole->ShowModal();
936     delete frameCERole;
937     frameCERole = NULL;
940 void frmContactEditor::DeleteGeneralRole( wxCommandEvent& event )
942     long longSelected = -1;
943     int intSelectedData = 0;
944     
945     if (!GetSelectedItem(lboRoles,
946                          &longSelected,
947                          &intSelectedData)){
948         return;
949     }
950     
951     lboRoles->DeleteItem(longSelected);
952     
953     DeleteMapData(intSelectedData, &GeneralRoleList,
954                   &GeneralRoleListLanguage, &GeneralRoleListAltID,
955                   &GeneralRoleListPID, &GeneralRoleListType,
956                   &GeneralRoleListTokens, &GeneralRoleListPref);
957     
960 void frmContactEditor::AddGeneralOrganisation( wxCommandEvent& event )
962     int intResult = 0;
963     
964     frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
965     frameCEOrg->SetEditorMode(FALSE, CE_GENERAL);
966     intResult = GetLastInt(&GeneralOrganisationsList);
967     frameCEOrg->SetupPointers(&GeneralOrganisationsList,
968                               &GeneralOrganisationsListLanguage,
969                               &GeneralOrganisationsListSortAs,
970                               &GeneralOrganisationsListAltID,
971                               &GeneralOrganisationsListPID,
972                               &GeneralOrganisationsListType,
973                               &GeneralOrganisationsListTokens,
974                               &GeneralOrganisationsListPref,
975                               lboOrganisations,
976                               (intValueSeek));
977     frameCEOrg->ShowModal();
978     delete frameCEOrg;
979     frameCEOrg = NULL;
982 void frmContactEditor::ModifyGeneralOrganisation( wxCommandEvent& event )
984     long longSelected = -1;
985     int intSelectedData = 0;
986     
987     if (!GetSelectedItem(lboOrganisations,
988                          &longSelected,
989                          &intSelectedData)){
990         return;
991     }
992     
993     frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
994     frameCEOrg->SetupPointers(&GeneralOrganisationsList,
995                               &GeneralOrganisationsListLanguage,
996                               &GeneralOrganisationsListSortAs,
997                               &GeneralOrganisationsListAltID,
998                               &GeneralOrganisationsListPID,
999                               &GeneralOrganisationsListType,
1000                               &GeneralOrganisationsListTokens,
1001                               &GeneralOrganisationsListPref,
1002                               lboOrganisations,
1003                               intSelectedData);
1004     frameCEOrg->SetEditorMode(TRUE, CE_GENERAL);
1005     frameCEOrg->ShowModal();
1006     delete frameCEOrg;
1007     frameCEOrg = NULL;
1010 void frmContactEditor::DeleteGeneralOrganisation( wxCommandEvent& event )
1012     long longSelected = -1;
1013     int intSelectedData = 0;
1014     
1015     if (!GetSelectedItem(lboOrganisations,
1016                          &longSelected,
1017                          &intSelectedData)){
1018         return;
1019     }
1020     
1021     lboOrganisations->DeleteItem(longSelected);
1022     
1023     DeleteMapData(intSelectedData, &GeneralOrganisationsList,
1024                   &GeneralOrganisationsListLanguage, &GeneralOrganisationsListSortAs,
1025                   &GeneralOrganisationsListAltID, &GeneralOrganisationsListPID,
1026                   &GeneralOrganisationsListType, &GeneralOrganisationsListTokens,
1027                   &GeneralOrganisationsListPref);
1028     
1031 void frmContactEditor::AddGeneralNote( wxCommandEvent& event )
1033     int intResult = 0;
1034     
1035     frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
1036     frameCENote->SetEditorMode(FALSE, CE_GENERAL);
1037     intResult = GetLastInt(&GeneralNoteList);
1038     frameCENote->SetupPointers(&GeneralNoteList,
1039                                &GeneralNoteListLanguage,
1040                                &GeneralNoteListAltID,
1041                                &GeneralNoteListPID,
1042                                &GeneralNoteListType,
1043                                &GeneralNoteListTokens,
1044                                &GeneralNoteListPref,
1045                                lboNotes,
1046                                (intValueSeek));
1047     frameCENote->ShowModal();
1048     delete frameCENote;
1049     frameCENote = NULL;
1052 void frmContactEditor::ModifyGeneralNote( wxCommandEvent& event )
1054     long longSelected = -1;
1055     int intSelectedData = 0;
1056     
1057     if (!GetSelectedItem(lboNotes,
1058                          &longSelected,
1059                          &intSelectedData)){
1060         return;
1061     }
1062     
1063     frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
1064     frameCENote->SetupPointers(&GeneralNoteList,
1065                                &GeneralNoteListLanguage,
1066                                &GeneralNoteListAltID,
1067                                &GeneralNoteListPID,
1068                                &GeneralNoteListType,
1069                                &GeneralNoteListTokens,
1070                                &GeneralNoteListPref,
1071                                lboNotes,
1072                                intSelectedData);
1073     frameCENote->SetEditorMode(TRUE, CE_GENERAL);
1074     frameCENote->ShowModal();
1075     delete frameCENote;
1076     frameCENote = NULL;
1079 void frmContactEditor::DeleteGeneralNote( wxCommandEvent& event )
1081     long longSelected = -1;
1082     int intSelectedData = 0;
1083     
1084     if (!GetSelectedItem(lboNotes,
1085                          &longSelected,
1086                          &intSelectedData)){
1087         return;
1088     }
1089     
1090     lboNotes->DeleteItem(longSelected);
1091     
1092     DeleteMapData(intSelectedData, &GeneralNoteList,
1093                   &GeneralNoteListLanguage, &GeneralNoteListAltID,
1094                   &GeneralNoteListPID, &GeneralNoteListType,
1095                   &GeneralNoteListTokens, &GeneralNoteListPref);
1096     
1099 void frmContactEditor::AddHomeNickname( wxCommandEvent& event )
1101     int intResult = 0;
1102     
1103     frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
1104     frameCENickname->SetEditorMode(FALSE, CE_HOME);
1105     intResult = GetLastInt(&HomeNicknamesList);
1106     frameCENickname->SetupPointers(&HomeNicknamesList,
1107                                    &HomeNicknamesListAltID,
1108                                    &HomeNicknamesListPID,
1109                                    &HomeNicknamesListType,
1110                                    &HomeNicknamesListLanguage,
1111                                    &HomeNicknamesListTokens,
1112                                    &HomeNicknamesListPref,
1113                                    lboHomeNicknames,
1114                                    (intValueSeek));
1115     frameCENickname->ShowModal();
1116     delete frameCENickname;
1117     frameCENickname = NULL;
1120 void frmContactEditor::ModifyHomeNickname( wxCommandEvent& event )
1122     long longSelected = -1;
1123     int intSelectedData = 0;
1124     
1125     if (!GetSelectedItem(lboHomeNicknames,
1126                          &longSelected,
1127                          &intSelectedData)){
1128         return;
1129     }
1130     
1131     frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
1132     frameCENickname->SetupPointers(&HomeNicknamesList,
1133                                    &HomeNicknamesListAltID,
1134                                    &HomeNicknamesListPID,
1135                                    &HomeNicknamesListType,
1136                                    &HomeNicknamesListLanguage,
1137                                    &HomeNicknamesListTokens,
1138                                    &HomeNicknamesListPref,
1139                                    lboHomeNicknames,
1140                                    intSelectedData);
1141     frameCENickname->SetEditorMode(TRUE, CE_HOME);
1142     frameCENickname->ShowModal();
1143     delete frameCENickname;
1144     frameCENickname = NULL;
1147 void frmContactEditor::DeleteHomeNickname( wxCommandEvent& event )
1149     
1150     long longSelected = -1;
1151     int intSelectedData = 0;
1152     
1153     if (!GetSelectedItem(lboHomeNicknames,
1154                          &longSelected,
1155                          &intSelectedData)){
1156         return;
1157     }
1158     
1159     lboHomeNicknames->DeleteItem(longSelected);
1160     
1161     DeleteMapData(intSelectedData,
1162                   &HomeNicknamesList,
1163                   &HomeNicknamesListLanguage,
1164                   &HomeNicknamesListAltID,
1165                   &HomeNicknamesListPID,
1166                   &HomeNicknamesListTokens,
1167                   &HomeNicknamesListType,
1168                   &HomeNicknamesListPref);
1169     
1172 void frmContactEditor::AddHomeAddress( wxCommandEvent& event )
1174     int intResult = 0;
1175     
1176     frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
1177     frameCEAddress->SetEditorMode(FALSE, CE_HOME);
1178     intResult = GetLastInt(&HomeAddressList);
1179     frameCEAddress->SetupPointers(&HomeAddressList,
1180                                   &HomeAddressListTown,
1181                                   &HomeAddressListCounty,
1182                                   &HomeAddressListPostCode,
1183                                   &HomeAddressListCountry,
1184                                   &HomeAddressListLabel,
1185                                   &HomeAddressListLang,
1186                                   &HomeAddressListAltID,
1187                                   &HomeAddressListPID,
1188                                   &HomeAddressListTokens,
1189                                   &HomeAddressListGeo,
1190                                   &HomeAddressListTimezone,
1191                                   &HomeAddressListType,
1192                                   &HomeAddressListMediatype,
1193                                   &HomeAddressListPref,
1194                                   lboHomeAddresses,
1195                                   (intValueSeek));
1196     frameCEAddress->ShowModal();
1197     delete frameCEAddress;
1198     frameCEAddress = NULL;
1201 void frmContactEditor::ModifyHomeAddress( wxCommandEvent& event )
1203     long longSelected = -1;
1204     int intSelectedData = 0;
1205     
1206     if (!GetSelectedItem(lboHomeAddresses,
1207                          &longSelected,
1208                          &intSelectedData)){
1209         return;
1210     }
1211     
1212     frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
1213     frameCEAddress->SetupPointers(&HomeAddressList,
1214                                   &HomeAddressListTown,
1215                                   &HomeAddressListCounty,
1216                                   &HomeAddressListPostCode,
1217                                   &HomeAddressListCountry,
1218                                   &HomeAddressListLabel,
1219                                   &HomeAddressListLang,
1220                                   &HomeAddressListAltID,
1221                                   &HomeAddressListPID,
1222                                   &HomeAddressListTokens,
1223                                   &HomeAddressListGeo,
1224                                   &HomeAddressListTimezone,
1225                                   &HomeAddressListType,
1226                                   &HomeAddressListMediatype,
1227                                   &HomeAddressListPref,
1228                                   lboHomeAddresses,
1229                                   intSelectedData);
1230     frameCEAddress->SetEditorMode(TRUE, CE_HOME);
1231     frameCEAddress->ShowModal();
1232     delete frameCEAddress;
1233     frameCEAddress = NULL;
1236 void frmContactEditor::DeleteHomeAddress( wxCommandEvent& event )
1238     
1239     long longSelected = -1;
1240     int intSelectedData = 0;
1241     
1242     if (!GetSelectedItem(lboHomeAddresses,
1243                          &longSelected,
1244                          &intSelectedData)){
1245         return;
1246     }
1247     
1248     lboHomeAddresses->DeleteItem(longSelected);
1249     
1250     DeleteMapData(intSelectedData, &HomeAddressList,
1251                   &HomeAddressListTown, &HomeAddressListCounty,
1252                   &HomeAddressListPostCode, &HomeAddressListCountry,
1253                   &HomeAddressList, &HomeAddressListLabel,
1254                   &HomeAddressListLang, &HomeAddressListAltID,
1255                   &HomeAddressListPID, &HomeAddressListTokens,
1256                   &HomeAddressListGeo, &HomeAddressListTimezone,
1257                   &HomeAddressListType, &HomeAddressListMediatype,
1258                   &HomeAddressListPref);
1259     
1262 void frmContactEditor::AddHomeEmail( wxCommandEvent& event )
1264     int intResult = 0;
1265     
1266     frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
1267     frameCEEmail->SetEditorMode(FALSE, CE_HOME);
1268     intResult = GetLastInt(&HomeAddressList);
1269     frameCEEmail->SetupPointers(&HomeEmailList,
1270                                 &HomeEmailListAltID,
1271                                 &HomeEmailListPID,
1272                                 &HomeEmailListType,
1273                                 &HomeEmailListTokens,
1274                                 &HomeEmailListPref,
1275                                 lboHomeEmails,
1276                                 (intValueSeek));
1277     frameCEEmail->ShowModal();
1278     delete frameCEEmail;
1279     frameCEEmail = NULL;
1282 void frmContactEditor::ModifyHomeEmail( wxCommandEvent& event )
1284     long longSelected = -1;
1285     int intSelectedData = 0;
1286     
1287     if (!GetSelectedItem(lboHomeEmails,
1288                          &longSelected,
1289                          &intSelectedData)){
1290         return;
1291     }
1292     
1293     frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
1294     frameCEEmail->SetupPointers(&HomeEmailList,
1295                                 &HomeEmailListAltID,
1296                                 &HomeEmailListPID,
1297                                 &HomeEmailListType,
1298                                 &HomeEmailListTokens,
1299                                 &HomeEmailListPref,
1300                                 lboHomeEmails,
1301                                 intSelectedData);
1302     frameCEEmail->SetEditorMode(TRUE, CE_HOME);
1303     frameCEEmail->ShowModal();
1304     delete frameCEEmail;
1305     frameCEEmail = NULL;
1309 void frmContactEditor::DeleteHomeEmail( wxCommandEvent& event )
1311     long longSelected = -1;
1312     int intSelectedData = 0;
1313     
1314     if (!GetSelectedItem(lboHomeEmails,
1315                          &longSelected,
1316                          &intSelectedData)){
1317         return;
1318     }
1319     
1320     lboHomeEmails->DeleteItem(longSelected);
1321     
1322     DeleteMapData(intSelectedData, &HomeEmailList,
1323                   &HomeEmailListAltID, &HomeEmailListPID,
1324                   &HomeEmailListType, &HomeEmailListTokens,
1325                   &HomeEmailListPref);
1329 void frmContactEditor::AddHomeIM( wxCommandEvent& event )
1331     int intResult = 0;
1332     
1333     frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
1334     frameCEIM->SetEditorMode(FALSE, CE_HOME);
1335     intResult = GetLastInt(&HomeIMList);
1336     frameCEIM->SetupPointers(&HomeIMList,
1337                              &HomeIMListAltID,
1338                              &HomeIMListPID,
1339                              &HomeIMListType,
1340                              &HomeIMListTokens,
1341                              &HomeIMListMediatype,
1342                              &HomeIMListPref,
1343                              lboHomeIM,
1344                              (intValueSeek));
1345     frameCEIM->ShowModal();
1346     delete frameCEIM;
1347     frameCEIM = NULL;
1350 void frmContactEditor::ModifyHomeIM( wxCommandEvent& event )
1352     long longSelected = -1;
1353     int intSelectedData = 0;
1354     
1355     if (!GetSelectedItem(lboHomeIM,
1356                          &longSelected,
1357                          &intSelectedData)){
1358         return;
1359     }
1360     
1361     frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
1362     frameCEIM->SetupPointers(&HomeIMList,
1363                              &HomeIMListAltID,
1364                              &HomeIMListPID,
1365                              &HomeIMListType,
1366                              &HomeIMListTokens,
1367                              &HomeIMListMediatype,
1368                              &HomeIMListPref,
1369                              lboHomeIM,
1370                              intSelectedData);
1371     frameCEIM->SetEditorMode(TRUE, CE_HOME);
1372     frameCEIM->ShowModal();
1373     delete frameCEIM;
1374     frameCEIM = NULL;
1377 void frmContactEditor::DeleteHomeIM( wxCommandEvent& event )
1379     long longSelected = -1;
1380     int intSelectedData = 0;
1381     
1382     if (!GetSelectedItem(lboHomeIM,
1383                          &longSelected,
1384                          &intSelectedData)){
1385         return;
1386     }
1387     
1388     lboHomeIM->DeleteItem(longSelected);
1389     
1390     DeleteMapData(intSelectedData, &HomeIMList,
1391                   &HomeIMListAltID, &HomeIMListPID,
1392                   &HomeIMListType, &HomeIMListTokens,
1393                   &HomeIMListMediatype, &HomeIMListPref);
1394     
1397 void frmContactEditor::AddHomeTelephone( wxCommandEvent& event )
1399     int intResult = 0;
1400     
1401     frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
1402     frameCETel->SetEditorMode(FALSE, CE_HOME);
1403     intResult = GetLastInt(&HomeTelephoneList);
1404     frameCETel->SetupPointers(&HomeTelephoneList,
1405                               &HomeTelephoneListAltID,
1406                               &HomeTelephoneListPID,
1407                               &HomeTelephoneListType,
1408                               &HomeTelephoneListTokens,
1409                               &HomeTelephoneListPref,
1410                               lboHomeTelephone,
1411                               (intValueSeek));
1412     frameCETel->ShowModal();
1413     delete frameCETel;
1414     frameCETel = NULL;
1417 void frmContactEditor::ModifyHomeTelephone( wxCommandEvent& event )
1419     long longSelected = -1;
1420     int intSelectedData = 0;
1421     
1422     if (!GetSelectedItem(lboHomeTelephone,
1423                          &longSelected,
1424                          &intSelectedData)){
1425         return;
1426     }
1427     
1428     frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
1429     frameCETel->SetupPointers(&HomeTelephoneList,
1430                               &HomeTelephoneListAltID,
1431                               &HomeTelephoneListPID,
1432                               &HomeTelephoneListType,
1433                               &HomeTelephoneListTokens,
1434                               &HomeTelephoneListPref,
1435                               lboHomeTelephone,
1436                               intSelectedData);
1437     frameCETel->SetEditorMode(TRUE, CE_HOME);
1438     frameCETel->ShowModal();
1439     delete frameCETel;
1440     frameCETel = NULL;
1443 void frmContactEditor::DeleteHomeTelephone( wxCommandEvent& event )
1445     long longSelected = -1;
1446     int intSelectedData = 0;
1447     
1448     if (!GetSelectedItem(lboHomeTelephone,
1449                          &longSelected,
1450                          &intSelectedData)){
1451         return;
1452     }
1453     
1454     lboHomeTelephone->DeleteItem(longSelected);
1455     
1456     DeleteMapData(intSelectedData, &HomeTelephoneList,
1457                   &HomeTelephoneListAltID, &HomeTelephoneListPID,
1458                   &HomeTelephoneListType, &HomeTelephoneListTokens,
1459                   &HomeTelephoneListPref);
1460     
1463 void frmContactEditor::AddHomeLanguage( wxCommandEvent& event )
1465     int intResult = 0;
1466     
1467     frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
1468     frameCELang->SetEditorMode(FALSE, CE_HOME);
1469     intResult = GetLastInt(&HomeLanguageList);
1470     frameCELang->SetupPointers(&HomeLanguageList,
1471                                &HomeLanguageListAltID,
1472                                &HomeLanguageListPID,
1473                                &HomeLanguageListType,
1474                                &HomeLanguageListTokens,
1475                                &HomeLanguageListPref,
1476                                lboHomeLanguages,
1477                                (intValueSeek));
1478     frameCELang->ShowModal();
1479     delete frameCELang;
1480     frameCELang = NULL;
1483 void frmContactEditor::ModifyHomeLanguage( wxCommandEvent& event )
1485     long longSelected = -1;
1486     int intSelectedData = 0;
1487     
1488     if (!GetSelectedItem(lboHomeLanguages,
1489                          &longSelected,
1490                          &intSelectedData)){
1491         return;
1492     }
1493     
1494     frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
1495     frameCELang->SetupPointers(&HomeLanguageList,
1496                                &HomeLanguageListAltID,
1497                                &HomeLanguageListPID,
1498                                &HomeLanguageListType,
1499                                &HomeLanguageListTokens,
1500                                &HomeLanguageListPref,
1501                                lboHomeLanguages,
1502                                intSelectedData);
1503     frameCELang->SetEditorMode(TRUE, CE_HOME);
1504     frameCELang->ShowModal();
1505     delete frameCELang;
1506     frameCELang = NULL;
1509 void frmContactEditor::DeleteHomeLanguage( wxCommandEvent& event )
1511     long longSelected = -1;
1512     int intSelectedData = 0;
1513     
1514     if (!GetSelectedItem(lboHomeLanguages,
1515                          &longSelected,
1516                          &intSelectedData)){
1517         return;
1518     }
1519     
1520     lboHomeLanguages->DeleteItem(longSelected);
1521     
1522     DeleteMapData(intSelectedData, &HomeLanguageList,
1523                   &HomeLanguageListAltID, &HomeLanguageListPID,
1524                   &HomeLanguageListType, &HomeLanguageListTokens,
1525                   &HomeLanguageListPref);
1526     
1529 void frmContactEditor::AddHomeTimezone( wxCommandEvent& event )
1531     int intResult = 0;
1532     
1533     frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
1534     frameCETZ->SetEditorMode(FALSE, CE_HOME);
1535     intResult = GetLastInt(&HomeTZList);
1536     frameCETZ->SetupPointers(&HomeTZList,
1537                              &HomeTZListAltID,
1538                              &HomeTZListPID,
1539                              &HomeTZListType,
1540                              &HomeTZListTokens,
1541                              &HomeTZListMediatype,
1542                              &HomeTZListPref,
1543                              lboHomeTimezones,
1544                              (intValueSeek));
1545     frameCETZ->ShowModal();
1546     delete frameCETZ;
1547     frameCETZ = NULL;
1550 void frmContactEditor::ModifyHomeTimezone( wxCommandEvent& event )
1552     long longSelected = -1;
1553     int intSelectedData = 0;
1554     
1555     if (!GetSelectedItem(lboHomeTimezones,
1556                          &longSelected,
1557                          &intSelectedData)){
1558         return;
1559     }
1560     
1561     frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
1562     frameCETZ->SetupPointers(&HomeTZList,
1563                              &HomeTZListAltID,
1564                              &HomeTZListPID,
1565                              &HomeTZListType,
1566                              &HomeTZListTokens,
1567                              &HomeTZListMediatype,
1568                              &HomeTZListPref,
1569                              lboHomeTimezones,
1570                              intSelectedData);
1571     frameCETZ->SetEditorMode(TRUE, CE_HOME);
1572     frameCETZ->ShowModal();
1573     delete frameCETZ;
1574     frameCETZ = NULL;
1577 void frmContactEditor::DeleteHomeTimezone( wxCommandEvent& event )
1579     long longSelected = -1;
1580     int intSelectedData = 0;
1581     
1582     if (!GetSelectedItem(lboHomeTimezones,
1583                          &longSelected,
1584                          &intSelectedData)){
1585         return;
1586     }
1587     
1588     lboHomeTimezones->DeleteItem(longSelected);
1589     
1590     DeleteMapData(intSelectedData, &HomeTZList,
1591                   &HomeTZListAltID, &HomeTZListPID,
1592                   &HomeTZListType, &HomeTZListTokens,
1593                   &HomeTZListMediatype, &HomeTZListPref);
1594     
1597 void frmContactEditor::AddHomeGeoposition( wxCommandEvent& event )
1599     int intResult = 0;
1600     
1601     frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
1602     frameCEGeo->SetEditorMode(FALSE, CE_HOME);
1603     intResult = GetLastInt(&HomeGeographyList);
1604     frameCEGeo->SetupPointers(&HomeGeographyList,
1605                               &HomeGeographyListAltID,
1606                               &HomeGeographyListPID,
1607                               &HomeGeographyListType,
1608                               &HomeGeographyListTokens,
1609                               &HomeGeographyListMediatype,
1610                               &HomeGeographyListPref,
1611                               lboHomeGeoposition,
1612                               (intValueSeek));
1613     frameCEGeo->ShowModal();
1614     delete frameCEGeo;
1615     frameCEGeo = NULL;
1618 void frmContactEditor::ModifyHomeGeoposition( wxCommandEvent& event )
1620     long longSelected = -1;
1621     int intSelectedData = 0;
1622     
1623     if (!GetSelectedItem(lboHomeGeoposition,
1624                          &longSelected,
1625                          &intSelectedData)){
1626         return;
1627     }
1628     
1629     frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
1630     frameCEGeo->SetupPointers(&HomeGeographyList,
1631                               &HomeGeographyListAltID,
1632                               &HomeGeographyListPID,
1633                               &HomeGeographyListType,
1634                               &HomeGeographyListTokens,
1635                               &HomeGeographyListMediatype,
1636                               &HomeGeographyListPref,
1637                               lboHomeGeoposition,
1638                               intSelectedData);
1639     frameCEGeo->SetEditorMode(TRUE, CE_HOME);
1640     frameCEGeo->ShowModal();
1641     delete frameCEGeo;
1642     frameCEGeo = NULL;
1645 void frmContactEditor::DeleteHomeGeoposition( wxCommandEvent& event )
1647     long longSelected = -1;
1648     int intSelectedData = 0;
1649     
1650     if (!GetSelectedItem(lboHomeGeoposition,
1651                          &longSelected,
1652                          &intSelectedData)){
1653         return;
1654     }
1655     
1656     lboHomeGeoposition->DeleteItem(longSelected);
1657     
1658     DeleteMapData(intSelectedData, &HomeGeographyList,
1659                   &HomeGeographyListAltID, &HomeGeographyListPID,
1660                   &HomeGeographyListType, &HomeGeographyListTokens,
1661                   &HomeGeographyListMediatype, &HomeGeographyListPref);
1662     
1665 void frmContactEditor::AddHomeWebsite( wxCommandEvent& event )
1667     int intResult = 0;
1668     
1669     frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
1670     frameCEWeb->SetEditorMode(FALSE, CE_HOME);
1671     intResult = GetLastInt(&HomeWebsiteList);
1672     frameCEWeb->SetupPointers(&HomeWebsiteList,
1673                               &HomeWebsiteListAltID,
1674                               &HomeWebsiteListPID,
1675                               &HomeWebsiteListType,
1676                               &HomeWebsiteListTokens,
1677                               &HomeWebsiteListMediatype,
1678                               &HomeWebsiteListPref,
1679                               lboHomeWebsites,
1680                               (intValueSeek));
1681     frameCEWeb->ShowModal();
1682     delete frameCEWeb;
1683     frameCEWeb = NULL;
1686 void frmContactEditor::ModifyHomeWebsite( wxCommandEvent& event )
1688     long longSelected = -1;
1689     int intSelectedData = 0;
1690     
1691     if (!GetSelectedItem(lboHomeWebsites,
1692                          &longSelected,
1693                          &intSelectedData)){
1694         return;
1695     }
1696     
1697     frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
1698     frameCEWeb->SetupPointers(&HomeWebsiteList,
1699                               &HomeWebsiteListAltID,
1700                               &HomeWebsiteListPID,
1701                               &HomeWebsiteListType,
1702                               &HomeWebsiteListTokens,
1703                               &HomeWebsiteListMediatype,
1704                               &HomeWebsiteListPref,
1705                               lboHomeWebsites,
1706                               intSelectedData);
1707     frameCEWeb->SetEditorMode(TRUE, CE_HOME);
1708     frameCEWeb->ShowModal();
1709     delete frameCEWeb;
1710     frameCEWeb = NULL;
1713 void frmContactEditor::DeleteHomeWebsite( wxCommandEvent& event )
1715     long longSelected = -1;
1716     int intSelectedData = 0;
1717     
1718     if (!GetSelectedItem(lboHomeWebsites,
1719                          &longSelected,
1720                          &intSelectedData)){
1721         return;
1722     }
1723     
1724     lboHomeWebsites->DeleteItem(longSelected);
1725     
1726     DeleteMapData(intSelectedData, &HomeWebsiteList,
1727                   &HomeWebsiteListAltID, &HomeWebsiteListPID,
1728                   &HomeWebsiteListType, &HomeWebsiteListTokens,
1729                   &HomeWebsiteListMediatype, &HomeWebsiteListPref);
1730     
1733 void frmContactEditor::AddHomeTitle( wxCommandEvent& event )
1735     int intResult = 0;
1736     
1737     frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
1738     frameCETitle->SetEditorMode(FALSE, CE_HOME);
1739     intResult = GetLastInt(&HomeTitleList);
1740     frameCETitle->SetupPointers(&HomeTitleList,
1741                                 &HomeTitleListLanguage,
1742                                 &HomeTitleListAltID,
1743                                 &HomeTitleListPID,
1744                                 &HomeTitleListType,
1745                                 &HomeTitleListTokens,
1746                                 &HomeTitleListPref,
1747                                 lboHomeTitles,
1748                                 (intValueSeek));
1749     frameCETitle->ShowModal();
1750     delete frameCETitle;
1751     frameCETitle = NULL;
1754 void frmContactEditor::ModifyHomeTitle( wxCommandEvent& event )
1756     long longSelected = -1;
1757     int intSelectedData = 0;
1758     
1759     if (!GetSelectedItem(lboHomeTitles,
1760                          &longSelected,
1761                          &intSelectedData)){
1762         return;
1763     }
1764     
1765     frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
1766     frameCETitle->SetupPointers(&HomeTitleList,
1767                                 &HomeTitleListLanguage,
1768                                 &HomeTitleListAltID,
1769                                 &HomeTitleListPID,
1770                                 &HomeTitleListType,
1771                                 &HomeTitleListTokens,
1772                                 &HomeTitleListPref,
1773                                 lboHomeTitles,
1774                                 intSelectedData);
1775     frameCETitle->SetEditorMode(TRUE, CE_HOME);
1776     frameCETitle->ShowModal();
1777     delete frameCETitle;
1778     frameCETitle = NULL;
1781 void frmContactEditor::DeleteHomeTitle( wxCommandEvent& event )
1783     long longSelected = -1;
1784     int intSelectedData = 0;
1785     
1786     if (!GetSelectedItem(lboHomeTitles,
1787                          &longSelected,
1788                          &intSelectedData)){
1789         return;
1790     }
1791     
1792     lboHomeTitles->DeleteItem(longSelected);
1793     
1794     DeleteMapData(intSelectedData, &HomeTitleList,
1795                   &HomeTitleListLanguage, &HomeTitleListAltID,
1796                   &HomeTitleListPID, &HomeTitleListType,
1797                   &HomeTitleListTokens, &HomeTitleListPref);
1798     
1801 void frmContactEditor::AddHomeRole( wxCommandEvent& event )
1803     int intResult = 0;
1804     
1805     frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
1806     frameCERole->SetEditorMode(FALSE, CE_HOME);
1807     intResult = GetLastInt(&HomeRoleList);
1808     frameCERole->SetupPointers(&HomeRoleList,
1809                                &HomeRoleListLanguage,
1810                                &HomeRoleListAltID,
1811                                &HomeRoleListPID,
1812                                &HomeRoleListType,
1813                                &HomeRoleListTokens,
1814                                &HomeRoleListPref,
1815                                lboHomeRoles,
1816                                (intValueSeek));
1817     frameCERole->ShowModal();
1818     delete frameCERole;
1819     frameCERole = NULL;
1822 void frmContactEditor::ModifyHomeRole( wxCommandEvent& event )
1824     long longSelected = -1;
1825     int intSelectedData = 0;
1826     
1827     if (!GetSelectedItem(lboHomeRoles,
1828                          &longSelected,
1829                          &intSelectedData)){
1830         return;
1831     }
1832     
1833     frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
1834     frameCERole->SetupPointers(&HomeRoleList,
1835                                &HomeRoleListLanguage,
1836                                &HomeRoleListAltID,
1837                                &HomeRoleListPID,
1838                                &HomeRoleListType,
1839                                &HomeRoleListTokens,
1840                                &HomeRoleListPref,
1841                                lboHomeRoles,
1842                                intSelectedData);
1843     frameCERole->SetEditorMode(TRUE, CE_HOME);
1844     frameCERole->ShowModal();
1845     delete frameCERole;
1846     frameCERole = NULL;
1849 void frmContactEditor::DeleteHomeRole( wxCommandEvent& event )
1851     long longSelected = -1;
1852     int intSelectedData = 0;
1853     
1854     if (!GetSelectedItem(lboHomeRoles,
1855                          &longSelected,
1856                          &intSelectedData)){
1857         return;
1858     }
1859     
1860     lboHomeRoles->DeleteItem(longSelected);
1861     
1862     DeleteMapData(intSelectedData, &HomeRoleList,
1863                   &HomeRoleListLanguage, &HomeRoleListAltID,
1864                   &HomeRoleListPID, &HomeRoleListType,
1865                   &HomeRoleListTokens, &HomeRoleListPref);
1866     
1869 void frmContactEditor::AddHomeOrganisation( wxCommandEvent& event )
1871     int intResult = 0;
1872     
1873     frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
1874     frameCEOrg->SetEditorMode(FALSE, CE_HOME);
1875     intResult = GetLastInt(&HomeOrganisationsList);
1876     frameCEOrg->SetupPointers(&HomeOrganisationsList,
1877                               &HomeOrganisationsListLanguage,
1878                               &HomeOrganisationsListSortAs,
1879                               &HomeOrganisationsListAltID,
1880                               &HomeOrganisationsListPID,
1881                               &HomeOrganisationsListType,
1882                               &HomeOrganisationsListTokens,
1883                               &HomeOrganisationsListPref,
1884                               lboHomeOrganisations,
1885                               (intValueSeek));
1886     frameCEOrg->ShowModal();
1887     delete frameCEOrg;
1888     frameCEOrg = NULL;
1891 void frmContactEditor::ModifyHomeOrganisation( wxCommandEvent& event )
1893     long longSelected = -1;
1894     int intSelectedData = 0;
1895     
1896     if (!GetSelectedItem(lboHomeOrganisations,
1897                          &longSelected,
1898                          &intSelectedData)){
1899         return;
1900     }
1901     
1902     frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
1903     frameCEOrg->SetupPointers(&HomeOrganisationsList,
1904                               &HomeOrganisationsListLanguage,
1905                               &HomeOrganisationsListSortAs,
1906                               &HomeOrganisationsListAltID,
1907                               &HomeOrganisationsListPID,
1908                               &HomeOrganisationsListType,
1909                               &HomeOrganisationsListTokens,
1910                               &HomeOrganisationsListPref,
1911                               lboHomeOrganisations,
1912                               intSelectedData);
1913     frameCEOrg->SetEditorMode(TRUE, CE_HOME);
1914     frameCEOrg->ShowModal();
1915     delete frameCEOrg;
1916     frameCEOrg = NULL;
1919 void frmContactEditor::DeleteHomeOrganisation( wxCommandEvent& event )
1921     long longSelected = -1;
1922     int intSelectedData = 0;
1923     
1924     if (!GetSelectedItem(lboHomeOrganisations,
1925                          &longSelected,
1926                          &intSelectedData)){
1927         return;
1928     }
1929     
1930     lboHomeOrganisations->DeleteItem(longSelected);
1931     
1932     DeleteMapData(intSelectedData, &HomeOrganisationsList,
1933                   &HomeOrganisationsListLanguage, &HomeOrganisationsListSortAs,
1934                   &HomeOrganisationsListAltID, &HomeOrganisationsListPID,
1935                   &HomeOrganisationsListType, &HomeOrganisationsListTokens,
1936                   &HomeOrganisationsListPref);
1937     
1940 void frmContactEditor::AddHomeNote( wxCommandEvent& event )
1942     int intResult = 0;
1943     
1944     frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
1945     frameCENote->SetEditorMode(FALSE, CE_HOME);
1946     intResult = GetLastInt(&HomeNoteList);
1947     frameCENote->SetupPointers(&HomeNoteList,
1948                                &HomeNoteListLanguage,
1949                                &HomeNoteListAltID,
1950                                &HomeNoteListPID,
1951                                &HomeNoteListType,
1952                                &HomeNoteListTokens,
1953                                &HomeNoteListPref,
1954                                lboHomeNotes,
1955                                (intValueSeek));
1956     frameCENote->ShowModal();
1957     delete frameCENote;
1958     frameCENote = NULL;
1961 void frmContactEditor::ModifyHomeNote( wxCommandEvent& event )
1963     long longSelected = -1;
1964     int intSelectedData = 0;
1965     
1966     if (!GetSelectedItem(lboHomeNotes,
1967                          &longSelected,
1968                          &intSelectedData)){
1969         return;
1970     }
1971     
1972     frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
1973     frameCENote->SetupPointers(&HomeNoteList,
1974                                &HomeNoteListLanguage,
1975                                &HomeNoteListAltID,
1976                                &HomeNoteListPID,
1977                                &HomeNoteListType,
1978                                &HomeNoteListTokens,
1979                                &HomeNoteListPref,
1980                                lboHomeNotes,
1981                                intSelectedData);
1982     frameCENote->SetEditorMode(TRUE, CE_HOME);
1983     frameCENote->ShowModal();
1984     delete frameCENote;
1985     frameCENote = NULL;
1988 void frmContactEditor::DeleteHomeNote( wxCommandEvent& event )
1990     long longSelected = -1;
1991     int intSelectedData = 0;
1992     
1993     if (!GetSelectedItem(lboHomeNotes,
1994                          &longSelected,
1995                          &intSelectedData)){
1996         return;
1997     }
1998     
1999     lboNotes->DeleteItem(longSelected);
2000     
2001     DeleteMapData(intSelectedData, &HomeNoteList,
2002                   &HomeNoteListLanguage, &HomeNoteListAltID,
2003                   &HomeNoteListPID, &HomeNoteListType,
2004                   &HomeNoteListTokens, &HomeNoteListPref);
2005     
2008 void frmContactEditor::AddBusinessNickname( wxCommandEvent& event )
2010     int intResult = 0;
2011     
2012     frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
2013     frameCENickname->SetEditorMode(FALSE, CE_WORK);
2014     intResult = GetLastInt(&BusinessNicknamesList);
2015     frameCENickname->SetupPointers(&BusinessNicknamesList,
2016                                    &BusinessNicknamesListAltID,
2017                                    &BusinessNicknamesListPID,
2018                                    &BusinessNicknamesListType,
2019                                    &BusinessNicknamesListLanguage,
2020                                    &BusinessNicknamesListTokens,
2021                                    &BusinessNicknamesListPref,
2022                                    lboBusinessNicknames,
2023                                    (intValueSeek));
2024     frameCENickname->ShowModal();
2025     delete frameCENickname;
2026     frameCENickname = NULL;
2029 void frmContactEditor::ModifyBusinessNickname( wxCommandEvent& event )
2031     long longSelected = -1;
2032     int intSelectedData = 0;
2033     
2034     if (!GetSelectedItem(lboBusinessNicknames,
2035                          &longSelected,
2036                          &intSelectedData)){
2037         return;
2038     }
2039     
2040     frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
2041     frameCENickname->SetupPointers(&BusinessNicknamesList,
2042                                    &BusinessNicknamesListAltID,
2043                                    &BusinessNicknamesListPID,
2044                                    &BusinessNicknamesListType,
2045                                    &BusinessNicknamesListLanguage,
2046                                    &BusinessNicknamesListTokens,
2047                                    &BusinessNicknamesListPref,
2048                                    lboBusinessNicknames,
2049                                    intSelectedData);
2050     frameCENickname->SetEditorMode(TRUE, CE_WORK);
2051     frameCENickname->ShowModal();
2052     delete frameCENickname;
2053     frameCENickname = NULL;
2056 void frmContactEditor::DeleteBusinessNickname( wxCommandEvent& event )
2058     long longSelected = -1;
2059     int intSelectedData = 0;
2060     
2061     if (!GetSelectedItem(lboBusinessNicknames,
2062                          &longSelected,
2063                          &intSelectedData)){
2064         return;
2065     }
2066     
2067     lboBusinessNicknames->DeleteItem(longSelected);
2068     
2069     DeleteMapData(intSelectedData,
2070                   &BusinessNicknamesList,
2071                   &BusinessNicknamesListLanguage,
2072                   &BusinessNicknamesListAltID,
2073                   &BusinessNicknamesListPID,
2074                   &BusinessNicknamesListTokens,
2075                   &BusinessNicknamesListType,
2076                   &BusinessNicknamesListPref);
2079 void frmContactEditor::AddBusinessAddress( wxCommandEvent& event )
2081     int intResult = 0;
2082     
2083     frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
2084     frameCEAddress->SetEditorMode(FALSE, CE_WORK);
2085     intResult = GetLastInt(&BusinessAddressList);
2086     frameCEAddress->SetupPointers(&BusinessAddressList,
2087                                   &BusinessAddressListTown,
2088                                   &BusinessAddressListCounty,
2089                                   &BusinessAddressListPostCode,
2090                                   &BusinessAddressListCountry,
2091                                   &BusinessAddressListLabel,
2092                                   &BusinessAddressListLang,
2093                                   &BusinessAddressListAltID,
2094                                   &BusinessAddressListPID,
2095                                   &BusinessAddressListTokens,
2096                                   &BusinessAddressListGeo,
2097                                   &BusinessAddressListTimezone,
2098                                   &BusinessAddressListType,
2099                                   &BusinessAddressListMediatype,
2100                                   &BusinessAddressListPref,
2101                                   lboBusinessAddresses,
2102                                   (intValueSeek));
2103     frameCEAddress->ShowModal();
2104     delete frameCEAddress;
2105     frameCEAddress = NULL;
2108 void frmContactEditor::ModifyBusinessAddress( wxCommandEvent& event )
2110     long longSelected = -1;
2111     int intSelectedData = 0;
2112     
2113     if (!GetSelectedItem(lboBusinessAddresses,
2114                          &longSelected,
2115                          &intSelectedData)){
2116         return;
2117     }
2118     
2119     frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
2120     frameCEAddress->SetupPointers(&BusinessAddressList,
2121                                   &BusinessAddressListTown,
2122                                   &BusinessAddressListCounty,
2123                                   &BusinessAddressListPostCode,
2124                                   &BusinessAddressListCountry,
2125                                   &BusinessAddressListLabel,
2126                                   &BusinessAddressListLang,
2127                                   &BusinessAddressListAltID,
2128                                   &BusinessAddressListPID,
2129                                   &BusinessAddressListTokens,
2130                                   &BusinessAddressListGeo,
2131                                   &BusinessAddressListTimezone,
2132                                   &BusinessAddressListType,
2133                                   &BusinessAddressListMediatype,
2134                                   &BusinessAddressListPref,
2135                                   lboBusinessAddresses,
2136                                   intSelectedData);
2137     frameCEAddress->SetEditorMode(TRUE, CE_WORK);
2138     frameCEAddress->ShowModal();
2139     delete frameCEAddress;
2140     frameCEAddress = NULL;
2143 void frmContactEditor::DeleteBusinessAddress( wxCommandEvent& event )
2145     long longSelected = -1;
2146     int intSelectedData = 0;
2147     
2148     if (!GetSelectedItem(lboBusinessAddresses,
2149                          &longSelected,
2150                          &intSelectedData)){
2151         return;
2152     }
2153     
2154     lboBusinessAddresses->DeleteItem(longSelected);
2155     DeleteMapData(intSelectedData, &BusinessAddressList,
2156                   &BusinessAddressListTown, &BusinessAddressListCounty,
2157                   &BusinessAddressListPostCode, &BusinessAddressListCountry,
2158                   &BusinessAddressList, &BusinessAddressListLabel,
2159                   &BusinessAddressListLang, &BusinessAddressListAltID,
2160                   &BusinessAddressListPID, &BusinessAddressListTokens,
2161                   &BusinessAddressListGeo, &BusinessAddressListTimezone,
2162                   &BusinessAddressListType, &BusinessAddressListMediatype,
2163                   &BusinessAddressListPref);
2164     
2167 void frmContactEditor::AddBusinessEmail( wxCommandEvent& event )
2169     int intResult = 0;
2170     
2171     frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
2172     frameCEEmail->SetEditorMode(FALSE, CE_WORK);
2173     intResult = GetLastInt(&BusinessAddressList);
2174     frameCEEmail->SetupPointers(&BusinessEmailList,
2175                                 &BusinessEmailListAltID,
2176                                 &BusinessEmailListPID,
2177                                 &BusinessEmailListType,
2178                                 &BusinessEmailListTokens,
2179                                 &BusinessEmailListPref,
2180                                 lboBusinessEmail,
2181                                 (intValueSeek));
2182     frameCEEmail->ShowModal();
2183     delete frameCEEmail;
2184     frameCEEmail = NULL;
2187 void frmContactEditor::ModifyBusinessEmail( wxCommandEvent& event )
2189     long longSelected = -1;
2190     int intSelectedData = 0;
2191     
2192     if (!GetSelectedItem(lboBusinessEmail,
2193                          &longSelected,
2194                          &intSelectedData)){
2195         return;
2196     }
2197     
2198     frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
2199     frameCEEmail->SetupPointers(&BusinessEmailList,
2200                                 &BusinessEmailListAltID,
2201                                 &BusinessEmailListPID,
2202                                 &BusinessEmailListType,
2203                                 &BusinessEmailListTokens,
2204                                 &BusinessEmailListPref,
2205                                 lboBusinessEmail,
2206                                 intSelectedData);
2207     frameCEEmail->SetEditorMode(TRUE, CE_WORK);
2208     frameCEEmail->ShowModal();
2209     delete frameCEEmail;
2210     frameCEEmail = NULL;
2213 void frmContactEditor::DeleteBusinessEmail( wxCommandEvent& event )
2215     long longSelected = -1;
2216     int intSelectedData = 0;
2217     
2218     if (!GetSelectedItem(lboBusinessEmail,
2219                          &longSelected,
2220                          &intSelectedData)){
2221         return;
2222     }
2223     
2224     lboBusinessEmail->DeleteItem(longSelected);
2225     
2226     DeleteMapData(intSelectedData, &BusinessEmailList,
2227                   &BusinessEmailListAltID, &BusinessEmailListPID,
2228                   &BusinessEmailListType, &BusinessEmailListTokens,
2229                   &BusinessEmailListPref);
2230     
2233 void frmContactEditor::AddBusinessIM( wxCommandEvent& event )
2235     int intResult = 0;
2236     
2237     frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
2238     frameCEIM->SetEditorMode(FALSE, CE_WORK);
2239     intResult = GetLastInt(&BusinessIMList);
2240     frameCEIM->SetupPointers(&BusinessIMList,
2241                              &BusinessIMListAltID,
2242                              &BusinessIMListPID,
2243                              &BusinessIMListType,
2244                              &BusinessIMListTokens,
2245                              &BusinessIMListMediatype,
2246                              &BusinessIMListPref,
2247                              lboBusinessIM,
2248                              (intValueSeek));
2249     frameCEIM->ShowModal();
2250     delete frameCEIM;
2251     frameCEIM = NULL;
2254 void frmContactEditor::ModifyBusinessIM( wxCommandEvent& event )
2256     long longSelected = -1;
2257     int intSelectedData = 0;
2258     
2259     if (!GetSelectedItem(lboBusinessIM,
2260                          &longSelected,
2261                          &intSelectedData)){
2262         return;
2263     }
2264     
2265     frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
2266     frameCEIM->SetupPointers(&BusinessIMList,
2267                              &BusinessIMListAltID,
2268                              &BusinessIMListPID,
2269                              &BusinessIMListType,
2270                              &BusinessIMListTokens,
2271                              &BusinessIMListMediatype,
2272                              &BusinessIMListPref,
2273                              lboBusinessIM,
2274                              intSelectedData);
2275     frameCEIM->SetEditorMode(TRUE, CE_WORK);
2276     frameCEIM->ShowModal();
2277     delete frameCEIM;
2278     frameCEIM = NULL;
2281 void frmContactEditor::DeleteBusinessIM( wxCommandEvent& event )
2283     long longSelected = -1;
2284     int intSelectedData = 0;
2285     
2286     if (!GetSelectedItem(lboBusinessIM,
2287                          &longSelected,
2288                          &intSelectedData)){
2289         return;
2290     }
2291     
2292     lboBusinessIM->DeleteItem(longSelected);
2293     
2294     DeleteMapData(intSelectedData, &BusinessIMList,
2295                   &BusinessIMListAltID, &BusinessIMListPID,
2296                   &BusinessIMListType, &BusinessIMListTokens,
2297                   &BusinessIMListMediatype, &BusinessIMListPref);
2298     
2301 void frmContactEditor::AddBusinessTelephone( wxCommandEvent& event )
2303     int intResult = 0;
2304     
2305     frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
2306     frameCETel->SetEditorMode(FALSE, CE_WORK);
2307     intResult = GetLastInt(&BusinessTelephoneList);
2308     frameCETel->SetupPointers(&BusinessTelephoneList,
2309                               &BusinessTelephoneListAltID,
2310                               &BusinessTelephoneListPID,
2311                               &BusinessTelephoneListType,
2312                               &BusinessTelephoneListTokens,
2313                               &BusinessTelephoneListPref,
2314                               lboBusinessTelephone,
2315                               (intValueSeek));
2316     frameCETel->ShowModal();
2317     delete frameCETel;
2318     frameCETel = NULL;
2321 void frmContactEditor::ModifyBusinessTelephone( wxCommandEvent& event )
2323     long longSelected = -1;
2324     int intSelectedData = 0;
2325     
2326     if (!GetSelectedItem(lboBusinessTelephone,
2327                          &longSelected,
2328                          &intSelectedData)){
2329         return;
2330     }
2331     
2332     frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
2333     frameCETel->SetupPointers(&BusinessTelephoneList,
2334                               &BusinessTelephoneListAltID,
2335                               &BusinessTelephoneListPID,
2336                               &BusinessTelephoneListType,
2337                               &BusinessTelephoneListTokens,
2338                               &BusinessTelephoneListPref,
2339                               lboBusinessTelephone,
2340                               intSelectedData);
2341     frameCETel->SetEditorMode(TRUE, CE_WORK);
2342     frameCETel->ShowModal();
2343     delete frameCETel;
2344     frameCETel = NULL;
2347 void frmContactEditor::DeleteBusinessTelephone( wxCommandEvent& event )
2349     long longSelected = -1;
2350     int intSelectedData = 0;
2351     
2352     if (!GetSelectedItem(lboBusinessTelephone,
2353                          &longSelected,
2354                          &intSelectedData)){
2355         return;
2356     }
2357     
2358     lboBusinessTelephone->DeleteItem(longSelected);
2359     
2360     DeleteMapData(intSelectedData, &BusinessTelephoneList,
2361                   &BusinessTelephoneListAltID, &BusinessTelephoneListPID,
2362                   &BusinessTelephoneListType, &BusinessTelephoneListTokens,
2363                   &BusinessTelephoneListPref);
2364     
2367 void frmContactEditor::AddBusinessLanguage( wxCommandEvent& event )
2369     int intResult = 0;
2370     
2371     frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
2372     frameCELang->SetEditorMode(FALSE, CE_WORK);
2373     intResult = GetLastInt(&BusinessLanguageList);
2374     frameCELang->SetupPointers(&BusinessLanguageList,
2375                                &BusinessLanguageListAltID,
2376                                &BusinessLanguageListPID,
2377                                &BusinessLanguageListType,
2378                                &BusinessLanguageListTokens,
2379                                &BusinessLanguageListPref,
2380                                lboBusinessLanguages,
2381                                (intValueSeek));
2382     frameCELang->ShowModal();
2383     delete frameCELang;
2384     frameCELang = NULL;
2387 void frmContactEditor::ModifyBusinessLanguage( wxCommandEvent& event )
2389     long longSelected = -1;
2390     int intSelectedData = 0;
2391     
2392     if (!GetSelectedItem(lboBusinessLanguages,
2393                          &longSelected,
2394                          &intSelectedData)){
2395         return;
2396     }
2397     
2398     frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
2399     frameCELang->SetupPointers(&BusinessLanguageList,
2400                                &BusinessLanguageListAltID,
2401                                &BusinessLanguageListPID,
2402                                &BusinessLanguageListType,
2403                                &BusinessLanguageListTokens,
2404                                &BusinessLanguageListPref,
2405                                lboBusinessLanguages,
2406                                intSelectedData);
2407     frameCELang->SetEditorMode(TRUE, CE_WORK);
2408     frameCELang->ShowModal();
2409     delete frameCELang;
2410     frameCELang = NULL;
2413 void frmContactEditor::DeleteBusinessLanguage( wxCommandEvent& event )
2415     long longSelected = -1;
2416     int intSelectedData = 0;
2417     
2418     if (!GetSelectedItem(lboBusinessLanguages,
2419                          &longSelected,
2420                          &intSelectedData)){
2421         return;
2422     }
2423     
2424     lboBusinessLanguages->DeleteItem(longSelected);
2425     
2426     DeleteMapData(intSelectedData, &BusinessLanguageList,
2427                   &BusinessLanguageListAltID, &BusinessLanguageListPID,
2428                   &BusinessLanguageListType, &BusinessLanguageListTokens,
2429                   &BusinessLanguageListPref);
2430     
2433 void frmContactEditor::AddBusinessTimezone( wxCommandEvent& event )
2435     int intResult = 0;
2436     
2437     frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
2438     frameCETZ->SetEditorMode(FALSE, CE_WORK);
2439     intResult = GetLastInt(&BusinessTZList);
2440     frameCETZ->SetupPointers(&BusinessTZList,
2441                              &BusinessTZListAltID,
2442                              &BusinessTZListPID,
2443                              &BusinessTZListType,
2444                              &BusinessTZListTokens,
2445                              &BusinessTZListMediatype,
2446                              &BusinessTZListPref,
2447                              lboBusinessTimezones,
2448                              (intValueSeek));
2449     frameCETZ->ShowModal();
2450     delete frameCETZ;
2451     frameCETZ = NULL;
2454 void frmContactEditor::ModifyBusinessTimezone( wxCommandEvent& event )
2456     long longSelected = -1;
2457     int intSelectedData = 0;
2458     
2459     if (!GetSelectedItem(lboBusinessTimezones,
2460                          &longSelected,
2461                          &intSelectedData)){
2462         return;
2463     }
2464     
2465     frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
2466     frameCETZ->SetupPointers(&BusinessTZList,
2467                              &BusinessTZListAltID,
2468                              &BusinessTZListPID,
2469                              &BusinessTZListType,
2470                              &BusinessTZListTokens,
2471                              &BusinessTZListMediatype,
2472                              &BusinessTZListPref,
2473                              lboBusinessTimezones,
2474                              intSelectedData);
2475     frameCETZ->SetEditorMode(TRUE, CE_WORK);
2476     frameCETZ->ShowModal();
2477     delete frameCETZ;
2478     frameCETZ = NULL;
2481 void frmContactEditor::DeleteBusinessTimezone( wxCommandEvent& event )
2483     long longSelected = -1;
2484     int intSelectedData = 0;
2485     
2486     if (!GetSelectedItem(lboBusinessTimezones,
2487                          &longSelected,
2488                          &intSelectedData)){
2489         return;
2490     }
2491     
2492     lboBusinessTimezones->DeleteItem(longSelected);
2493     
2494     DeleteMapData(intSelectedData, &BusinessTZList,
2495                   &BusinessTZListAltID, &BusinessTZListPID,
2496                   &BusinessTZListType, &BusinessTZListTokens,
2497                   &BusinessTZListMediatype, &BusinessTZListPref);
2498     
2501 void frmContactEditor::AddBusinessGeoposition( wxCommandEvent& event )
2503     int intResult = 0;
2504     
2505     frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
2506     frameCEGeo->SetEditorMode(FALSE, CE_WORK);
2507     intResult = GetLastInt(&BusinessGeographyList);
2508     frameCEGeo->SetupPointers(&BusinessGeographyList,
2509                               &BusinessGeographyListAltID,
2510                               &BusinessGeographyListPID,
2511                               &BusinessGeographyListType,
2512                               &BusinessGeographyListTokens,
2513                               &BusinessGeographyListMediatype,
2514                               &BusinessGeographyListPref,
2515                               lboBusinessGeoposition,
2516                               (intValueSeek));
2517     frameCEGeo->ShowModal();
2518     delete frameCEGeo;
2519     frameCEGeo = NULL;
2522 void frmContactEditor::ModifyBusinessGeoposition( wxCommandEvent& event )
2524     long longSelected = -1;
2525     int intSelectedData = 0;
2526     
2527     if (!GetSelectedItem(lboBusinessGeoposition,
2528                          &longSelected,
2529                          &intSelectedData)){
2530         return;
2531     }
2532     
2533     frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
2534     frameCEGeo->SetupPointers(&BusinessGeographyList,
2535                               &BusinessGeographyListAltID,
2536                               &BusinessGeographyListPID,
2537                               &BusinessGeographyListType,
2538                               &BusinessGeographyListTokens,
2539                               &BusinessGeographyListMediatype,
2540                               &BusinessGeographyListPref,
2541                               lboBusinessGeoposition,
2542                               intSelectedData);
2543     frameCEGeo->SetEditorMode(TRUE, CE_WORK);
2544     frameCEGeo->ShowModal();
2545     delete frameCEGeo;
2546     frameCEGeo = NULL;
2549 void frmContactEditor::DeleteBusinessGeoposition( wxCommandEvent& event )
2551     long longSelected = -1;
2552     int intSelectedData = 0;
2553     
2554     if (!GetSelectedItem(lboBusinessGeoposition,
2555                          &longSelected,
2556                          &intSelectedData)){
2557         return;
2558     }
2559     
2560     lboBusinessGeoposition->DeleteItem(longSelected);
2561     
2562     DeleteMapData(intSelectedData, &BusinessGeographyList,
2563                   &BusinessGeographyListAltID, &BusinessGeographyListPID,
2564                   &BusinessGeographyListType, &BusinessGeographyListTokens,
2565                   &BusinessGeographyListMediatype, &BusinessGeographyListPref);
2566     
2569 void frmContactEditor::AddBusinessWebsite( wxCommandEvent& event )
2571     int intResult = 0;
2572     
2573     frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
2574     frameCEWeb->SetEditorMode(FALSE, CE_WORK);
2575     intResult = GetLastInt(&BusinessWebsiteList);
2576     frameCEWeb->SetupPointers(&BusinessWebsiteList,
2577                               &BusinessWebsiteListAltID,
2578                               &BusinessWebsiteListPID,
2579                               &BusinessWebsiteListType,
2580                               &BusinessWebsiteListTokens,
2581                               &BusinessWebsiteListMediatype,
2582                               &BusinessWebsiteListPref,
2583                               lboBusinessWebsites,
2584                               (intValueSeek));
2585     frameCEWeb->ShowModal();
2586     delete frameCEWeb;
2587     frameCEWeb = NULL;
2590 void frmContactEditor::ModifyBusinessWebsite( wxCommandEvent& event )
2592     long longSelected = -1;
2593     int intSelectedData = 0;
2594     
2595     if (!GetSelectedItem(lboBusinessWebsites,
2596                          &longSelected,
2597                          &intSelectedData)){
2598         return;
2599     }
2600     
2601     frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
2602     frameCEWeb->SetupPointers(&BusinessWebsiteList,
2603                               &BusinessWebsiteListAltID,
2604                               &BusinessWebsiteListPID,
2605                               &BusinessWebsiteListType,
2606                               &BusinessWebsiteListTokens,
2607                               &BusinessWebsiteListMediatype,
2608                               &BusinessWebsiteListPref,
2609                               lboBusinessWebsites,
2610                               intSelectedData);
2611     frameCEWeb->SetEditorMode(TRUE, CE_WORK);
2612     frameCEWeb->ShowModal();
2613     delete frameCEWeb;
2614     frameCEWeb = NULL;
2617 void frmContactEditor::DeleteBusinessWebsite( wxCommandEvent& event )
2619     long longSelected = -1;
2620     int intSelectedData = 0;
2621     
2622     if (!GetSelectedItem(lboBusinessWebsites,
2623                          &longSelected,
2624                          &intSelectedData)){
2625         return;
2626     }
2627     
2628     lboBusinessWebsites->DeleteItem(longSelected);
2629     
2630     DeleteMapData(intSelectedData, &BusinessWebsiteList,
2631                   &BusinessWebsiteListAltID, &BusinessWebsiteListPID,
2632                   &BusinessWebsiteListType, &BusinessWebsiteListTokens,
2633                   &BusinessWebsiteListMediatype, &BusinessWebsiteListPref);
2634     
2637 void frmContactEditor::AddBusinessTitle( wxCommandEvent& event )
2639     int intResult = 0;
2640     
2641     frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
2642     frameCETitle->SetEditorMode(FALSE, CE_WORK);
2643     intResult = GetLastInt(&BusinessTitleList);
2644     frameCETitle->SetupPointers(&BusinessTitleList,
2645                                 &BusinessTitleListLanguage,
2646                                 &BusinessTitleListAltID,
2647                                 &BusinessTitleListPID,
2648                                 &BusinessTitleListType,
2649                                 &BusinessTitleListTokens,
2650                                 &BusinessTitleListPref,
2651                                 lboBusinessTitles,
2652                                 (intValueSeek));
2653     frameCETitle->ShowModal();
2654     delete frameCETitle;
2655     frameCETitle = NULL;
2658 void frmContactEditor::ModifyBusinessTitle( wxCommandEvent& event )
2660     long longSelected = -1;
2661     int intSelectedData = 0;
2662     
2663     if (!GetSelectedItem(lboBusinessTitles,
2664                          &longSelected,
2665                          &intSelectedData)){
2666         return;
2667     }
2668     
2669     frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
2670     frameCETitle->SetupPointers(&BusinessTitleList,
2671                                 &BusinessTitleListLanguage,
2672                                 &BusinessTitleListAltID,
2673                                 &BusinessTitleListPID,
2674                                 &BusinessTitleListType,
2675                                 &BusinessTitleListTokens,
2676                                 &BusinessTitleListPref,
2677                                 lboBusinessTitles,
2678                                 intSelectedData);
2679     frameCETitle->SetEditorMode(TRUE, CE_WORK);
2680     frameCETitle->ShowModal();
2681     delete frameCETitle;
2682     frameCETitle = NULL;
2685 void frmContactEditor::DeleteBusinessTitle( wxCommandEvent& event )
2687     long longSelected = -1;
2688     int intSelectedData = 0;
2689     
2690     if (!GetSelectedItem(lboBusinessTitles,
2691                          &longSelected,
2692                          &intSelectedData)){
2693         return;
2694     }
2695     
2696     lboTitles->DeleteItem(longSelected);
2697     
2698     DeleteMapData(intSelectedData, &BusinessTitleList,
2699                   &BusinessTitleListLanguage, &BusinessTitleListAltID,
2700                   &BusinessTitleListPID, &BusinessTitleListType,
2701                   &BusinessTitleListTokens, &BusinessTitleListPref);
2702     
2705 void frmContactEditor::AddBusinessRole( wxCommandEvent& event )
2707     int intResult = 0;
2708     
2709     frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
2710     frameCERole->SetEditorMode(FALSE, CE_WORK);
2711     intResult = GetLastInt(&BusinessRoleList);
2712     frameCERole->SetupPointers(&BusinessRoleList,
2713                                &BusinessRoleListLanguage,
2714                                &BusinessRoleListAltID,
2715                                &BusinessRoleListPID,
2716                                &BusinessRoleListType,
2717                                &BusinessRoleListTokens,
2718                                &BusinessRoleListPref,
2719                                lboBusinessRoles,
2720                                (intValueSeek));
2721     frameCERole->ShowModal();
2722     delete frameCERole;
2723     frameCERole = NULL;
2726 void frmContactEditor::ModifyBusinessRole( wxCommandEvent& event )
2728     long longSelected = -1;
2729     int intSelectedData = 0;
2730     
2731     if (!GetSelectedItem(lboBusinessRoles,
2732                          &longSelected,
2733                          &intSelectedData)){
2734         return;
2735     }
2736     
2737     frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
2738     frameCERole->SetupPointers(&BusinessRoleList,
2739                                &BusinessRoleListLanguage,
2740                                &BusinessRoleListAltID,
2741                                &BusinessRoleListPID,
2742                                &BusinessRoleListType,
2743                                &BusinessRoleListTokens,
2744                                &BusinessRoleListPref,
2745                                lboBusinessRoles,
2746                                intSelectedData);
2747     frameCERole->SetEditorMode(TRUE, CE_WORK);
2748     frameCERole->ShowModal();
2749     delete frameCERole;
2750     frameCERole = NULL;
2753 void frmContactEditor::DeleteBusinessRole( wxCommandEvent& event )
2755     long longSelected = -1;
2756     int intSelectedData = 0;
2757     
2758     if (!GetSelectedItem(lboBusinessRoles,
2759                          &longSelected,
2760                          &intSelectedData)){
2761         return;
2762     }
2763     
2764     lboBusinessRoles->DeleteItem(longSelected);
2765     
2766     DeleteMapData(intSelectedData, &BusinessRoleList,
2767                   &BusinessRoleListLanguage, &BusinessRoleListAltID,
2768                   &BusinessRoleListPID, &BusinessRoleListType,
2769                   &BusinessRoleListTokens, &BusinessRoleListPref);
2770     
2773 void frmContactEditor::AddBusinessOrganisation( wxCommandEvent& event )
2775     int intResult = 0;
2776     
2777     frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
2778     frameCEOrg->SetEditorMode(FALSE, CE_WORK);
2779     intResult = GetLastInt(&GeneralOrganisationsList);
2780     frameCEOrg->SetupPointers(&GeneralOrganisationsList,
2781                               &BusinessOrganisationsListLanguage,
2782                               &BusinessOrganisationsListSortAs,
2783                               &BusinessOrganisationsListAltID,
2784                               &BusinessOrganisationsListPID,
2785                               &BusinessOrganisationsListType,
2786                               &BusinessOrganisationsListTokens,
2787                               &BusinessOrganisationsListPref,
2788                               lboBusinessOrganisations,
2789                               (intValueSeek));
2790     frameCEOrg->ShowModal();
2791     delete frameCEOrg;
2792     frameCEOrg = NULL;
2795 void frmContactEditor::ModifyBusinessOrganisation( wxCommandEvent& event )
2797     long longSelected = -1;
2798     int intSelectedData = 0;
2799     
2800     if (!GetSelectedItem(lboBusinessOrganisations,
2801                          &longSelected,
2802                          &intSelectedData)){
2803         return;
2804     }
2805     
2806     frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
2807     frameCEOrg->SetupPointers(&BusinessOrganisationsList,
2808                               &BusinessOrganisationsListLanguage,
2809                               &BusinessOrganisationsListSortAs,
2810                               &BusinessOrganisationsListAltID,
2811                               &BusinessOrganisationsListPID,
2812                               &BusinessOrganisationsListType,
2813                               &BusinessOrganisationsListTokens,
2814                               &BusinessOrganisationsListPref,
2815                               lboBusinessOrganisations,
2816                               intSelectedData);
2817     frameCEOrg->SetEditorMode(TRUE, CE_WORK);
2818     frameCEOrg->ShowModal();
2819     delete frameCEOrg;
2820     frameCEOrg = NULL;
2823 void frmContactEditor::DeleteBusinessOrganisation( wxCommandEvent& event )
2825     long longSelected = -1;
2826     int intSelectedData = 0;
2827     
2828     if (!GetSelectedItem(lboBusinessOrganisations,
2829                          &longSelected,
2830                          &intSelectedData)){
2831         return;
2832     }
2833     
2834     lboBusinessOrganisations->DeleteItem(longSelected);
2835     
2836     DeleteMapData(intSelectedData, &BusinessOrganisationsList,
2837                   &BusinessOrganisationsListLanguage, &BusinessOrganisationsListSortAs,
2838                   &BusinessOrganisationsListAltID, &BusinessOrganisationsListPID,
2839                   &BusinessOrganisationsListType, &BusinessOrganisationsListTokens,
2840                   &BusinessOrganisationsListPref);
2841     
2844 void frmContactEditor::AddBusinessNote( wxCommandEvent& event )
2846     int intResult = 0;
2847     
2848     frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
2849     frameCENote->SetEditorMode(FALSE, CE_WORK);
2850     intResult = GetLastInt(&BusinessNoteList);
2851     frameCENote->SetupPointers(&BusinessNoteList,
2852                                &BusinessNoteListLanguage,
2853                                &BusinessNoteListAltID,
2854                                &BusinessNoteListPID,
2855                                &BusinessNoteListType,
2856                                &BusinessNoteListTokens,
2857                                &BusinessNoteListPref,
2858                                lboBusinessNotes,
2859                                (intValueSeek));
2860     frameCENote->ShowModal();
2861     delete frameCENote;
2862     frameCENote = NULL;
2865 void frmContactEditor::ModifyBusinessNote( wxCommandEvent& event )
2867     long longSelected = -1;
2868     int intSelectedData = 0;
2869     
2870     if (!GetSelectedItem(lboBusinessNotes,
2871                          &longSelected,
2872                          &intSelectedData)){
2873         return;
2874     }
2875     
2876     frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
2877     frameCENote->SetupPointers(&BusinessNoteList,
2878                                &BusinessNoteListLanguage,
2879                                &BusinessNoteListAltID,
2880                                &BusinessNoteListPID,
2881                                &BusinessNoteListType,
2882                                &BusinessNoteListTokens,
2883                                &BusinessNoteListPref,
2884                                lboBusinessNotes,
2885                                intSelectedData);
2886     frameCENote->SetEditorMode(TRUE, CE_WORK);
2887     frameCENote->ShowModal();
2888     delete frameCENote;
2889     frameCENote = NULL;
2892 void frmContactEditor::DeleteBusinessNote( wxCommandEvent& event )
2894     long longSelected = -1;
2895     int intSelectedData = 0;
2896     
2897     if (!GetSelectedItem(lboBusinessNotes,
2898                          &longSelected,
2899                          &intSelectedData)){
2900         return;
2901     }
2902     
2903     lboBusinessNotes->DeleteItem(longSelected);
2904     
2905     DeleteMapData(intSelectedData, &BusinessNoteList,
2906                   &BusinessNoteListLanguage, &BusinessNoteListAltID,
2907                   &BusinessNoteListPID, &BusinessNoteListType,
2908                   &BusinessNoteListTokens, &BusinessNoteListPref);
2909     
2912 void frmContactEditor::AddCategory( wxCommandEvent& event )
2914     int intResult = 0;
2915     
2916     frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
2917     frameCECategory->SetEditorMode(FALSE);
2918     intResult = GetLastInt(&CategoriesList);
2919     frameCECategory->SetupPointers(&CategoriesList,
2920                                    &CategoriesListAltID,
2921                                    &CategoriesListPID,
2922                                    &CategoriesListType,
2923                                    &CategoriesListTokens,
2924                                    &CategoriesListPref,
2925                                    lboCategories,
2926                                    (intValueSeek));
2927     frameCECategory->ShowModal();
2928     delete frameCECategory;
2929     frameCECategory = NULL;
2932 void frmContactEditor::ModifyCategory( wxCommandEvent& event )
2934     long longSelected = -1;
2935     int intSelectedData = 0;
2936     
2937     if (!GetSelectedItem(lboCategories,
2938                          &longSelected,
2939                          &intSelectedData)){
2940         return;
2941     }
2942     
2943     frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
2944     frameCECategory->SetupPointers(&CategoriesList,
2945                                    &CategoriesListAltID,
2946                                    &CategoriesListPID,
2947                                    &CategoriesListType,
2948                                    &CategoriesListTokens,
2949                                    &CategoriesListPref,
2950                                    lboCategories,
2951                                    intSelectedData);
2952     frameCECategory->SetEditorMode(TRUE);
2953     frameCECategory->ShowModal();
2954     delete frameCECategory;
2955     frameCECategory = NULL;
2958 void frmContactEditor::DeleteCategory( wxCommandEvent& event )
2960     long longSelected = -1;
2961     int intSelectedData = 0;
2962     
2963     if (!GetSelectedItem(lboCategories,
2964                          &longSelected,
2965                          &intSelectedData)){
2966         return;
2967     }
2968     
2969     lboCategories->DeleteItem(longSelected);
2970     
2971     DeleteMapData(intSelectedData, &CategoriesList,
2972                   &CategoriesListAltID, &CategoriesListPID,
2973                   &CategoriesListType, &CategoriesListTokens,
2974                   &CategoriesListPref);
2975     
2978 void frmContactEditor::AddGroup( wxCommandEvent& event )
2980     
2981     int intResult = 0;
2982     
2983     XABViewMode XVMData = MainPtr->GetViewMode();
2984     
2985     frmContactEditorGroup *frameCEGroup = new frmContactEditorGroup ( this );
2986     frameCEGroup->SetEditorMode(FALSE, XVMData);
2987     intResult = GetLastInt(&GroupsList);
2988     frameCEGroup->SetupPointers(&GroupsList,
2989                                 lboGroups,
2990                                 wxSContactAccount,
2991                                 intValueSeek);
2992     frameCEGroup->ShowModal();
2993     delete frameCEGroup;
2994     frameCEGroup = NULL;
2995     
2998 void frmContactEditor::ModifyGroup( wxCommandEvent& event )
3000     
3001     return;
3002     
3005 void frmContactEditor::DeleteGroup( wxCommandEvent& event )
3007     
3008     long longSelected = -1;
3009     int intSelectedData = 0;
3010     
3011     if (!GetSelectedItem(lboGroups,
3012                          &longSelected,
3013                          &intSelectedData)){
3014         return;
3015     }
3016     
3017     lboGroups->DeleteItem(longSelected);
3018     
3019     DeleteMapData(intSelectedData, &GroupsList);
3020     
3023 void frmContactEditor::AddPicture( wxCommandEvent& event )
3025     int intResult = 0;
3026     
3027     frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this );
3028     frameCEPicture->SetEditorMode(FALSE);
3029     intResult = GetLastInt(&PicturesList);
3030     frameCEPicture->SetupPointers(&PicturesList,
3031                                   &PicturesListAltID,
3032                                   &PicturesListPID,
3033                                   &PicturesListType,
3034                                   &PicturesListPicEncType,
3035                                   &PicturesListPictureType,
3036                                   &PicturesListTokens,
3037                                   &PicturesListMediatype,
3038                                   &PicturesListPref,
3039                                   lboPictures,
3040                                   (intValueSeek));
3041     frameCEPicture->ShowModal();
3042     delete frameCEPicture;
3043     frameCEPicture = NULL;
3046 void frmContactEditor::ModifyPicture( wxCommandEvent& event )
3048     long longSelected = -1;
3049     int intSelectedData = 0;
3050     
3051     if (!GetSelectedItem(lboPictures,
3052                          &longSelected,
3053                          &intSelectedData)){
3054         return;
3055     }
3056     
3057     frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this );
3058     frameCEPicture->SetupPointers(&PicturesList,
3059                                   &PicturesListAltID,
3060                                   &PicturesListPID,
3061                                   &PicturesListType,
3062                                   &PicturesListPicEncType,
3063                                   &PicturesListPictureType,
3064                                   &PicturesListTokens,
3065                                   &PicturesListMediatype,
3066                                   &PicturesListPref,
3067                                   lboPictures,
3068                                   intSelectedData);
3069     frameCEPicture->SetEditorMode(TRUE);
3070     frameCEPicture->ShowModal();
3071     delete frameCEPicture;
3072     frameCEPicture = NULL;
3073     
3076 void frmContactEditor::DeletePicture( wxCommandEvent& event )
3078     long longSelected = -1;
3079     int intSelectedData = 0;
3080     
3081     if (!GetSelectedItem(lboPictures,
3082                          &longSelected,
3083                          &intSelectedData)){
3084         return;
3085     }
3086     
3087     lboPictures->DeleteItem(longSelected);
3088     
3089     DeleteMapData(intSelectedData,
3090                   &PicturesList, &PicturesListAltID, &PicturesListPID, &PicturesListType,
3091                   &PicturesListPicEncType, &PicturesListPictureType, &PicturesListTokens,
3092                   &PicturesListMediatype, &PicturesListPref);
3093     
3094     wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
3095     wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
3096     PictureImage = (wxBitmap)misc_emptyimage_png;
3097     
3098     imgPicture->SetBitmap(PictureImage);
3101 void frmContactEditor::LoadPicture( wxListEvent& event )
3103     
3104     long longSelected = -1;
3105     int intSelectedData = 0;
3106     
3107     if (!GetSelectedItem(lboPictures,
3108                          &longSelected,
3109                          &intSelectedData)){
3110         return;
3111     }
3112     
3113     std::string base64dec;
3114     
3115     std::map<int,std::string>::iterator initier;
3116     
3117     initier = PicturesList.find(intSelectedData);
3118     
3119     base64dec = base64_decode(initier->second);
3120     
3121     
3122     wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
3123     wxImage photo;
3124     //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
3125     
3126     if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
3127         
3128         return;
3129         
3130     }
3131     
3132     
3133     PictureImage = (wxBitmap)photo;
3134     imgPicture->SetBitmap(PictureImage);
3135     
3138 void frmContactEditor::LoadLogo( wxListEvent& event )
3140     
3141     long longSelected = -1;
3142     int intSelectedData = 0;
3143     
3144     if (!GetSelectedItem(lboLogos,
3145                          &longSelected,
3146                          &intSelectedData)){
3147         return;
3148     }
3149     
3150     std::string base64dec;
3151     
3152     std::map<int,std::string>::iterator initier;
3153     
3154     initier = LogosList.find(intSelectedData);
3155     
3156     base64dec = base64_decode(initier->second);
3157     
3158     
3159     wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
3160     wxImage photo;
3161     //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
3162     
3163     if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
3164         
3165         return;
3166         
3167     }
3168     
3169     
3170     LogoImage = (wxBitmap)photo;
3171     imgLogo->SetBitmap(LogoImage);
3172     
3175 void frmContactEditor::AddLogo( wxCommandEvent& event )
3177     int intResult = 0;
3178     
3179     frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
3180     frameCELogo->SetEditorMode(FALSE);
3181     intResult = GetLastInt(&LogosList);
3182     frameCELogo->SetupPointers(&LogosList,
3183                                &LogosListAltID,
3184                                &LogosListPID,
3185                                &LogosListType,
3186                                &LogosListPicEncType,
3187                                &LogosListPictureType,
3188                                &LogosListTokens,
3189                                &LogosListMediatype,
3190                                &LogosListPref,
3191                                lboLogos,
3192                                (intValueSeek));
3193     frameCELogo->ShowModal();
3194     delete frameCELogo;
3195     frameCELogo = NULL;
3198 void frmContactEditor::ModifyLogo( wxCommandEvent& event )
3200     long longSelected = -1;
3201     int intSelectedData = 0;
3202     
3203     if (!GetSelectedItem(lboLogos,
3204                          &longSelected,
3205                          &intSelectedData)){
3206         return;
3207     }
3208     
3209     frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
3210     frameCELogo->SetupPointers(&LogosList,
3211                                &LogosListAltID,
3212                                &LogosListPID,
3213                                &LogosListType,
3214                                &LogosListPicEncType,
3215                                &LogosListPictureType,
3216                                &LogosListTokens,
3217                                &LogosListMediatype,
3218                                &LogosListPref,
3219                                lboLogos,
3220                                intSelectedData);
3221     frameCELogo->SetEditorMode(TRUE);
3222     frameCELogo->ShowModal();
3223     delete frameCELogo;
3224     frameCELogo = NULL;
3227 void frmContactEditor::DeleteLogo( wxCommandEvent& event )
3229     long longSelected = -1;
3230     int intSelectedData = 0;
3231     
3232     if (!GetSelectedItem(lboLogos,
3233                          &longSelected,
3234                          &intSelectedData)){
3235         return;
3236     }
3237     
3238     lboLogos->DeleteItem(longSelected);
3239     
3240     DeleteMapData(intSelectedData,
3241                   &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
3242                   &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
3243                   &LogosListMediatype, &LogosListPref);
3244     
3245     wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
3246     wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
3247     LogoImage = (wxBitmap)misc_emptyimage_png;
3248     
3249     imgLogo->SetBitmap(LogoImage);
3252 void frmContactEditor::AddSound( wxCommandEvent& event )
3254     int intResult = 0;
3255     
3256     frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
3257     frameCESound->SetEditorMode(FALSE);
3258     intResult = GetLastInt(&SoundsList);
3259     frameCESound->SetupPointers(&SoundsList,
3260                                 &SoundsListAltID,
3261                                 &SoundsListPID,
3262                                 &SoundsListType,
3263                                 &SoundsListAudioType,
3264                                 &SoundsListAudioEncType,
3265                                 &SoundsListTokens,
3266                                 &SoundsListMediatype,
3267                                 &SoundsListPref,
3268                                 lboSounds,
3269                                 (intValueSeek));
3270     frameCESound->ShowModal();
3271     delete frameCESound;
3272     frameCESound = NULL;
3275 void frmContactEditor::ModifySound( wxCommandEvent& event )
3277     long longSelected = -1;
3278     int intSelectedData = 0;
3279     
3280     if (!GetSelectedItem(lboSounds,
3281                          &longSelected,
3282                          &intSelectedData)){
3283         return;
3284     }
3285     
3286     frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
3287     frameCESound->SetupPointers(&SoundsList,
3288                                 &SoundsListAltID,
3289                                 &SoundsListPID,
3290                                 &SoundsListType,
3291                                 &SoundsListAudioType,
3292                                 &SoundsListAudioEncType,
3293                                 &SoundsListTokens,
3294                                 &SoundsListMediatype,
3295                                 &SoundsListPref,
3296                                 lboSounds,
3297                                 intSelectedData);
3298     frameCESound->SetEditorMode(TRUE);
3299     frameCESound->ShowModal();
3300     delete frameCESound;
3301     frameCESound = NULL;
3304 void frmContactEditor::DeleteSound( wxCommandEvent& event )
3306     long longSelected = -1;
3307     int intSelectedData = 0;
3308     
3309     if (!GetSelectedItem(lboSounds,
3310                          &longSelected,
3311                          &intSelectedData)){
3312         return;
3313     }
3314     
3315     lboSounds->DeleteItem(longSelected);
3316     
3317     DeleteMapData(intSelectedData, &SoundsList, &SoundsListAltID,
3318                   &SoundsListPID, &SoundsListType, &SoundsListAudioType,
3319                   &SoundsListAudioEncType, &SoundsListTokens, &SoundsListMediatype,
3320                   &SoundsListPref);
3321     
3324 void frmContactEditor::PlaySoundDetach()
3326     
3327     if (!AudioStreamPlayback.openFromMemory(base64dec.c_str(), base64declen)){
3328         
3329         // Can't load file. We must flee...
3330         // Also show an error message too.
3331         
3332         wxMessageBox(_("This file is in an audio format that is unsupported or is not an audio file."), _("Error opening audio file"), wxICON_ERROR);
3333         
3334         return;
3335         
3336     }
3337     
3338     btnStop->Enable();
3339     
3340     //AudioStreamPlayback.setbuffer(AudioBuffer);
3341     AudioStreamPlayback.play();
3342     
3343     /*timespec n1, n2;
3344      
3345      n1.tv_sec = 0;
3346      n1.tv_nsec = 100000000L;*/
3347     
3348     //while (TimeA != TimeB){
3349     while (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
3350         
3351         // We poll this every 100ms in order to conserve CPU usage.
3352         
3353         SleepFor(100000000);
3354         
3355     }
3356     
3357     btnStop->Disable();
3358     
3361 void frmContactEditor::PlaySound( wxCommandEvent& event )
3363     
3364     //sf::Music *AudioPlayback = new sf::Music;
3365     //AudioStream *AudioStreamPlayback = new AudioStream;
3366     //sf::SoundBuffer *AudioBuffer = new sf::SoundBuffer;
3367     
3368     //sf::Sound *AudioPlayback = new sf::Sound;
3369     
3370     //delete(AudioPlayback);
3371     
3372     //delete(AudioPlayback);
3373     //delete(AudioStreamPlayback);
3374     //delete(AudioBuffer);
3375     
3376     //AudioPlayback = NULL;
3377     //AudioStreamPlayback = NULL;
3378     //AudioBuffer = NULL;
3379     
3380     //return;
3381     
3382     long longSelected = -1;
3383     int intSelectedData = 0;
3384     
3385     // Check if sound is still being played and if it is, stop it.
3386     
3387     if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
3388         
3389         AudioStreamPlayback.stop();
3390         
3391     }
3392     
3393     if (!GetSelectedItem(lboSounds,
3394                          &longSelected,
3395                          &intSelectedData)){
3396         return;
3397     }
3398     
3399     std::map<int, std::string>::iterator initier;
3400     
3401     initier = SoundsList.find(intSelectedData);
3402     
3403     base64dec = base64_decode(initier->second);
3404     base64declen = base64dec.size();
3405     
3406     std::thread AudioPlaybackThread(&frmContactEditor::PlaySoundDetach, this);
3407     AudioPlaybackThread.detach();
3408     
3409     return;
3410     
3413 void frmContactEditor::StopSound( wxCommandEvent& event )
3415     
3416     if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
3417         
3418         AudioStreamPlayback.stop();
3419         
3420     }
3421     
3422     btnStop->Disable();
3423     
3424     return;
3425     
3428 void frmContactEditor::AddCalendarAddress( wxCommandEvent& event )
3430     int intResult = 0;
3431     
3432     frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
3433     frameCECalAdr->SetEditorMode(FALSE);
3434     intResult = GetLastInt(&CalendarList);
3435     frameCECalAdr->SetupPointers(&CalendarList,
3436                                  &CalendarListAltID,
3437                                  &CalendarListPID,
3438                                  &CalendarListType,
3439                                  &CalendarListTokens,
3440                                  &CalendarListPref,
3441                                  lboCalendarAddresses,
3442                                  (intValueSeek));
3443     frameCECalAdr->ShowModal();
3444     delete frameCECalAdr;
3445     frameCECalAdr = NULL;
3448 void frmContactEditor::ModifyCalendarAddress( wxCommandEvent& event )
3450     long longSelected = -1;
3451     int intSelectedData = 0;
3452     
3453     if (!GetSelectedItem(lboCalendarAddresses,
3454                          &longSelected,
3455                          &intSelectedData)){
3456         return;
3457     }
3458     
3459     frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
3460     frameCECalAdr->SetupPointers(&CalendarList,
3461                                  &CalendarListAltID,
3462                                  &CalendarListPID,
3463                                  &CalendarListType,
3464                                  &CalendarListTokens,
3465                                  &CalendarListPref,
3466                                  lboCalendarAddresses,
3467                                  intSelectedData);
3468     frameCECalAdr->SetEditorMode(TRUE);
3469     frameCECalAdr->ShowModal();
3470     delete frameCECalAdr;
3471     frameCECalAdr = NULL;
3474 void frmContactEditor::DeleteCalendarAddress( wxCommandEvent& event )
3476     long longSelected = -1;
3477     int intSelectedData = 0;
3478     
3479     if (!GetSelectedItem(lboCalendarAddresses,
3480                          &longSelected,
3481                          &intSelectedData)){
3482         return;
3483     }
3484     
3485     lboCalendarAddresses->DeleteItem(longSelected);
3486     
3487     DeleteMapData(intSelectedData, &CalendarList, &CalendarListAltID,
3488                   &CalendarListPID, &CalendarListType, &CalendarListTokens,
3489                   &CalendarListPref);
3490     
3493 void frmContactEditor::AddCalendarRequest( wxCommandEvent& event )
3495     int intResult = 0;
3496     
3497     frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
3498     frameCECalAdr->SetEditorMode(FALSE);
3499     intResult = GetLastInt(&CalendarRequestList);
3500     frameCECalAdr->SetupPointers(&CalendarRequestList,
3501                                  &CalendarRequestListAltID,
3502                                  &CalendarRequestListPID,
3503                                  &CalendarRequestListType,
3504                                  &CalendarRequestListTokens,
3505                                  &CalendarRequestListPref,
3506                                  lboCalendarRequestAddress,
3507                                  (intValueSeek));
3508     frameCECalAdr->ShowModal();
3509     delete frameCECalAdr;
3510     frameCECalAdr = NULL;
3513 void frmContactEditor::ModifyCalendarRequest( wxCommandEvent& event )
3515     long longSelected = -1;
3516     int intSelectedData = 0;
3517     
3518     if (!GetSelectedItem(lboCalendarRequestAddress,
3519                          &longSelected,
3520                          &intSelectedData)){
3521         return;
3522     }
3523     
3524     frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
3525     frameCECalAdr->SetupPointers(&CalendarList,
3526                                  &CalendarRequestListAltID,
3527                                  &CalendarRequestListPID,
3528                                  &CalendarRequestListType,
3529                                  &CalendarRequestListTokens,
3530                                  &CalendarRequestListPref,
3531                                  lboCalendarRequestAddress,
3532                                  intSelectedData);
3533     frameCECalAdr->SetEditorMode(TRUE);
3534     frameCECalAdr->ShowModal();
3535     delete frameCECalAdr;
3536     frameCECalAdr = NULL;
3539 void frmContactEditor::DeleteCalendarRequest( wxCommandEvent& event )
3541     long longSelected = -1;
3542     int intSelectedData = 0;
3543     
3544     if (!GetSelectedItem(lboCalendarRequestAddress,
3545                          &longSelected,
3546                          &intSelectedData)){
3547         return;
3548     }
3549     
3550     lboCalendarRequestAddress->DeleteItem(longSelected);
3551     
3552     DeleteMapData(intSelectedData, &CalendarRequestList,
3553                   &CalendarRequestListAltID, &CalendarRequestListPID,
3554                   &CalendarRequestListType, &CalendarRequestListTokens,
3555                   &CalendarRequestListPref);
3558 void frmContactEditor::AddFreeBusy( wxCommandEvent& event )
3560     int intResult = 0;
3561     
3562     frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
3563     frameCECalAdr->SetEditorMode(FALSE);
3564     intResult = GetLastInt(&FreeBusyList);
3565     frameCECalAdr->SetupPointers(&FreeBusyList,
3566                                  &FreeBusyListAltID,
3567                                  &FreeBusyListPID,
3568                                  &FreeBusyListType,
3569                                  &FreeBusyListTokens,
3570                                  &FreeBusyListPref,
3571                                  lboFreeBusyAddresses,
3572                                  (intValueSeek));
3573     frameCECalAdr->ShowModal();
3574     delete frameCECalAdr;
3575     frameCECalAdr = NULL;
3578 void frmContactEditor::ModifyFreeBusy( wxCommandEvent& event )
3580     long longSelected = -1;
3581     int intSelectedData = 0;
3582     
3583     if (!GetSelectedItem(lboFreeBusyAddresses,
3584                          &longSelected,
3585                          &intSelectedData)){
3586         return;
3587     }
3588     
3589     frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
3590     frameCECalAdr->SetupPointers(&FreeBusyList,
3591                                  &FreeBusyListAltID,
3592                                  &FreeBusyListPID,
3593                                  &FreeBusyListType,
3594                                  &FreeBusyListTokens,
3595                                  &FreeBusyListPref,
3596                                  lboFreeBusyAddresses,
3597                                  intSelectedData);
3598     frameCECalAdr->SetEditorMode(TRUE);
3599     frameCECalAdr->ShowModal();
3600     delete frameCECalAdr;
3601     frameCECalAdr = NULL;
3604 void frmContactEditor::DeleteFreeBusy( wxCommandEvent& event )
3606     long longSelected = -1;
3607     int intSelectedData = 0;
3608     
3609     if (!GetSelectedItem(lboFreeBusyAddresses,
3610                          &longSelected,
3611                          &intSelectedData)){
3612         return;
3613     }
3614     
3615     lboFreeBusyAddresses->DeleteItem(longSelected);
3616     
3617     DeleteMapData(intSelectedData, &FreeBusyList, &FreeBusyListAltID,
3618                   &FreeBusyListPID, &FreeBusyListType, &FreeBusyListTokens,
3619                   &FreeBusyListPref);
3620     
3623 void frmContactEditor::AddKey( wxCommandEvent& event )
3625     int intResult = 0;
3626     
3627     frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this );
3628     frameCEKey->SetEditorMode(FALSE);
3629     intResult = GetLastInt(&KeyList);
3630     frameCEKey->SetupPointers(&KeyList,
3631                               &KeyListAltID,
3632                               &KeyListPID,
3633                               &KeyListKeyType,
3634                               &KeyListDataType,
3635                               &KeyListType,
3636                               &KeyListTokens,
3637                               &KeyListPref,
3638                               lboKeys,
3639                               (intValueSeek));
3640     frameCEKey->ShowModal();
3641     delete frameCEKey;
3642     frameCEKey = NULL;
3645 void frmContactEditor::ModifyKey( wxCommandEvent& event )
3647     long longSelected = -1;
3648     int intSelectedData = 0;
3649     
3650     if (!GetSelectedItem(lboKeys,
3651                          &longSelected,
3652                          &intSelectedData)){
3653         return;
3654     }
3655     
3656     frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this );
3657     frameCEKey->SetupPointers(&KeyList,
3658                               &KeyListAltID,
3659                               &KeyListPID,
3660                               &KeyListKeyType,
3661                               &KeyListDataType,
3662                               &KeyListType,
3663                               &KeyListTokens,
3664                               &KeyListPref,
3665                               lboKeys,
3666                               intSelectedData);
3667     frameCEKey->SetEditorMode(TRUE);
3668     frameCEKey->ShowModal();
3669     delete frameCEKey;
3670     frameCEKey = NULL;
3673 void frmContactEditor::DeleteKey( wxCommandEvent& event )
3675     long longSelected = -1;
3676     int intSelectedData = 0;
3677     
3678     if (!GetSelectedItem(lboKeys,
3679                          &longSelected,
3680                          &intSelectedData)){
3681         return;
3682     }
3683     
3684     lboKeys->DeleteItem(longSelected);
3685     
3686     DeleteMapData(intSelectedData, &KeyList, &KeyListAltID,
3687                   &KeyListPID, &KeyListKeyType, &KeyListDataType, &KeyListType,
3688                   &KeyListTokens, &KeyListPref);
3689     
3692 void frmContactEditor::AddVendorNamespace( wxCommandEvent& event )
3694     int intResult = 0;
3695     
3696     frmContactEditorVendor *frameCEVen = new frmContactEditorVendor ( this );
3697     frameCEVen->SetEditorMode(FALSE);
3698     intResult = GetLastInt(&VendorList);
3699     frameCEVen->SetupPointers(&VendorList,
3700                               &VendorListPEN,
3701                               &VendorListElement,
3702                               lboVendorNamespace,
3703                               (intValueSeek));
3704     frameCEVen->ShowModal();
3705     delete frameCEVen;
3706     frameCEVen = NULL;
3709 void frmContactEditor::ModifyVendorNamespace( wxCommandEvent& event )
3711     long longSelected = -1;
3712     int intSelectedData = 0;
3713     
3714     if (!GetSelectedItem(lboVendorNamespace,
3715                          &longSelected,
3716                          &intSelectedData)){
3717         return;
3718     }
3719     
3720     frmContactEditorVendor *frameCEVen = new frmContactEditorVendor ( this );
3721     frameCEVen->SetupPointers(&VendorList,
3722                               &VendorListPEN,
3723                               &VendorListElement,
3724                               lboVendorNamespace,
3725                               intSelectedData);
3726     frameCEVen->SetEditorMode(TRUE);
3727     frameCEVen->ShowModal();
3728     delete frameCEVen;
3729     frameCEVen = NULL;
3732 void frmContactEditor::DeleteVendorNamespace( wxCommandEvent& event )
3734     long longSelected = -1;
3735     int intSelectedData = 0;
3736     
3737     if (!GetSelectedItem(lboVendorNamespace,
3738                          &longSelected,
3739                          &intSelectedData)){
3740         return;
3741     }
3742     
3743     lboVendorNamespace->DeleteItem(longSelected);
3744     
3745     DeleteMapData(intSelectedData, &VendorList, &VendorListPEN,
3746                   &VendorListElement);
3747     
3750 void frmContactEditor::AddXToken( wxCommandEvent& event )
3752     int intResult = 0;
3753     
3754     frmContactEditorXToken *frameCEXT = new frmContactEditorXToken ( this );
3755     frameCEXT->SetEditorMode(FALSE);
3756     intResult = GetLastInt(&XTokenList);
3757     frameCEXT->SetupPointers(&XTokenList,
3758                              &XTokenListTokens,
3759                              lboXToken,
3760                              (intValueSeek));
3761     frameCEXT->ShowModal();
3762     delete frameCEXT;
3763     frameCEXT = NULL;
3766 void frmContactEditor::ModifyXToken( wxCommandEvent& event )
3768     long longSelected = -1;
3769     int intSelectedData = 0;
3770     
3771     if (!GetSelectedItem(lboXToken,
3772                          &longSelected,
3773                          &intSelectedData)){
3774         return;
3775     }
3776     
3777     frmContactEditorXToken *frameCEXT = new frmContactEditorXToken ( this );
3778     frameCEXT->SetupPointers(&XTokenList,
3779                              &XTokenListTokens,
3780                              lboXToken,
3781                              intSelectedData);
3782     frameCEXT->SetEditorMode(TRUE);
3783     frameCEXT->ShowModal();
3784     delete frameCEXT;
3785     frameCEXT = NULL;
3788 void frmContactEditor::DeleteXToken( wxCommandEvent& event )
3790     long longSelected = -1;
3791     int intSelectedData = 0;
3792     
3793     if (!GetSelectedItem(lboXToken,
3794                          &longSelected,
3795                          &intSelectedData)){
3796         return;
3797     }
3798     
3799     lboXToken->DeleteItem(longSelected);
3800     
3801     DeleteMapData(intSelectedData, &XTokenList, &XTokenListTokens);
3802     
3805 void frmContactEditor::SaveContact( wxCommandEvent& event )
3807     
3808     // Check if Display As combo box has a value in it.
3809     // Do not go any further if there is no value.
3810     
3811     wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
3812     
3813     if (cmbDisplayAsValue.IsEmpty()){
3814         
3815         wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
3816         return;
3817         
3818     }
3819     
3820     // Save the updated contact data.
3821     
3822     vCard ContactData;
3823     wxString FilenameFinal;
3824     bool ReplaceContact = FALSE;
3825     
3826     if (cmbType->GetCurrentSelection() == 1 ||
3827         cmbType->GetCurrentSelection() == 3 ||
3828         cmbType->GetCurrentSelection() == 4){
3829         
3830         if (IsGroup == TRUE){
3831             
3832             // Mark contact for replacing.
3833             
3834             ReplaceContact = TRUE;
3835             
3836         }
3837         
3838     } else if (cmbType->GetCurrentSelection() == 2){
3839         
3840         if (IsGroup == TRUE){
3841             
3842             // Mark contact for replacing.
3843             
3844             ReplaceContact = TRUE;
3845             
3846         }
3847         
3848     }
3849     
3850     if (ReplaceContact == TRUE){
3851         
3852         wxString wxDelSplitFilename;
3853         wxString wxDelFinalFilename;
3854         wxString wxSDelDataURL;
3855         wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
3856         while(wSTDelFilename.HasMoreTokens()){
3857             
3858             wxDelSplitFilename = wSTDelFilename.GetNextToken();
3859             
3860         }
3861         
3862         wxSDelDataURL = wxDelSplitFilename;
3863         
3864         // Delete the contact from the server as it will be useless in certain
3865         // address book clients.
3866         
3867         ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
3868         
3869         // Clear the filename so the trigger to recreate the UID is done.
3870         
3871         wxSContactFilename.Clear();
3872         EditMode = FALSE;
3873         
3874     }
3875     
3876     if (wxSContactFilename.IsEmpty()){
3877         
3878         // Generate a random UUID.
3879         
3880         UIDToken = GenerateUUID();
3881         UIDToken = UIDToken.MakeUpper();
3882         
3883         // Setup the filename.
3884         
3885         FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
3886         
3887 #if defined(__HAIKU__)
3888         
3889         //preffilename = wxT("noo");
3890         
3891 #elif defined(__WIN32__)
3892         
3893         FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
3894         FilenameFinal.Append(UIDToken);
3895         FilenameFinal.Append(wxT(".vcf"));
3896         wxSContactFilename = FilenameFinal;
3897         
3898 #else
3899         
3900         FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
3901         FilenameFinal.Append(UIDToken);
3902         FilenameFinal.Append(wxT(".vcf"));
3903         wxSContactFilename = FilenameFinal;
3904         
3905 #endif
3906         
3907     } else {
3908         
3909         if (UIDToken.IsEmpty()){
3910             
3911             // UID Token is empty. (Shouldn't be).
3912             // Generate a new UID Token.
3913             
3914             /*boost::uuids::uuid ContactUUID = boost::uuids::random_generator()();
3915              std::string sstContactUUID = boost::uuids::to_string(ContactUUID);
3916              wxString strContactUUID(sstContactUUID.c_str(), wxConvUTF8);
3917              UIDToken = strContactUUID;*/
3918             UIDToken = GenerateUUID();
3919             UIDToken = UIDToken.MakeUpper();
3920             
3921         }
3922         FilenameFinal = wxSContactFilename;
3923         
3924     }
3925     
3926     // Setup the data and write it into the account folder.
3927     
3928     // Begin preperations to write the contact to a file.
3929     
3930     bool boolValue = FALSE;
3931     bool boolValue2 = FALSE;
3932     bool FNFirst = TRUE;
3933     bool NNGeneralFirst = TRUE;
3934     bool NNHomeFirst = TRUE;
3935     bool NNWorkFirst = TRUE;
3936     int intFNCount = 0;
3937     std::map<int,int>::iterator intiter;
3938     std::map<int,wxString>::iterator striter;
3939     
3940     ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
3941     ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
3942     
3943     // Setup the version string.
3944     
3945     strValue.Append(wxT("-//Xestia//Address Book Version "));
3946     strValue.Append(wxT(XSDAB_VERSION));
3947     strValue.Append(wxT("//KW"));
3948     
3949     ContactData.Add(wxT("PRODID"), strValue, FALSE);
3950     
3951     // Setup the name.
3952     
3953     strValue.Clear();
3954     
3955     // Setup the name field.
3956     
3957     strValue = txtSurname->GetValue() + wxT(";") +
3958     txtForename->GetValue() + wxT(";") +
3959     txtOtherNames->GetValue() + wxT(";") +
3960     txtTitle->GetValue() + wxT(";") +
3961     txtSuffix->GetValue();
3962     
3963     strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
3964     strValue2.Trim();
3965     
3966     if (NameTokens.IsEmpty()){
3967         ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
3968     } else {
3969         ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + NameTokens, strValue, FALSE);
3970     }
3971     
3972     if (cmbType->GetCurrentSelection() == 1){
3973         
3974         ContactData.AddRaw(wxT("KIND"), wxT("individual"));
3975         
3976     } else if (cmbType->GetCurrentSelection() == 2){
3977         
3978         ContactData.AddRaw(wxT("KIND"), wxT("group"));
3979         
3980         // Go through each of the members and write them out.
3981         
3982         for (std::map<int, wxString>::iterator itemiter = GroupsList.begin();
3983              itemiter != GroupsList.end(); ++itemiter){
3984             
3985             ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
3986             
3987         }
3988         
3989     } else if (cmbType->GetCurrentSelection() == 3){
3990         
3991         ContactData.AddRaw(wxT("KIND"), wxT("org"));
3992         
3993     } else if (cmbType->GetCurrentSelection() == 4){
3994         
3995         ContactData.AddRaw(wxT("KIND"), wxT("location"));
3996         
3997     }
3998     
3999     
4000     // Setup the nicknames (General, Home & Business).
4001     
4002     strValue.Clear();
4003     strValue2.Clear();
4004     strValue3.Clear();
4005     
4006     boolValue = FALSE;
4007     boolValue2 = FALSE;
4008     intValue2 = 0;
4009     intValue  = 0;
4010     
4011     // Setup the gender.
4012     
4013     if (cmbGender->GetCurrentSelection() != 0){
4014         
4015         switch(cmbGender->GetCurrentSelection()){
4016                 
4017             case 1:
4018                 
4019                 strValue = wxT("M");
4020                 break;
4021                 
4022             case 2:
4023                 
4024                 strValue = wxT("F");
4025                 break;
4026                 
4027             case 3:
4028                 
4029                 strValue = wxT("O");
4030                 break;
4031                 
4032             case 4:
4033                 
4034                 strValue = wxT("N");
4035                 break;
4036                 
4037             case 5:
4038                 
4039                 strValue = wxT("U");
4040                 break;
4041                 
4042         }
4043         
4044     }
4045     
4046     if (!txtGenderDescription->IsEmpty()){
4047         
4048         strValue2 = txtGenderDescription->GetValue();
4049         
4050     }
4051     
4052     if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
4053         
4054         EscapeString(&strValue2, FALSE);
4055         
4056         if (!GenderTokens.IsEmpty()){
4057             
4058             if (!strValue2.IsEmpty()){
4059                 
4060                 ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue + wxT(";") + strValue2);
4061                 
4062             } else {
4063                 
4064                 ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue);
4065                 
4066             }
4067             
4068         } else {
4069             
4070             if (!strValue2.IsEmpty()){
4071                 
4072                 ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
4073                 
4074             } else {
4075                 
4076                 ContactData.AddRaw(wxT("GENDER"), strValue);
4077                 
4078             }
4079             
4080         }
4081         
4082     }
4083     
4084     strValue.Clear();
4085     strValue2.Clear();
4086     strValue3.Clear();
4087     
4088     boolValue = FALSE;
4089     boolValue2 = FALSE;
4090     intValue2 = 0;
4091     intValue  = 0;
4092     
4093     // Process Label.
4094     
4095     strValue3 = BirthdayAltID;
4096     
4097     if (!strValue3.IsEmpty()){
4098         
4099         strValue3.Trim();
4100         strValue3.Trim();
4101         boolValue2 = TRUE;
4102         strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
4103         
4104         boolValue = TRUE;
4105         
4106     }
4107     
4108     //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
4109     //strValue2 =
4110     
4111     // Process Language.
4112     
4113     strValue3 = BirthdayCalScale;
4114     
4115     if (!strValue3.IsEmpty()){
4116         
4117         strValue3.Trim();
4118         strValue3.Trim();
4119         
4120         if (boolValue2 == TRUE){
4121             
4122             strValue2.Append(wxT(";"));
4123             
4124         } else {
4125             
4126             boolValue2 = TRUE;
4127             
4128         }
4129         
4130         strValue2.Append(wxT("CALSCALE=") + strValue3);
4131         
4132         boolValue = TRUE;
4133         
4134     }
4135     
4136     // Process Tokens.
4137     
4138     strValue2 = BirthdayTokens;
4139     
4140     // Get the birthday and write it.
4141     
4142     ResetSaveProcessData();
4143     
4144     if (!txtBirthday->IsEmpty()){
4145         
4146         strValue = txtBirthday->GetValue();
4147         
4148         if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
4149             
4150             if (!strValue2.IsEmpty()){
4151                 
4152                 EscapeString(&strValue2, FALSE);
4153                 EscapeString(&strValue, FALSE);
4154                 
4155                 ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
4156                 
4157             } else {
4158                 
4159                 EscapeString(&strValue, FALSE);
4160                 
4161                 ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
4162                 
4163             }
4164             
4165         }
4166         
4167     } else {
4168         
4169         // Deal with date.
4170         
4171         // Get Day, Month & Year.
4172         
4173         wxDateTime BirthdayDate;
4174         wxDateTime::Month BirthdayMonth;
4175         int BirthdayDay;
4176         int BirthdayYear;
4177         wxString DataBeforeT;
4178         wxString DataAfterT;
4179         wxString FinalBirthdayString;
4180         bool ProcessDataAfterT = FALSE;
4181         
4182         BirthdayDate = dapBirthday->GetValue();
4183         
4184         if (BirthdayDate.IsValid()){
4185             
4186             BirthdayDay = BirthdayDate.GetDay();
4187             BirthdayMonth = BirthdayDate.GetMonth();
4188             BirthdayYear = BirthdayDate.GetYear();
4189             
4190             // Look for T and replace data before this.
4191             
4192             wxStringTokenizer wSTDate(Birthday, wxT("T"));
4193             
4194             while (wSTDate.HasMoreTokens()){
4195                 
4196                 if (ProcessDataAfterT == FALSE){
4197                     
4198                     DataBeforeT = wSTDate.GetNextToken();
4199                     ProcessDataAfterT = TRUE;
4200                     
4201                 } else {
4202                     
4203                     DataAfterT = wSTDate.GetNextToken();
4204                     break;
4205                     
4206                 }
4207                 
4208             }
4209             
4210             // If there is not T then replace altogether.
4211             
4212             wxString FinalBirthdayDay;
4213             wxString FinalBirthdayMonth;
4214             wxString FinalBirthdayYear;
4215             
4216             if (BirthdayDay < 10){
4217                 
4218                 FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
4219                 
4220             } else {
4221                 
4222                 FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
4223                 
4224             }
4225             
4226             if (((int)BirthdayMonth + 1) < 10){
4227                 
4228                 FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
4229                 
4230             } else {
4231                 
4232                 FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
4233                 
4234             }
4235             
4236             if (BirthdayYear == 0){
4237                 
4238                 FinalBirthdayYear = wxT("--");
4239                 
4240             } else {
4241                 
4242                 FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
4243                 
4244             }
4245             
4246             if (!DataAfterT.IsEmpty()){
4247                 
4248                 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
4249                 
4250             } else {
4251                 
4252                 FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
4253                 
4254             }
4255             
4256             if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
4257                 
4258                 if (!strValue2.IsEmpty()){
4259                     
4260                     EscapeString(&strValue2, FALSE);
4261                     EscapeString(&strValue, FALSE);
4262                     
4263                     ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
4264                     
4265                 } else {
4266                     
4267                     EscapeString(&strValue, FALSE);
4268                     
4269                     ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
4270                     
4271                 }
4272                 
4273             }
4274             
4275         }
4276         
4277     }
4278     
4279     ResetSaveProcessData();
4280     
4281     // Process Label.
4282     
4283     strValue3 = AnniversaryAltID;
4284     
4285     if (!strValue3.IsEmpty()){
4286         
4287         strValue3.Trim();
4288         strValue3.Trim();
4289         boolValue2 = TRUE;
4290         strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
4291         
4292         boolValue = TRUE;
4293         
4294     }
4295     
4296     //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
4297     //strValue2 =
4298     
4299     // Process Language.
4300     
4301     strValue3 = AnniversaryCalScale;
4302     
4303     if (!strValue3.IsEmpty()){
4304         
4305         strValue3.Trim();
4306         strValue3.Trim();
4307         
4308         if (boolValue2 == TRUE){
4309             
4310             strValue2.Append(wxT(";"));
4311             
4312         } else {
4313             
4314             boolValue2 = TRUE;
4315             
4316         }
4317         
4318         strValue2.Append(wxT("CALSCALE=") + strValue3);
4319         
4320         boolValue = TRUE;
4321         
4322     }
4323     
4324     // Process Tokens.
4325     
4326     strValue2 = AnniversaryTokens;
4327     
4328     // Deal with ANNIVERSARY.
4329     
4330     if (!txtAnniversary->IsEmpty()){
4331         
4332         strValue = txtAnniversary->GetValue();
4333         
4334         if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
4335             
4336             if (!strValue2.IsEmpty()){
4337                 
4338                 EscapeString(&strValue2, FALSE);
4339                 EscapeString(&strValue, FALSE);
4340                 
4341                 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
4342                 
4343             } else {
4344                 
4345                 EscapeString(&strValue, FALSE);
4346                 
4347                 ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
4348                 
4349             }
4350             
4351         }
4352         
4353     } else {
4354         
4355         // Look for T and replace data before this.
4356         
4357         // Get Day, Month & Year.
4358         
4359         wxDateTime AnniversaryDate;
4360         wxDateTime::Month AnniversaryMonth;
4361         int AnniversaryDay;
4362         int AnniversaryYear;
4363         wxString DataBeforeT;
4364         wxString DataAfterT;
4365         wxString FinalAnniversaryString;
4366         bool ProcessDataAfterT = FALSE;
4367         
4368         AnniversaryDate = dapAnniversary->GetValue();
4369         
4370         if (AnniversaryDate.IsValid()){
4371             
4372             AnniversaryDay = AnniversaryDate.GetDay();
4373             AnniversaryMonth = AnniversaryDate.GetMonth();
4374             AnniversaryYear = AnniversaryDate.GetYear();
4375             
4376             // Look for T and replace data before this.
4377             
4378             wxStringTokenizer wSTDate(Anniversary, wxT("T"));
4379             
4380             while (wSTDate.HasMoreTokens()){
4381                 
4382                 if (ProcessDataAfterT == FALSE){
4383                     
4384                     DataBeforeT = wSTDate.GetNextToken();
4385                     ProcessDataAfterT = TRUE;
4386                     
4387                 } else {
4388                     
4389                     DataAfterT = wSTDate.GetNextToken();
4390                     break;
4391                     
4392                 }
4393                 
4394             }
4395             
4396             // If there is not T then replace altogether.
4397             
4398             wxString FinalAnniversaryDay;
4399             wxString FinalAnniversaryMonth;
4400             wxString FinalAnniversaryYear;
4401             
4402             if (AnniversaryDay < 10){
4403                 
4404                 FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
4405                 
4406             } else {
4407                 
4408                 FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
4409                 
4410             }
4411             
4412             if (((int)AnniversaryMonth + 1) < 10){
4413                 
4414                 FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
4415                 
4416             } else {
4417                 
4418                 FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
4419                 
4420             }
4421             
4422             if (AnniversaryYear == 0){
4423                 
4424                 FinalAnniversaryYear = wxT("--");
4425                 
4426             } else {
4427                 
4428                 FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
4429                 
4430             }
4431             
4432             if (!DataAfterT.IsEmpty()){
4433                 
4434                 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
4435                 
4436             } else {
4437                 
4438                 FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
4439                 
4440             }
4441             
4442             if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
4443                 
4444                 if (!strValue2.IsEmpty()){
4445                     
4446                     EscapeString(&strValue2, FALSE);
4447                     EscapeString(&strValue, FALSE);
4448                     
4449                     ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
4450                     
4451                 } else {
4452                     
4453                     EscapeString(&strValue, FALSE);
4454                     
4455                     ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
4456                     
4457                 }
4458                 
4459             }
4460             
4461         }
4462         
4463     }
4464     
4465     // Setup the addresses (General, Home, Business).
4466     
4467     //intValue = GeneralAddressList.size();
4468     ResetSaveProcessData();
4469     
4470     for (std::map<int,wxString>::iterator iter = GeneralAddressList.begin();
4471          iter != GeneralAddressList.end(); ++iter){
4472         
4473         int intSeekValue = iter->first;
4474         
4475         wxString strAddressString;
4476         wxString strAddressFinalValue;
4477         std::map<int, wxString>::iterator iterValue;
4478         
4479         strAddressString.Append(wxT(";;"));
4480         
4481         // Get Address
4482         
4483         iterValue = GeneralAddressList.find(intSeekValue);
4484         strAddressFinalValue = iterValue->second;
4485         ProcessCaptureStrings(&strAddressFinalValue);
4486         strAddressString.Append(strAddressFinalValue + wxT(";"));
4487         strAddressFinalValue.Clear();
4488         
4489         // Get Town
4490         
4491         iterValue = GeneralAddressListTown.find(intSeekValue);
4492         strAddressFinalValue = iterValue->second;
4493         ProcessCaptureStrings(&strAddressFinalValue);
4494         strAddressString.Append(strAddressFinalValue + wxT(";"));
4495         strAddressFinalValue.Clear();
4496         
4497         // Get County
4498         
4499         iterValue = GeneralAddressListCounty.find(intSeekValue);
4500         strAddressFinalValue = iterValue->second;
4501         ProcessCaptureStrings(&strAddressFinalValue);
4502         strAddressString.Append(strAddressFinalValue + wxT(";"));
4503         strAddressFinalValue.Clear();
4504         
4505         // Get Post Code
4506         
4507         iterValue = GeneralAddressListPostCode.find(intSeekValue);
4508         strAddressFinalValue = iterValue->second;
4509         ProcessCaptureStrings(&strAddressFinalValue);
4510         strAddressString.Append(strAddressFinalValue + wxT(";"));
4511         strAddressFinalValue.Clear();
4512         
4513         // Get Country
4514         
4515         iterValue = GeneralAddressListCountry.find(intSeekValue);
4516         strAddressFinalValue = iterValue->second;
4517         ProcessCaptureStrings(&strAddressFinalValue);
4518         strAddressString.Append(strAddressFinalValue);
4519         strAddressFinalValue.Clear();
4520         
4521         ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
4522                         &iter, &strAddressString, &ContactData,
4523                         wxT("LABEL"), &GeneralAddressListLabel,
4524                         wxT("LANGUAGE"), &GeneralAddressListLang,
4525                         wxT("ALTID"), &GeneralAddressListAltID,
4526                         wxT("PID"), &GeneralAddressListPID,
4527                         wxT("GEO"), &GeneralAddressListGeo,
4528                         wxT("TZ"), &GeneralAddressListTimezone,
4529                         wxT("MEDIATYPE"), &GeneralAddressListMediatype,
4530                         wxT("PREF"), &GeneralAddressListPref,
4531                         wxT(""), &GeneralAddressListTokens );
4532         
4533         ResetSaveProcessData();
4534         
4535     }
4536     
4537     ResetSaveProcessData();
4538     
4539     for (std::map<int,wxString>::iterator iter = HomeAddressList.begin();
4540          iter != HomeAddressList.end(); ++iter){
4541         
4542         int intSeekValue = iter->first;
4543         
4544         wxString strAddressString;
4545         wxString strAddressFinalValue;
4546         std::map<int, wxString>::iterator iterValue;
4547         
4548         strAddressString.Append(wxT(";;"));
4549         
4550         // Get Address
4551         
4552         iterValue = HomeAddressList.find(intSeekValue);
4553         strAddressFinalValue = iterValue->second;
4554         ProcessCaptureStrings(&strAddressFinalValue);
4555         
4556         strAddressString.Append(strAddressFinalValue + wxT(";"));
4557         
4558         // Get Town
4559         
4560         iterValue = HomeAddressListTown.find(intSeekValue);
4561         strAddressFinalValue = iterValue->second;
4562         ProcessCaptureStrings(&strAddressFinalValue);
4563         
4564         strAddressString.Append(strAddressFinalValue + wxT(";"));
4565         
4566         // Get County
4567         
4568         iterValue = HomeAddressListCounty.find(intSeekValue);
4569         strAddressFinalValue = iterValue->second;
4570         ProcessCaptureStrings(&strAddressFinalValue);
4571         
4572         strAddressString.Append(strAddressFinalValue + wxT(";"));
4573         
4574         // Get Post Code
4575         
4576         iterValue = HomeAddressListPostCode.find(intSeekValue);
4577         strAddressFinalValue = iterValue->second;
4578         ProcessCaptureStrings(&strAddressFinalValue);
4579         
4580         strAddressString.Append(strAddressFinalValue + wxT(";"));
4581         
4582         // Get Country
4583         
4584         iterValue = HomeAddressListCountry.find(intSeekValue);
4585         strAddressFinalValue = iterValue->second;
4586         ProcessCaptureStrings(&strAddressFinalValue);
4587         
4588         strAddressString.Append(strAddressFinalValue);
4589         
4590         ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
4591                         &iter, &strAddressString, &ContactData,
4592                         wxT("LABEL"), &HomeAddressListLabel,
4593                         wxT("LANGUAGE"), &HomeAddressListLang,
4594                         wxT("ALTID"), &HomeAddressListAltID,
4595                         wxT("PID"), &HomeAddressListPID,
4596                         wxT("GEO"), &HomeAddressListGeo,
4597                         wxT("TZ"), &HomeAddressListTimezone,
4598                         wxT("MEDIATYPE"), &HomeAddressListMediatype,
4599                         wxT("PREF"), &HomeAddressListPref,
4600                         wxT(""), &HomeAddressListTokens );
4601         
4602         ResetSaveProcessData();
4603         
4604     }
4605     
4606     ResetSaveProcessData();
4607     
4608     for (std::map<int,wxString>::iterator iter = BusinessAddressList.begin();
4609          iter != BusinessAddressList.end(); ++iter){
4610         
4611         int intSeekValue = iter->first;
4612         
4613         wxString strAddressString;
4614         wxString strAddressFinalValue;
4615         std::map<int, wxString>::iterator iterValue;
4616         
4617         strAddressString.Append(wxT(";;"));
4618         
4619         // Get Address
4620         
4621         iterValue = BusinessAddressList.find(intSeekValue);
4622         strAddressFinalValue = iterValue->second;
4623         ProcessCaptureStrings(&strAddressFinalValue);
4624         
4625         strAddressString.Append(strAddressFinalValue + wxT(";"));
4626         
4627         // Get Town
4628         
4629         iterValue = BusinessAddressListTown.find(intSeekValue);
4630         strAddressFinalValue = iterValue->second;
4631         ProcessCaptureStrings(&strAddressFinalValue);
4632         
4633         strAddressString.Append(strAddressFinalValue + wxT(";"));
4634         
4635         // Get County
4636         
4637         iterValue = BusinessAddressListCounty.find(intSeekValue);
4638         strAddressFinalValue = iterValue->second;
4639         ProcessCaptureStrings(&strAddressFinalValue);
4640         
4641         strAddressString.Append(strAddressFinalValue + wxT(";"));
4642         
4643         // Get Post Code
4644         
4645         iterValue = BusinessAddressListPostCode.find(intSeekValue);
4646         strAddressFinalValue = iterValue->second;
4647         ProcessCaptureStrings(&strAddressFinalValue);
4648         
4649         strAddressString.Append(strAddressFinalValue + wxT(";"));
4650         
4651         // Get Country
4652         
4653         iterValue = BusinessAddressListCountry.find(intSeekValue);
4654         strAddressFinalValue = iterValue->second;
4655         ProcessCaptureStrings(&strAddressFinalValue);
4656         
4657         strAddressString.Append(strAddressFinalValue);
4658         
4659         ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
4660                         &iter, &strAddressString, &ContactData,
4661                         wxT("LABEL"), &BusinessAddressListLabel,
4662                         wxT("LANGUAGE"), &BusinessAddressListLang,
4663                         wxT("ALTID"), &BusinessAddressListAltID,
4664                         wxT("PID"), &BusinessAddressListPID,
4665                         wxT("GEO"), &BusinessAddressListGeo,
4666                         wxT("TZ"), &BusinessAddressListTimezone,
4667                         wxT("MEDIATYPE"), &BusinessAddressListMediatype,
4668                         wxT("PREF"), &BusinessAddressListPref,
4669                         wxT(""), &BusinessAddressListTokens );
4670         
4671         ResetSaveProcessData();
4672         
4673     }
4674     
4675     // Sort out nicknames (if any).
4676     
4677     for (std::map<int,wxString>::iterator iter = GeneralNicknamesList.begin();
4678          iter != GeneralNicknamesList.end(); ++iter){
4679         
4680         intValue2 = iter->first;
4681         
4682         // Process Alternative ID.
4683         
4684         ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
4685                         &iter, &GeneralNicknamesList, &ContactData,
4686                         wxT("LANGUAGE"), &GeneralNicknamesListLanguage,
4687                         wxT("ALTID"), &GeneralNicknamesListAltID,
4688                         wxT("PID"), &GeneralNicknamesListPID,
4689                         wxT("PREF"), &GeneralNicknamesListPref,
4690                         wxT(""), &GeneralNicknamesListTokens );
4691         
4692         ResetSaveProcessData();
4693         
4694     }
4695     
4696     ResetSaveProcessData();
4697     
4698     for (std::map<int,wxString>::iterator iter = HomeNicknamesList.begin();
4699          iter != HomeNicknamesList.end(); ++iter){
4700         
4701         ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
4702                         &iter, &HomeNicknamesList, &ContactData,
4703                         wxT("LANGUAGE"), &HomeNicknamesListLanguage,
4704                         wxT("ALTID"), &HomeNicknamesListAltID,
4705                         wxT("PID"), &HomeNicknamesListPID,
4706                         wxT("PREF"), &HomeNicknamesListPref,
4707                         wxT(""), &HomeNicknamesListTokens );
4708         
4709         ResetSaveProcessData();
4710         
4711     }
4712     
4713     ResetSaveProcessData();
4714     
4715     for (std::map<int,wxString>::iterator iter = BusinessNicknamesList.begin();
4716          iter != BusinessNicknamesList.end(); ++iter){
4717         
4718         ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
4719                         &iter, &BusinessNicknamesList, &ContactData,
4720                         wxT("LANGUAGE"), &BusinessNicknamesListLanguage,
4721                         wxT("ALTID"), &BusinessNicknamesListAltID,
4722                         wxT("PID"), &BusinessNicknamesListPID,
4723                         wxT("PREF"), &BusinessNicknamesListPref,
4724                         wxT(""), &BusinessNicknamesListTokens );
4725         
4726         ResetSaveProcessData();
4727         
4728     }
4729     
4730     ResetSaveProcessData();
4731     
4732     // Sort out email (general, home and business).
4733     
4734     for (std::map<int,wxString>::iterator iter = GeneralEmailList.begin();
4735          iter != GeneralEmailList.end(); ++iter){
4736         
4737         //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
4738         //strValue2 =
4739         
4740         wxString strAddressFinalValue;
4741         std::map<int, wxString>::iterator iterValue;
4742         
4743         ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
4744                         &iter, &GeneralEmailList, &ContactData,
4745                         wxT("ALTID"), &GeneralEmailListAltID,
4746                         wxT("PID"), &GeneralEmailListPID,
4747                         wxT("PREF"), &GeneralEmailListPref,
4748                         wxT(""), &GeneralEmailListTokens );
4749         
4750         ResetSaveProcessData();
4751         
4752     }
4753     
4754     ResetSaveProcessData();
4755     
4756     for (std::map<int,wxString>::iterator iter = HomeEmailList.begin();
4757          iter != HomeEmailList.end(); ++iter){
4758         
4759         //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
4760         //strValue2 =
4761         
4762         ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
4763                         &iter, &HomeEmailList, &ContactData,
4764                         wxT("ALTID"), &HomeEmailListAltID,
4765                         wxT("PID"), &HomeEmailListPID,
4766                         wxT("PREF"), &HomeEmailListPref,
4767                         wxT(""), &HomeEmailListTokens );
4768         
4769         ResetSaveProcessData();
4770         
4771     }
4772     
4773     ResetSaveProcessData();
4774     
4775     for (std::map<int,wxString>::iterator iter = BusinessEmailList.begin();
4776          iter != BusinessEmailList.end(); ++iter){
4777         
4778         //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
4779         //strValue2 =
4780         
4781         ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
4782                         &iter, &BusinessEmailList, &ContactData,
4783                         wxT("ALTID"), &BusinessEmailListAltID,
4784                         wxT("PID"), &BusinessEmailListPID,
4785                         wxT("PREF"), &BusinessEmailListPref,
4786                         wxT(""), &BusinessEmailListTokens );
4787         
4788         ResetSaveProcessData();
4789         
4790     }
4791     
4792     ResetSaveProcessData();
4793     
4794     for (std::map<int,wxString>::iterator iter = GeneralIMList.begin();
4795          iter != GeneralIMList.end(); ++iter){
4796         
4797         intValue2 = iter->first;
4798         
4799         // Process Alternative ID.
4800         
4801         ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
4802                         &iter, &GeneralIMList, &ContactData,
4803                         wxT("ALTID"), &GeneralIMListAltID,
4804                         wxT("PID"), &GeneralIMListPID,
4805                         wxT("MEDIATYPE"), &GeneralIMListMediatype,
4806                         wxT("PREF"), &GeneralIMListPref,
4807                         wxT(""), &GeneralIMListTokens );
4808         
4809         ResetSaveProcessData();
4810         
4811     }
4812     
4813     ResetSaveProcessData();
4814     
4815     for (std::map<int,wxString>::iterator iter = HomeIMList.begin();
4816          iter != HomeIMList.end(); ++iter){
4817         
4818         ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
4819                         &iter, &HomeIMList, &ContactData,
4820                         wxT("ALTID"), &HomeIMListAltID,
4821                         wxT("PID"), &HomeIMListPID,
4822                         wxT("MEDIATYPE"), &HomeIMListMediatype,
4823                         wxT("PREF"), &HomeIMListPref,
4824                         wxT(""), &HomeIMListTokens );
4825         
4826         ResetSaveProcessData();
4827         
4828     }
4829     
4830     ResetSaveProcessData();
4831     
4832     for (std::map<int,wxString>::iterator iter = BusinessIMList.begin();
4833          iter != BusinessIMList.end(); ++iter){
4834         
4835         ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
4836                         &iter, &BusinessIMList, &ContactData,
4837                         wxT("ALTID"), &BusinessIMListAltID,
4838                         wxT("PID"), &BusinessIMListPID,
4839                         wxT("MEDIATYPE"), &BusinessIMListMediatype,
4840                         wxT("PREF"), &BusinessIMListPref,
4841                         wxT(""), &BusinessIMListTokens );
4842         
4843         ResetSaveProcessData();
4844         
4845     }
4846     
4847     ResetSaveProcessData();
4848     
4849     for (std::map<int,wxString>::iterator iter = GeneralTelephoneList.begin();
4850          iter != GeneralTelephoneList.end(); ++iter){
4851         
4852         wxString strAddressFinalValue = iter->second;
4853         
4854         ProcessCaptureStrings(&strAddressFinalValue);
4855         
4856         strAddressFinalValue.insert(0, wxT("tel:"));
4857         
4858         ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
4859                         &iter, &strAddressFinalValue, &ContactData,
4860                         wxT("ALTID"), &GeneralTelephoneListAltID,
4861                         wxT("PID"), &GeneralTelephoneListPID,
4862                         wxT("TYPE"), &GeneralTelephoneListType,
4863                         wxT("PREF"), &GeneralTelephoneListPref,
4864                         wxT(""), &GeneralTelephoneListTokens );
4865         
4866         ResetSaveProcessData();
4867         
4868     }
4869     
4870     ResetSaveProcessData();
4871     
4872     for (std::map<int,wxString>::iterator iter = HomeTelephoneList.begin();
4873          iter != HomeTelephoneList.end(); ++iter){
4874         
4875         wxString strAddressFinalValue = iter->second;
4876         
4877         ProcessCaptureStrings(&strAddressFinalValue);
4878         
4879         strAddressFinalValue.insert(0, wxT("tel:"));
4880         
4881         ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
4882                         &iter, &strAddressFinalValue, &ContactData,
4883                         wxT("ALTID"), &HomeTelephoneListAltID,
4884                         wxT("PID"), &HomeTelephoneListPID,
4885                         wxT("TYPE"), &HomeTelephoneListType,
4886                         wxT("PREF"), &HomeTelephoneListPref,
4887                         wxT(""), &HomeTelephoneListTokens );
4888         
4889         ResetSaveProcessData();
4890         
4891     }
4892     
4893     ResetSaveProcessData();
4894     
4895     for (std::map<int,wxString>::iterator iter = BusinessTelephoneList.begin();
4896          iter != BusinessTelephoneList.end(); ++iter){
4897         
4898         wxString strAddressFinalValue = iter->second;
4899         
4900         ProcessCaptureStrings(&strAddressFinalValue);
4901         
4902         strAddressFinalValue.insert(0, wxT("tel:"));
4903         
4904         ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
4905                         &iter, &strAddressFinalValue, &ContactData,
4906                         wxT("ALTID"), &BusinessTelephoneListAltID,
4907                         wxT("PID"), &BusinessTelephoneListPID,
4908                         wxT("TYPE"), &BusinessTelephoneListType,
4909                         wxT("PREF"), &BusinessTelephoneListPref,
4910                         wxT(""), &BusinessTelephoneListTokens );
4911         
4912         ResetSaveProcessData();
4913         
4914     }
4915     
4916     ResetSaveProcessData();
4917     
4918     for (std::map<int,wxString>::iterator iter = GeneralLanguageList.begin();
4919          iter != GeneralLanguageList.end(); ++iter){
4920         
4921         intValue2 = iter->first;
4922         
4923         ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
4924                         &iter, &GeneralLanguageList, &ContactData,
4925                         wxT("ALTID"), &GeneralLanguageListAltID,
4926                         wxT("PID"), &GeneralLanguageListPID,
4927                         wxT("PREF"), &GeneralLanguageListPref,
4928                         wxT(""), &GeneralLanguageListTokens );
4929         
4930         ResetSaveProcessData();
4931         
4932     }
4933     
4934     ResetSaveProcessData();
4935     
4936     for (std::map<int,wxString>::iterator iter = HomeLanguageList.begin();
4937          iter != HomeLanguageList.end(); ++iter){
4938         
4939         ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
4940                         &iter, &HomeLanguageList, &ContactData,
4941                         wxT("ALTID"), &HomeLanguageListAltID,
4942                         wxT("PID"), &HomeLanguageListPID,
4943                         wxT("PREF"), &HomeLanguageListPref,
4944                         wxT(""), &HomeLanguageListTokens );
4945         
4946         ResetSaveProcessData();
4947         
4948     }
4949     
4950     ResetSaveProcessData();
4951     
4952     for (std::map<int,wxString>::iterator iter = BusinessLanguageList.begin();
4953          iter != BusinessLanguageList.end(); ++iter){
4954         
4955         ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
4956                         &iter, &BusinessLanguageList, &ContactData,
4957                         wxT("ALTID"), &BusinessLanguageListAltID,
4958                         wxT("PID"), &BusinessLanguageListPID,
4959                         wxT("PREF"), &BusinessLanguageListPref,
4960                         wxT(""), &BusinessLanguageListTokens );
4961         
4962         ResetSaveProcessData();
4963         
4964     }
4965     
4966     ResetSaveProcessData();
4967     
4968     for (std::map<int,wxString>::iterator iter = GeneralTZList.begin();
4969          iter != GeneralTZList.end(); ++iter){
4970         
4971         ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
4972                         &iter, &GeneralTZList, &ContactData,
4973                         wxT("ALTID"), &GeneralTZListAltID,
4974                         wxT("PID"), &GeneralTZListPID,
4975                         wxT("MEDIATYPE"), &GeneralTZListMediatype,
4976                         wxT("PREF"), &GeneralTZListPref,
4977                         wxT(""), &GeneralTZListTokens );
4978         
4979         ResetSaveProcessData();
4980         
4981     }
4982     
4983     ResetSaveProcessData();
4984     
4985     for (std::map<int,wxString>::iterator iter = HomeTZList.begin();
4986          iter != HomeTZList.end(); ++iter){
4987         
4988         ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
4989                         &iter, &HomeTZList, &ContactData,
4990                         wxT("ALTID"), &HomeTZListAltID,
4991                         wxT("PID"), &HomeTZListPID,
4992                         wxT("MEDIATYPE"), &HomeTZListMediatype,
4993                         wxT("PREF"), &HomeTZListPref,
4994                         wxT(""), &HomeTZListTokens );
4995         
4996         ResetSaveProcessData();
4997         
4998     }
4999     
5000     ResetSaveProcessData();
5001     
5002     for (std::map<int,wxString>::iterator iter = BusinessTZList.begin();
5003          iter != BusinessTZList.end(); ++iter){
5004         
5005         ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5006                         &iter, &BusinessTZList, &ContactData,
5007                         wxT("ALTID"), &BusinessTZListAltID,
5008                         wxT("PID"), &BusinessTZListPID,
5009                         wxT("MEDIATYPE"), &BusinessTZListMediatype,
5010                         wxT("PREF"), &BusinessTZListPref,
5011                         wxT(""), &BusinessTZListTokens );
5012         
5013         ResetSaveProcessData();
5014         
5015     }
5016     
5017     ResetSaveProcessData();
5018     
5019     for (std::map<int,wxString>::iterator iter = GeneralGeographyList.begin();
5020          iter != GeneralGeographyList.end(); ++iter){
5021         
5022         wxString strAddressFinalValue = iter->second;
5023         
5024         ProcessCaptureStrings(&strAddressFinalValue);
5025         
5026         strAddressFinalValue.insert(0, wxT("geo:"));
5027         
5028         ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
5029                         &iter, &strAddressFinalValue, &ContactData,
5030                         wxT("ALTID"), &GeneralGeographyListAltID,
5031                         wxT("PID"), &GeneralGeographyListPID,
5032                         wxT("MEDIATYPE"), &GeneralGeographyListMediatype,
5033                         wxT("PREF"), &GeneralGeographyListPref,
5034                         wxT(""), &GeneralGeographyListTokens );
5035         
5036         ResetSaveProcessData();
5037         
5038     }
5039     
5040     ResetSaveProcessData();
5041     
5042     for (std::map<int,wxString>::iterator iter = HomeGeographyList.begin();
5043          iter != HomeGeographyList.end(); ++iter){
5044         
5045         wxString strAddressFinalValue = iter->second;
5046         
5047         ProcessCaptureStrings(&strAddressFinalValue);
5048         
5049         strAddressFinalValue.insert(0, wxT("geo:"));
5050         
5051         ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
5052                         &iter, &HomeGeographyList, &ContactData,
5053                         wxT("ALTID"), &HomeGeographyListAltID,
5054                         wxT("PID"), &HomeGeographyListPID,
5055                         wxT("MEDIATYPE"), &HomeGeographyListMediatype,
5056                         wxT("PREF"), &HomeGeographyListPref,
5057                         wxT(""), &HomeGeographyListTokens );
5058         
5059         ResetSaveProcessData();
5060         
5061     }
5062     
5063     ResetSaveProcessData();
5064     
5065     for (std::map<int,wxString>::iterator iter = BusinessGeographyList.begin();
5066          iter != BusinessGeographyList.end(); ++iter){
5067         
5068         wxString strAddressFinalValue = iter->second;
5069         
5070         ProcessCaptureStrings(&strAddressFinalValue);
5071         
5072         strAddressFinalValue.insert(0, wxT("geo:"));
5073         
5074         ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5075                         &iter, &BusinessGeographyList, &ContactData,
5076                         wxT("ALTID"), &BusinessGeographyListAltID,
5077                         wxT("PID"), &BusinessGeographyListPID,
5078                         wxT("MEDIATYPE"), &BusinessGeographyListMediatype,
5079                         wxT("PREF"), &BusinessGeographyListPref,
5080                         wxT(""), &BusinessGeographyListTokens );
5081         
5082         ResetSaveProcessData();
5083         
5084     }
5085     
5086     ResetSaveProcessData();
5087     
5088     for (std::map<int,wxString>::iterator iter = GeneralRelatedList.begin();
5089          iter != GeneralRelatedList.end(); ++iter){
5090         
5091         ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
5092                         &iter, &GeneralRelatedList, &ContactData,
5093                         wxT("ALTID"), &GeneralRelatedListAltID,
5094                         wxT("PID"), &GeneralRelatedListPID,
5095                         wxT("LANGUAGE"), &GeneralRelatedListLanguage,
5096                         wxT("TYPE"), &GeneralRelatedListRelType,
5097                         wxT("PREF"), &GeneralRelatedListPref,
5098                         wxT(""), &GeneralRelatedListTokens );
5099         
5100         ResetSaveProcessData();
5101         
5102     }
5103     
5104     ResetSaveProcessData();
5105     
5106     for (std::map<int,wxString>::iterator iter = GeneralWebsiteList.begin();
5107          iter != GeneralWebsiteList.end(); ++iter){
5108         
5109         ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
5110                         &iter, &GeneralWebsiteList, &ContactData,
5111                         wxT("ALTID"), &GeneralWebsiteListAltID,
5112                         wxT("PID"), &GeneralWebsiteListPID,
5113                         wxT("MEDIATYPE"), &GeneralWebsiteListMediatype,
5114                         wxT("PREF"), &GeneralWebsiteListPref,
5115                         wxT(""), &GeneralWebsiteListTokens );
5116         
5117         ResetSaveProcessData();
5118         
5119     }
5120     
5121     ResetSaveProcessData();
5122     
5123     for (std::map<int,wxString>::iterator iter = HomeWebsiteList.begin();
5124          iter != HomeWebsiteList.end(); ++iter){
5125         
5126         ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
5127                         &iter, &HomeWebsiteList, &ContactData,
5128                         wxT("ALTID"), &HomeWebsiteListAltID,
5129                         wxT("PID"), &HomeWebsiteListPID,
5130                         wxT("MEDIATYPE"), &HomeWebsiteListMediatype,
5131                         wxT("PREF"), &HomeWebsiteListPref,
5132                         wxT(""), &HomeWebsiteListTokens );
5133         
5134         ResetSaveProcessData();
5135         
5136     }
5137     
5138     ResetSaveProcessData();
5139     
5140     for (std::map<int,wxString>::iterator iter = BusinessWebsiteList.begin();
5141          iter != BusinessWebsiteList.end(); ++iter){
5142         
5143         ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5144                         &iter, &BusinessWebsiteList, &ContactData,
5145                         wxT("ALTID"), &BusinessWebsiteListAltID,
5146                         wxT("PID"), &BusinessWebsiteListPID,
5147                         wxT("MEDIATYPE"), &BusinessWebsiteListMediatype,
5148                         wxT("PREF"), &BusinessWebsiteListPref,
5149                         wxT(""), &BusinessWebsiteListTokens );
5150         
5151         ResetSaveProcessData();
5152         
5153     }
5154     
5155     ResetSaveProcessData();
5156     
5157     for (std::map<int,wxString>::iterator iter = GeneralTitleList.begin();
5158          iter != GeneralTitleList.end(); ++iter){
5159         
5160         ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
5161                         &iter, &GeneralTitleList, &ContactData,
5162                         wxT("ALTID"), &GeneralTitleListAltID,
5163                         wxT("PID"), &GeneralTitleListPID,
5164                         wxT("LANGUAGE"), &GeneralTitleListLanguage,
5165                         wxT("PREF"), &GeneralTitleListPref,
5166                         wxT(""), &GeneralTitleListTokens );
5167         
5168         ResetSaveProcessData();
5169         
5170     }
5171     
5172     ResetSaveProcessData();
5173     
5174     for (std::map<int,wxString>::iterator iter = HomeTitleList.begin();
5175          iter != HomeTitleList.end(); ++iter){
5176         
5177         ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
5178                         &iter, &HomeTitleList, &ContactData,
5179                         wxT("ALTID"), &HomeTitleListAltID,
5180                         wxT("PID"), &HomeTitleListPID,
5181                         wxT("LANGUAGE"), &HomeTitleListLanguage,
5182                         wxT("PREF"), &HomeTitleListPref,
5183                         wxT(""), &HomeTitleListTokens );
5184         
5185         ResetSaveProcessData();
5186         
5187     }
5188     
5189     ResetSaveProcessData();
5190     
5191     for (std::map<int,wxString>::iterator iter = BusinessTitleList.begin();
5192          iter != BusinessTitleList.end(); ++iter){
5193         
5194         ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5195                         &iter, &BusinessTitleList, &ContactData,
5196                         wxT("ALTID"), &BusinessTitleListAltID,
5197                         wxT("PID"), &BusinessTitleListPID,
5198                         wxT("LANGUAGE"), &BusinessTitleListLanguage,
5199                         wxT("PREF"), &BusinessTitleListPref,
5200                         wxT(""), &BusinessTitleListTokens );
5201         
5202         ResetSaveProcessData();
5203         
5204     }
5205     
5206     ResetSaveProcessData();
5207     
5208     for (std::map<int,wxString>::iterator iter = GeneralRoleList.begin();
5209          iter != GeneralRoleList.end(); ++iter){
5210         
5211         ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
5212                         &iter, &GeneralRoleList, &ContactData,
5213                         wxT("ALTID"), &GeneralRoleListAltID,
5214                         wxT("PID"), &GeneralRoleListPID,
5215                         wxT("LANGUAGE"), &GeneralRoleListLanguage,
5216                         wxT("PREF"), &GeneralRoleListPref,
5217                         wxT(""), &GeneralRoleListTokens );
5218         
5219         ResetSaveProcessData();
5220         
5221     }
5222     
5223     ResetSaveProcessData();
5224     
5225     for (std::map<int,wxString>::iterator iter = HomeRoleList.begin();
5226          iter != HomeRoleList.end(); ++iter){
5227         
5228         ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
5229                         &iter, &HomeRoleList, &ContactData,
5230                         wxT("ALTID"), &HomeRoleListAltID,
5231                         wxT("PID"), &HomeRoleListPID,
5232                         wxT("LANGUAGE"), &HomeRoleListLanguage,
5233                         wxT("PREF"), &HomeRoleListPref,
5234                         wxT(""), &HomeRoleListTokens );
5235         
5236         ResetSaveProcessData();
5237         
5238     }
5239     
5240     ResetSaveProcessData();
5241     
5242     for (std::map<int,wxString>::iterator iter = BusinessRoleList.begin();
5243          iter != BusinessRoleList.end(); ++iter){
5244         
5245         ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5246                         &iter, &BusinessRoleList, &ContactData,
5247                         wxT("ALTID"), &BusinessRoleListAltID,
5248                         wxT("PID"), &BusinessRoleListPID,
5249                         wxT("LANGUAGE"), &BusinessRoleListLanguage,
5250                         wxT("PREF"), &BusinessRoleListPref,
5251                         wxT(""), &BusinessRoleListTokens );
5252         
5253         ResetSaveProcessData();
5254         
5255     }
5256     
5257     ResetSaveProcessData();
5258     
5259     for (std::map<int,wxString>::iterator iter = GeneralOrganisationsList.begin();
5260          iter != GeneralOrganisationsList.end(); ++iter){
5261         
5262         ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
5263                         &iter, &GeneralOrganisationsList, &ContactData,
5264                         wxT("ALTID"), &GeneralOrganisationsListAltID,
5265                         wxT("PID"), &GeneralOrganisationsListPID,
5266                         wxT("LANGUAGE"), &GeneralOrganisationsListLanguage,
5267                         wxT("SORT-AS"), &GeneralOrganisationsListSortAs,
5268                         wxT("PREF"), &GeneralOrganisationsListPref,
5269                         wxT(""), &GeneralOrganisationsListTokens );
5270         
5271         ResetSaveProcessData();
5272         
5273     }
5274     
5275     ResetSaveProcessData();
5276     
5277     for (std::map<int,wxString>::iterator iter = HomeOrganisationsList.begin();
5278          iter != HomeOrganisationsList.end(); ++iter){
5279         
5280         ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
5281                         &iter, &HomeOrganisationsList, &ContactData,
5282                         wxT("ALTID"), &HomeOrganisationsListAltID,
5283                         wxT("PID"), &HomeOrganisationsListPID,
5284                         wxT("LANGUAGE"), &HomeOrganisationsListLanguage,
5285                         wxT("SORT-AS"), &HomeOrganisationsListSortAs,
5286                         wxT("PREF"), &HomeOrganisationsListPref,
5287                         wxT(""), &HomeOrganisationsListTokens );
5288         
5289         ResetSaveProcessData();
5290         
5291     }
5292     
5293     ResetSaveProcessData();
5294     
5295     for (std::map<int,wxString>::iterator iter = BusinessOrganisationsList.begin();
5296          iter != BusinessOrganisationsList.end(); ++iter){
5297         
5298         ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5299                         &iter, &BusinessOrganisationsList, &ContactData,
5300                         wxT("ALTID"), &BusinessOrganisationsListAltID,
5301                         wxT("PID"), &BusinessOrganisationsListPID,
5302                         wxT("LANGUAGE"), &BusinessOrganisationsListLanguage,
5303                         wxT("SORT-AS"), &BusinessOrganisationsListSortAs,
5304                         wxT("PREF"), &BusinessOrganisationsListPref,
5305                         wxT(""), &BusinessOrganisationsListTokens );
5306         
5307         ResetSaveProcessData();
5308         
5309     }
5310     
5311     ResetSaveProcessData();
5312     
5313     for (std::map<int,wxString>::iterator iter = GeneralNoteList.begin();
5314          iter != GeneralNoteList.end(); ++iter){
5315         
5316         ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
5317                         &iter, &GeneralNoteList, &ContactData,
5318                         wxT("ALTID"), &GeneralNoteListAltID,
5319                         wxT("PID"), &GeneralNoteListPID,
5320                         wxT("LANGUAGE"), &GeneralNoteListLanguage,
5321                         wxT("PREF"), &GeneralNoteListPref,
5322                         wxT(""), &GeneralNoteListTokens );
5323         
5324         ResetSaveProcessData();
5325         
5326     }
5327     
5328     ResetSaveProcessData();
5329     
5330     for (std::map<int,wxString>::iterator iter = HomeNoteList.begin();
5331          iter != HomeNoteList.end(); ++iter){
5332         
5333         ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
5334                         &iter, &HomeNoteList, &ContactData,
5335                         wxT("ALTID"), &HomeNoteListAltID,
5336                         wxT("PID"), &HomeNoteListPID,
5337                         wxT("LANGUAGE"), &HomeNoteListLanguage,
5338                         wxT("PREF"), &HomeNoteListPref,
5339                         wxT(""), &HomeNoteListTokens );
5340         
5341         ResetSaveProcessData();
5342         
5343     }
5344     
5345     ResetSaveProcessData();
5346     
5347     for (std::map<int,wxString>::iterator iter = BusinessNoteList.begin();
5348          iter != BusinessNoteList.end(); ++iter){
5349         
5350         ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
5351                         &iter, &BusinessNoteList, &ContactData,
5352                         wxT("ALTID"), &BusinessNoteListAltID,
5353                         wxT("PID"), &BusinessNoteListPID,
5354                         wxT("LANGUAGE"), &BusinessNoteListLanguage,
5355                         wxT("PREF"), &BusinessNoteListPref,
5356                         wxT(""), &BusinessNoteListTokens );
5357         
5358         ResetSaveProcessData();
5359         
5360     }
5361     
5362     ResetSaveProcessData();
5363     
5364     for (std::map<int,wxString>::iterator iter = CategoriesList.begin();
5365          iter != CategoriesList.end(); ++iter){
5366         
5367         ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
5368                         &iter, &CategoriesList, &ContactData,
5369                         wxT("ALTID"), &CategoriesListAltID,
5370                         wxT("PID"), &CategoriesListPID,
5371                         wxT("TYPE"), &CategoriesListType,
5372                         wxT("PREF"), &CategoriesListPref,
5373                         wxT(""), &CategoriesListTokens );
5374         
5375         ResetSaveProcessData();
5376         
5377     }
5378     
5379     // Pictures.
5380     
5381     for (std::map<int, std::string>::iterator iter = PicturesList.begin();
5382          iter != PicturesList.end(); ++iter){
5383         
5384         int intValueIndex = iter->first;
5385         
5386         std::map<int, std::string>::iterator stdstriter;
5387         std::map<int, wxString>::iterator enciter;
5388         
5389         striter = PicturesListPictureType.find(intValueIndex);
5390         enciter = PicturesListPicEncType.find(intValueIndex);
5391         
5392         ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
5393                         &iter, &PicturesList, &striter,
5394                         &enciter, &ContactData,
5395                         wxT("ALTID"), &PicturesListAltID,
5396                         wxT("PID"), &PicturesListPID,
5397                         wxT("TYPE"), &PicturesListType,
5398                         wxT("PREF"), &PicturesListPref,
5399                         wxT(""), &PicturesListTokens);
5400         
5401         ResetSaveProcessData();
5402         
5403     }
5404     
5405     ResetSaveProcessData();
5406     
5407     // Logos.
5408     
5409     for (std::map<int, std::string>::iterator iter = LogosList.begin();
5410          iter != LogosList.end(); ++iter){
5411         
5412         int intValueIndex = iter->first;
5413         
5414         std::map<int, std::string>::iterator stdstriter;
5415         std::map<int, wxString>::iterator enciter;
5416         
5417         striter = LogosListPictureType.find(intValueIndex);
5418         enciter = LogosListPicEncType.find(intValueIndex);
5419         
5420         ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
5421                         &iter, &LogosList, &striter,
5422                         &enciter, &ContactData,
5423                         wxT("ALTID"), &LogosListAltID,
5424                         wxT("PID"), &LogosListPID,
5425                         wxT("TYPE"), &LogosListType,
5426                         wxT("PREF"), &LogosListPref,
5427                         wxT(""), &LogosListTokens );
5428         
5429         ResetSaveProcessData();
5430         
5431     }
5432     
5433     ResetSaveProcessData();
5434     
5435     // Sounds.
5436     
5437     for (std::map<int, std::string>::iterator iter = SoundsList.begin();
5438          iter != SoundsList.end(); ++iter){
5439         
5440         int intValueIndex = iter->first;
5441         
5442         std::map<int, std::string>::iterator stdstriter;
5443         std::map<int, wxString>::iterator enciter;
5444         
5445         striter = SoundsListAudioType.find(intValueIndex);
5446         enciter = SoundsListAudioEncType.find(intValueIndex);
5447         
5448         ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
5449                         &iter, &SoundsList, &striter,
5450                         &enciter, &ContactData,
5451                         wxT("ALTID"), &SoundsListAltID,
5452                         wxT("PID"), &SoundsListPID,
5453                         wxT("TYPE"), &SoundsListType,
5454                         wxT("PREF"), &SoundsListPref,
5455                         wxT(""), &SoundsListTokens );
5456         
5457         ResetSaveProcessData();
5458         
5459     }
5460     
5461     ResetSaveProcessData();
5462     
5463     for (std::map<int,wxString>::iterator iter = CalendarList.begin();
5464          iter != CalendarList.end(); ++iter){
5465         
5466         ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
5467                         &iter, &CalendarList, &ContactData,
5468                         wxT("ALTID"), &CalendarListAltID,
5469                         wxT("PID"), &CalendarListPID,
5470                         wxT("MEDIATYPE"), &CalendarListMediatype,
5471                         wxT("TYPE"), &CalendarListType,
5472                         wxT("PREF"), &CalendarListPref,
5473                         wxT(""), &CalendarListTokens );
5474         
5475         ResetSaveProcessData();
5476         
5477     }
5478     
5479     ResetSaveProcessData();
5480     
5481     for (std::map<int,wxString>::iterator iter = CalendarRequestList.begin();
5482          iter != CalendarRequestList.end(); ++iter){
5483         
5484         ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
5485                         &iter, &CalendarRequestList, &ContactData,
5486                         wxT("ALTID"), &CalendarRequestListAltID,
5487                         wxT("PID"), &CalendarRequestListPID,
5488                         wxT("MEDIATYPE"), &CalendarRequestListMediatype,
5489                         wxT("TYPE"), &CalendarRequestListType,
5490                         wxT("PREF"), &CalendarRequestListPref,
5491                         wxT(""), &CalendarRequestListTokens );
5492         
5493         ResetSaveProcessData();
5494         
5495     }
5496     
5497     ResetSaveProcessData();
5498     
5499     for (std::map<int,wxString>::iterator iter = FreeBusyList.begin();
5500          iter != FreeBusyList.end(); ++iter){
5501         
5502         ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
5503                         &iter, &FreeBusyList, &ContactData,
5504                         wxT("ALTID"), &FreeBusyListAltID,
5505                         wxT("PID"), &FreeBusyListPID,
5506                         wxT("MEDIATYPE"), &FreeBusyListMediatype,
5507                         wxT("TYPE"), &FreeBusyListType,
5508                         wxT("PREF"), &FreeBusyListPref,
5509                         wxT(""), &FreeBusyListTokens );
5510         
5511         ResetSaveProcessData();
5512         
5513     }
5514     
5515     for (std::map<int, wxString>::iterator iter = KeyList.begin();
5516          iter != KeyList.end(); ++iter){
5517         
5518         intValue2 = iter->first;
5519         
5520         // Process Alternative ID.
5521         
5522         striter = KeyListAltID.find(intValue2);
5523         
5524         if (striter->first == intValue2){
5525             
5526             strValue3 = striter->second;
5527             
5528             if (!strValue3.IsEmpty()){
5529                 
5530                 strValue3.Trim();
5531                 strValue3.Trim();
5532                 
5533                 if (boolValue2 == TRUE){
5534                     
5535                     strValue2.Append(wxT(";"));
5536                     
5537                 } else {
5538                     
5539                     boolValue2 = TRUE;
5540                     
5541                 }
5542                 
5543                 strValue2.Append(wxT("ALTID=") + strValue3);
5544                 
5545                 boolValue = TRUE;
5546                 
5547             }
5548             
5549         }
5550         
5551         // Process PID.
5552         
5553         striter = KeyListPID.find(intValue2);
5554         
5555         if (striter->first == intValue2){
5556             
5557             strValue3 = striter->second;
5558             
5559             if (!strValue3.IsEmpty()){
5560                 
5561                 strValue3.Trim();
5562                 strValue3.Trim();
5563                 
5564                 if (boolValue2 == TRUE){
5565                     
5566                     strValue2.Append(wxT(";"));
5567                     
5568                 } else {
5569                     
5570                     boolValue2 = TRUE;
5571                     
5572                 }
5573                 
5574                 strValue2.Append(wxT("PID=") + strValue3);
5575                 
5576                 boolValue = TRUE;
5577                 
5578             }
5579             
5580         }
5581         
5582         // Process Type.
5583         
5584         striter = KeyListType.find(intValue2);
5585         
5586         if (striter->first == intValue2){
5587             
5588             strValue3 = striter->second;
5589             
5590             if (!strValue3.IsEmpty()){
5591                 
5592                 strValue3.Trim();
5593                 strValue3.Trim();
5594                 
5595                 if (boolValue2 == TRUE){
5596                     
5597                     strValue2.Append(wxT(";"));
5598                     
5599                 } else {
5600                     
5601                     boolValue2 = TRUE;
5602                     
5603                 }
5604                 
5605                 strValue2.Append(wxT("TYPE=") + strValue3);
5606                 
5607                 boolValue = TRUE;
5608                 
5609             }
5610             
5611         }
5612         
5613         intiter = KeyListPref.find(intValue2);
5614         
5615         if (intiter->first == intValue2){
5616             
5617             intValue3 = intiter->second;
5618             
5619             if (intValue3){
5620                 
5621                 if (boolValue2 == TRUE){
5622                     
5623                     strValue2.Append(wxT(";"));
5624                     
5625                 } else {
5626                     
5627                     boolValue2 = TRUE;
5628                     
5629                 }
5630                 
5631                 strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
5632                 
5633                 boolValue = TRUE;
5634                 
5635             }
5636             
5637         }       
5638         
5639         // Process Tokens.
5640         
5641         striter = KeyListTokens.find(intValue2);
5642         
5643         if (striter->first == intValue2){
5644             
5645             strValue3 = striter->second;
5646             
5647             if (!strValue3.IsEmpty()){
5648                 
5649                 strValue3.Trim();
5650                 strValue3.Trim();
5651                 
5652                 if (boolValue2 == TRUE){
5653                     
5654                     strValue2.Append(wxT(";"));
5655                     
5656                 } else {
5657                     
5658                     boolValue2 = TRUE;
5659                     
5660                 }
5661                 
5662                 strValue2.Append(strValue3);
5663                 
5664                 boolValue = TRUE;
5665                 
5666             }
5667             
5668         }       
5669         
5670         // Get the key information.
5671         
5672         std::map<int, wxString>::iterator enciter;
5673         
5674         striter = KeyListDataType.find(intValue2);      
5675         //enciter = KeyListAudioEncType.find(intValue2);
5676         
5677         wxString strValueData;
5678         
5679         strValueData = iter->second;    
5680         //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
5681         strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));       
5682         
5683         
5684         // Add to the vCard.
5685         
5686         if (boolValue == TRUE){
5687             
5688             ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
5689             
5690         } else {
5691             
5692             ContactData.Add(wxT("KEY"), strValueData, TRUE);
5693             
5694         }
5695         
5696         ResetSaveProcessData();   
5697         
5698     }
5699     
5700     // Vendor specific items.
5701     
5702     ResetSaveProcessData();   
5703     
5704     for (std::map<int,wxString>::iterator iter = VendorList.begin();
5705          iter != VendorList.end(); ++iter){
5706         
5707         intValue2 = iter->first;        
5708         
5709         // Get the IANA PEN number.
5710         
5711         striter = VendorListPEN.find(intValue2);
5712         
5713         if (striter->first == intValue2){
5714             
5715             strValue2 = striter->second;
5716             
5717         }
5718         
5719         // Get the element name.
5720         
5721         striter = VendorListElement.find(intValue2);
5722         
5723         if (striter->first == intValue2){
5724             
5725             strValue3 = striter->second;
5726             
5727         }
5728         
5729         // Get the address.
5730         
5731         striter = VendorList.find(intValue2);
5732         
5733         if (striter->first == intValue2){
5734             
5735             strValue = striter->second;
5736             
5737         }
5738         
5739         // Add to the vCard.
5740         
5741         if (boolValue == TRUE){
5742             
5743             ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
5744             
5745         } else {
5746             
5747             ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
5748             
5749         }
5750         
5751         ResetSaveProcessData();
5752         
5753     }              
5754     
5755     ResetSaveProcessData();  
5756     
5757     // X-Tokens.
5758     
5759     for (std::map<int,wxString>::iterator iter = XTokenList.begin();
5760          iter != XTokenList.end(); ++iter){
5761         
5762         intValue2 = iter->first;        
5763         
5764         // Get the element name.
5765         
5766         striter = XTokenListTokens.find(intValue2);
5767         
5768         if (striter->first == intValue2){
5769             
5770             strValue2 = striter->second;
5771             
5772         }       
5773         
5774         // Get the address.
5775         
5776         striter = XTokenList.find(intValue2);
5777         
5778         if (striter->first == intValue2){
5779             
5780             strValue = striter->second;
5781             
5782         }
5783         
5784         // Add to the vCard.
5785         
5786         if (boolValue == TRUE){
5787             
5788             ContactData.AddRaw(wxT("X-") + strValue2, strValue);
5789             
5790         } else {
5791             
5792             ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
5793             
5794         }
5795         
5796         ResetSaveProcessData();
5797         
5798     }
5799     
5800     ResetSaveProcessData();
5801     
5802     if (FullNamesList.size() == 0){
5803         
5804         wxString FullName = cmbDisplayAs->GetValue();
5805         FullNamesList.insert(std::make_pair(0, FullName));
5806         FullNamesListAltID.insert(std::make_pair(0, wxT("")));
5807         FullNamesListPID.insert(std::make_pair(0, wxT("")));
5808         FullNamesListType.insert(std::make_pair(0, wxT("")));
5809         FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
5810         FullNamesListPref.insert(std::make_pair(0, 0));
5811         FullNamesListTokens.insert(std::make_pair(0, wxT("")));
5812         FNFirst = FALSE;
5813         
5814     }
5815     
5816     for (std::map<int, wxString>::iterator iter = FullNamesList.begin();
5817          iter != FullNamesList.end(); ++iter){
5818         
5819         if (FNFirst == TRUE){
5820             
5821             iter->second = cmbDisplayAs->GetValue();
5822             FNFirst = FALSE;
5823             
5824         }
5825         
5826         std::map<int,wxString>::iterator mapS;
5827         
5828         mapS = FullNamesListTokens.find(iter->first);
5829         
5830         ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue, 
5831                         &iter, &FullNamesList, &ContactData,
5832                         wxT("ALTID"), &FullNamesListAltID,
5833                         wxT("PID"), &FullNamesListPID,
5834                         wxT("TYPE"), &FullNamesListType,
5835                         wxT("LANGUAGE"), &FullNamesListLanguage,
5836                         wxT("PREF"), &FullNamesListPref,
5837                         wxT(""), &FullNamesListTokens );
5838         
5839         // Get the address.
5840         
5841         ResetSaveProcessData();    
5842         
5843     }
5844     
5845     //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
5846     
5847     // Insert revision (REV) date.
5848     
5849     // Get today's date and time.
5850     
5851     wxDateTime DateTimeNow = wxDateTime::Now();
5852     
5853     wxString DateRev;
5854     
5855     // Set year, month and date.
5856     
5857     int intYear = DateTimeNow.GetYear();
5858     int intMonth = DateTimeNow.GetMonth();
5859     int intDay = DateTimeNow.GetDay();
5860     
5861     DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
5862     
5863     if (intMonth < 10){
5864         
5865         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
5866         
5867     } else {
5868         
5869         DateRev.Append(wxString::Format(wxT("%i"), intMonth));
5870         
5871     }
5872     
5873     if (intDay < 10){
5874         
5875         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
5876         
5877     } else {
5878         
5879         DateRev.Append(wxString::Format(wxT("%i"), intDay));
5880         
5881     }
5882     
5883     //DateRev.Append(wx);
5884     //DateRev.Append(wx);
5885     //DateRev.Append(wx);
5886     DateRev.Append(wxT("T"));
5887     
5888     // Set hour, minute and second.
5889     
5890     int intHour = DateTimeNow.GetHour();
5891     int intMinute = DateTimeNow.GetMinute();
5892     int intSecond = DateTimeNow.GetSecond();
5893     
5894     if (intHour < 10){
5895         
5896         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
5897         
5898     } else {
5899         
5900         DateRev.Append(wxString::Format(wxT("%i"), intHour));    
5901         
5902     }
5903     
5904     if (intMinute < 10){
5905         
5906         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
5907         
5908     } else {
5909         
5910         DateRev.Append(wxString::Format(wxT("%i"), intMinute));
5911         
5912     }
5913     
5914     if (intSecond < 10){
5915         
5916         DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
5917         
5918     } else {
5919         
5920         DateRev.Append(wxString::Format(wxT("%i"), intSecond));
5921         
5922     }
5923     
5924     //   DateRev.Append(wx);
5925     //   DateRev.Append(wx);
5926     //   DateRev.Append(wxString DateTimeNow->);
5927     DateRev.Append(wxT("Z"));    
5928     
5929     ContactData.Add(wxT("UID"), UIDToken, FALSE);
5930     
5931     // End the vCard File.
5932     
5933     ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
5934     
5935     FMTimer.Stop();
5936     ContactData.WriteFile(FilenameFinal);
5937     
5938     vCard34Conv ConvFileFun;
5939     
5940     wxString wxSData;
5941     
5942     ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
5943     
5944     wxString AccountDirPrefix;
5945     wxString AccountDir;
5946     wxString PrefDir;
5947     
5948 #if defined(__HAIKU__)
5949     
5950     //preffilename = wxT("noo");
5952 #elif defined(__APPLE__)
5953     
5954     PrefDir = GetUserPrefDir();
5955     
5956     wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
5957     
5958 #elif defined(__WIN32__)
5959     
5960     PrefDir = GetUserPrefDir();
5961     
5962     wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
5963     
5964 #else
5965     
5966     PrefDir = GetUserPrefDir();
5967     
5968     wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
5969     
5970 #endif
5971     
5972     XABPreferences PrefData(PrefDir);
5973     
5974     wxString AccountType;
5975     
5976     for (int i = 0; i < PrefData.accounts.GetCount(); i++){
5977         
5978         AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
5979         
5980         if (AccountDir == wxSContactAccount){
5981             
5982             AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
5983             AccountDirPrefix.Trim();
5984             AccountType = PrefData.accounts.GetAccountType(i);
5985             break;
5986             
5987         }
5988         
5989     }
5990     
5991     wxString wxSplitFilename;
5992     wxString wxSDataURL;
5993     
5994     while(wSTFilename.HasMoreTokens()){
5995         
5996         wxSplitFilename = wSTFilename.GetNextToken();
5997         
5998     }
5999     
6000     wxSDataURL = wxSplitFilename;
6001     //wxSDataURL.Append(wxSplitFilename);
6002     
6003     // Find out if the filename exists in the table.
6004     
6005     if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
6006         
6007         wxString ETagResult;
6008         wxString ETagOriginal;
6009         
6010         ETagDB *ETagDBPtr = NULL;
6011         
6012         ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
6013         
6014         wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
6015         wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
6016         
6017         if (wxSETagOrig.IsEmpty()){
6018             
6019             // Generate the ETag.
6020             
6021             wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
6022             
6023         }
6024         
6025         if (wxSETag.IsEmpty()){
6026             
6027             // Update empty ETag.
6028             
6029             wxSETag = wxSETagOrig;
6030             ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
6031             
6032         }
6033         else {
6034             
6035             // Don't change original ETag.
6036             
6037             wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
6038             ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
6039             
6040         }
6041         
6042         if (EditMode == FALSE){
6043             
6044             ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
6045             EditMode = TRUE;
6046             FMTimer.SetFilename(FilenameFinal);
6047             FMTimer.UpdateTimestamp();
6048             FMTimer.Start(10000, FALSE);
6049             
6050         }
6051         else {
6052             
6053             ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
6054             FMTimer.UpdateTimestamp();
6055             FMTimer.Start(10000, FALSE);
6056             
6057         }
6058         
6059     }
6060     
6061     // Send a notification to update the main window
6062     // with the new details.
6063     
6064     UCNotif *ucd;
6065     ucd = new UCNotif;
6066     
6067     // TODO: Workout nickname settings by priority and
6068     // type.
6069     
6070     ucd->ContactAccount = wxSContactAccount;
6071     ucd->ContactFilename = FilenameFinal;
6072     ucd->ContactName = cmbDisplayAs->GetValue();
6073     ucd->ContactNameArray = ContactData.GetName();
6074     
6075     for (std::map<int,wxString>::iterator gniter = GeneralNicknamesList.begin();
6076          gniter != GeneralNicknamesList.end(); gniter++){
6077         
6078         ucd->ContactNickname = gniter->second;
6079         break;
6080         
6081     }
6082     
6083     wxCommandEvent event2(CE_UPDATECONTACTLIST);
6084     event2.SetClientData(ucd);
6085     wxPostEvent(MainPtr, event2);
6086     
6089 void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
6091     
6092     // Save the updated contact data and close the form.
6093     
6096 void frmContactEditor::CloseContact( wxCommandEvent& event )
6098     
6099     Close();
6100     
6103 void frmContactEditor::CloseWindow( wxCloseEvent& event )
6105     
6106     // TODO: Check if any changes have been made,
6107     // ask if the changes should be made, process
6108     // action based on question and then close.
6109     
6110     WindowData *WData = new WindowData;
6111     
6112     WData->DataType = 1;
6113     WData->WindowPointer = this;
6114     WData->WindowID = ContactEditorUID;
6115     
6116     wxCommandEvent delevent(WINDOW_CLOSE);
6117     delevent.SetClientData(WData);
6118     wxPostEvent(GetParent(), delevent);
6119     
6120     Destroy();
6121     
6125 void frmContactEditor::CutText( wxCommandEvent& event )
6127     // This function left empty for future implementation.
6130 void frmContactEditor::CopyText( wxCommandEvent& event )
6132     // This function left empty for future implementation.
6135 void frmContactEditor::PasteText( wxCommandEvent& event )
6137     // This function left empty for future implementation.
6140 void frmContactEditor::SetupContact( wxString AccountName )
6142     
6143     wxSContactAccount = AccountName;
6144     
6147 bool frmContactEditor::ProcessEvent(wxEvent& event)
6149     
6150     // This section has been taken from the wxWidgets sample code of richtext.cpp
6151     // so that simple Cut/Copy/Paste code can be made.
6152     
6153     // As this code comes from the samples of the wxWidgets library, this is licenced
6154     // under the wxWindows Library Licence and is compatable with the LGPL and is
6155     // compatable with Xestia Address Book's licence.
6156     
6157     if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
6158     {
6159         // Problem: we can get infinite recursion because the events
6160         // climb back up to this frame, and repeat.
6161         // Assume that command events don't cause another command event
6162         // to be called, so we can rely on inCommand not being overwritten
6163         
6164         static int s_eventType = 0;
6165         static wxWindowID s_id = 0;
6166         
6167         if (s_id != event.GetId() && s_eventType != event.GetEventType())
6168         {
6169             s_eventType = event.GetEventType();
6170             s_id = event.GetId();
6171             
6172             wxWindow* focusWin = wxFindFocusDescendant(this);
6173             if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
6174             {
6175                 //s_command = NULL;
6176                 s_eventType = 0;
6177                 s_id = 0;
6178                 return true;
6179             }
6180             s_eventType = 0;
6181             s_id = 0;
6182         }
6183         else
6184         {
6185             return false;
6186         }
6187     }
6188     
6189     return wxFrame::ProcessEvent(event);
6192 void frmContactEditor::SetupHeaders()
6194     
6195     /* Items for the General Tab */
6196     
6197     SetupColumn(CE_NICKNAME, lboNicknames);
6198     SetupColumn(CE_ADDRESS, lboAddresses);
6199     SetupColumn(CE_EMAIL, lboEmails);
6200     SetupColumn(CE_IM, lboIM);
6201     SetupColumn(CE_TELEPHONE, lboTelephone);
6202     SetupColumn(CE_LANG, lboLanguages);
6203     SetupColumn(CE_TZ, lboTimezones);
6204     SetupColumn(CE_GEOPOSITION, lboGeoposition);
6205     SetupColumn(CE_RELATED, lboRelated);
6206     SetupColumn(CE_WEBSITE, lboWebsites);
6207     SetupColumn(CE_TITLE, lboTitles);
6208     SetupColumn(CE_ROLE, lboRoles);
6209     SetupColumn(CE_ORG, lboOrganisations);
6210     SetupColumn(CE_NOTE, lboNotes);
6211     
6212     /* Items for the Home Tab */
6213     
6214     SetupColumn(CE_NICKNAME, lboHomeNicknames);
6215     SetupColumn(CE_ADDRESS, lboHomeAddresses);
6216     SetupColumn(CE_EMAIL, lboHomeEmails);
6217     SetupColumn(CE_IM, lboHomeIM);
6218     SetupColumn(CE_TELEPHONE, lboHomeTelephone);        
6219     SetupColumn(CE_LANG, lboHomeLanguages);
6220     SetupColumn(CE_TZ, lboHomeTimezones);
6221     SetupColumn(CE_GEOPOSITION, lboHomeGeoposition);
6222     SetupColumn(CE_WEBSITE, lboHomeWebsites);
6223     SetupColumn(CE_TITLE, lboHomeTitles);
6224     SetupColumn(CE_ROLE, lboHomeRoles);
6225     SetupColumn(CE_ORG, lboHomeOrganisations);
6226     SetupColumn(CE_NOTE, lboHomeNotes);
6227     
6228     /* Items for the Business Tab */
6229     
6230     SetupColumn(CE_NICKNAME, lboBusinessNicknames);
6231     SetupColumn(CE_ADDRESS, lboBusinessAddresses);
6232     SetupColumn(CE_EMAIL, lboBusinessEmail);
6233     SetupColumn(CE_IM, lboBusinessIM);
6234     SetupColumn(CE_TELEPHONE, lboBusinessTelephone);    
6235     SetupColumn(CE_LANG, lboBusinessLanguages);
6236     SetupColumn(CE_TZ, lboBusinessTimezones);
6237     SetupColumn(CE_GEOPOSITION, lboBusinessGeoposition);
6238     SetupColumn(CE_WEBSITE, lboBusinessWebsites);
6239     SetupColumn(CE_TITLE, lboBusinessTitles);
6240     SetupColumn(CE_ROLE, lboBusinessRoles);
6241     SetupColumn(CE_ORG, lboBusinessOrganisations);
6242     SetupColumn(CE_NOTE, lboBusinessNotes);     
6243     
6244     /* Items for the Categories Tab */
6245     
6246     SetupColumn(CE_CATEGORIES, lboCategories);
6247     
6248     /* Items for the Groups Tab */
6249     
6250     SetupColumn(CE_GROUPS, lboGroups);
6251     
6252     /* Items for the Pictures and Logos Tab */
6253     
6254     SetupColumn(CE_PICTURES, lboPictures);
6255     SetupColumn(CE_PICTURES, lboLogos); 
6256     
6257     /* Items for the Sounds Tab */
6258     
6259     SetupColumn(CE_SOUNDS, lboSounds);
6260     
6261     /* Items for the Calendaring Tab */
6262     
6263     SetupColumn(CE_CALENDAR, lboCalendarAddresses);
6264     SetupColumn(CE_CALENDAR, lboCalendarRequestAddress);
6265     SetupColumn(CE_CALENDAR, lboFreeBusyAddresses);     
6266     
6267     /* Items for the Security Tab */
6268     
6269     SetupColumn(CE_KEY, lboKeys);
6270     
6271     /* Items for the Other Tab */
6272     
6273     SetupColumn(CE_TOKEN, lboVendorNamespace);
6274     SetupColumn(CE_TOKEN, lboXToken);
6275     
6278 void frmContactEditor::SetupColumn(wxString ColumnType, wxListCtrl *ListCtrl)
6280     
6281     wxListItem coldata; 
6282     
6283     if (ColumnType == CE_NICKNAME){
6284         
6285         coldata.SetId(0);
6286         coldata.SetText(_("Nickname"));
6287         coldata.SetWidth(128);
6288         ListCtrl->InsertColumn(0, coldata);
6289         
6290         coldata.SetId(1);
6291         coldata.SetText(_("Pri."));
6292         coldata.SetWidth(32);
6293         ListCtrl->InsertColumn(1, coldata);             
6294         
6295     } else if (ColumnType == CE_ADDRESS){
6296         
6297         coldata.SetId(0);
6298         coldata.SetText(_("Address"));
6299         coldata.SetWidth(128);
6300         ListCtrl->InsertColumn(0, coldata);
6301         
6302         coldata.SetId(1);
6303         coldata.SetText(_("Town"));
6304         coldata.SetWidth(64);
6305         ListCtrl->InsertColumn(1, coldata);             
6306         
6307         coldata.SetId(2);
6308         coldata.SetText(_("County"));
6309         coldata.SetWidth(64);
6310         ListCtrl->InsertColumn(2, coldata);
6311         
6312         coldata.SetId(3);
6313         coldata.SetText(_("Post code"));
6314         coldata.SetWidth(48);
6315         ListCtrl->InsertColumn(3, coldata);
6316         
6317         coldata.SetId(4);
6318         coldata.SetText(_("Pri."));
6319         coldata.SetWidth(32);
6320         ListCtrl->InsertColumn(4, coldata);             
6321         
6322     } else if (ColumnType == CE_EMAIL){
6323         
6324         coldata.SetId(0);
6325         coldata.SetText(_("Email address"));
6326         coldata.SetWidth(304);
6327         ListCtrl->InsertColumn(0, coldata);
6328         
6329         coldata.SetId(1);
6330         coldata.SetText(_("Pri."));
6331         coldata.SetWidth(32);
6332         ListCtrl->InsertColumn(1, coldata);
6333         
6334     } else if (ColumnType == CE_IM){
6335         
6336         coldata.SetId(0);
6337         coldata.SetText(_("Type"));
6338         coldata.SetWidth(64);
6339         ListCtrl->InsertColumn(0, coldata);
6340         
6341         coldata.SetId(1);
6342         coldata.SetText(_("Address"));
6343         coldata.SetWidth(240);
6344         ListCtrl->InsertColumn(1, coldata);
6345         
6346         coldata.SetId(2);
6347         coldata.SetText(_("Pri."));
6348         coldata.SetWidth(32);
6349         ListCtrl->InsertColumn(2, coldata);             
6350         
6351     } else if (ColumnType == CE_TELEPHONE){
6352         
6353         coldata.SetId(0);
6354         coldata.SetText(_("Telephone number"));
6355         coldata.SetWidth(128);
6356         ListCtrl->InsertColumn(0, coldata);
6357         
6358         coldata.SetId(1);
6359         coldata.SetText(_("Type"));
6360         coldata.SetWidth(64);
6361         ListCtrl->InsertColumn(1, coldata);             
6362         
6363         coldata.SetId(2);
6364         coldata.SetText(_("Pri."));
6365         coldata.SetWidth(32);
6366         ListCtrl->InsertColumn(2, coldata);             
6367         
6368     } else if (ColumnType == CE_LANG){
6369         
6370         coldata.SetId(0);
6371         coldata.SetText(_("Language"));
6372         coldata.SetWidth(128);
6373         ListCtrl->InsertColumn(0, coldata);
6374         
6375         coldata.SetId(1);
6376         coldata.SetText(_("Pri."));
6377         coldata.SetWidth(32);
6378         ListCtrl->InsertColumn(1, coldata);             
6379         
6380     } else if (ColumnType == CE_TZ){
6381         
6382         coldata.SetId(0);
6383         coldata.SetText(_("Timezone"));
6384         coldata.SetWidth(192);
6385         ListCtrl->InsertColumn(0, coldata);
6386         
6387         coldata.SetId(1);
6388         coldata.SetText(_("Pri."));
6389         coldata.SetWidth(32);
6390         ListCtrl->InsertColumn(1, coldata);             
6391         
6392     } else if (ColumnType == CE_RELATED){
6393         
6394         coldata.SetId(0);
6395         coldata.SetText(_("Type"));
6396         coldata.SetWidth(64);
6397         ListCtrl->InsertColumn(0, coldata);
6398         
6399         coldata.SetId(1);
6400         coldata.SetText(_("Name/Description"));
6401         coldata.SetWidth(192);
6402         ListCtrl->InsertColumn(1, coldata);
6403         
6404         coldata.SetId(2);
6405         coldata.SetText(_("Pri."));
6406         coldata.SetWidth(32);
6407         ListCtrl->InsertColumn(2, coldata);
6408         
6409     } else if (ColumnType == CE_WEBSITE){
6410         
6411         coldata.SetId(0);
6412         coldata.SetText(_("Website"));
6413         coldata.SetWidth(288);
6414         ListCtrl->InsertColumn(0, coldata);
6415         
6416         coldata.SetId(1);
6417         coldata.SetText(_("Pri."));
6418         coldata.SetWidth(32);
6419         ListCtrl->InsertColumn(1, coldata);
6420         
6421     } else if (ColumnType == CE_TITLE){
6422         
6423         coldata.SetId(0);
6424         coldata.SetText(_("Title"));
6425         coldata.SetWidth(288);
6426         ListCtrl->InsertColumn(0, coldata);
6427         
6428         coldata.SetId(1);
6429         coldata.SetText(_("Pri."));
6430         coldata.SetWidth(32);
6431         ListCtrl->InsertColumn(1, coldata);
6432         
6433     } else if (ColumnType == CE_ROLE){
6434         
6435         coldata.SetId(0);
6436         coldata.SetText(_("Role"));
6437         coldata.SetWidth(288);
6438         ListCtrl->InsertColumn(0, coldata);
6439         
6440         coldata.SetId(1);
6441         coldata.SetText(_("Pri."));
6442         coldata.SetWidth(32);
6443         ListCtrl->InsertColumn(1, coldata);
6444         
6445     } else if (ColumnType == CE_ORG){
6446         
6447         coldata.SetId(0);
6448         coldata.SetText(_("Organisation"));
6449         coldata.SetWidth(288);
6450         ListCtrl->InsertColumn(0, coldata);
6451         
6452         coldata.SetId(1);
6453         coldata.SetText(_("Pri."));
6454         coldata.SetWidth(32);
6455         ListCtrl->InsertColumn(1, coldata);
6456         
6457     } else if (ColumnType == CE_NOTE){
6458         
6459         coldata.SetId(0);
6460         coldata.SetText(_("Notes"));
6461         coldata.SetWidth(288);
6462         ListCtrl->InsertColumn(0, coldata);
6463         
6464         coldata.SetId(1);
6465         coldata.SetText(_("Pri."));
6466         coldata.SetWidth(32);
6467         ListCtrl->InsertColumn(1, coldata);     
6468         
6469     } else if (ColumnType == CE_CATEGORIES){
6470         
6471         coldata.SetId(0);
6472         coldata.SetText(_("Category"));
6473         coldata.SetWidth(320);
6474         ListCtrl->InsertColumn(0, coldata);
6475         
6476         coldata.SetId(1);
6477         coldata.SetText(_("Pri."));
6478         coldata.SetWidth(32);
6479         ListCtrl->InsertColumn(1, coldata);
6480         
6481     } else if (ColumnType == CE_GROUPS){
6482         
6483         coldata.SetId(0);
6484         coldata.SetText(_("Member"));
6485         coldata.SetWidth(320);
6486         ListCtrl->InsertColumn(0, coldata);
6487         
6488     } else if (ColumnType == CE_GEOPOSITION){
6489         
6490         coldata.SetId(0);
6491         coldata.SetText(_("Geoposition"));
6492         coldata.SetWidth(320);
6493         ListCtrl->InsertColumn(0, coldata);
6494         
6495         coldata.SetId(1);
6496         coldata.SetText(_("Pri."));
6497         coldata.SetWidth(32);
6498         ListCtrl->InsertColumn(1, coldata);
6499         
6500     } else if (ColumnType == CE_PICTURES){
6501         
6502         coldata.SetId(0);
6503         coldata.SetText(_("Pictures"));
6504         coldata.SetWidth(128);
6505         ListCtrl->InsertColumn(0, coldata);
6506         
6507         coldata.SetId(1);
6508         coldata.SetText(_("Type"));
6509         coldata.SetWidth(64);
6510         ListCtrl->InsertColumn(1, coldata);             
6511         
6512         coldata.SetId(2);
6513         coldata.SetText(_("Pri."));
6514         coldata.SetWidth(32);
6515         ListCtrl->InsertColumn(2, coldata);
6516         
6517     } else if (ColumnType == CE_SOUNDS){
6518         
6519         coldata.SetId(0);
6520         coldata.SetText(_("Sounds"));
6521         coldata.SetWidth(128);
6522         ListCtrl->InsertColumn(0, coldata);
6523         
6524         coldata.SetId(1);
6525         coldata.SetText(_("Type"));
6526         coldata.SetWidth(64);
6527         ListCtrl->InsertColumn(1, coldata);             
6528         
6529         coldata.SetId(2);
6530         coldata.SetText(_("Pri."));
6531         coldata.SetWidth(32);
6532         ListCtrl->InsertColumn(2, coldata);
6533         
6534     } else if (ColumnType == CE_CALENDAR){
6535         
6536         coldata.SetId(0);
6537         coldata.SetText(_("Calendar Address"));
6538         coldata.SetWidth(224);
6539         ListCtrl->InsertColumn(0, coldata);
6540         
6541         coldata.SetId(1);
6542         coldata.SetText(_("Type"));
6543         coldata.SetWidth(64);
6544         ListCtrl->InsertColumn(1, coldata);             
6545         
6546         coldata.SetId(2);
6547         coldata.SetText(_("Pri."));
6548         coldata.SetWidth(32);
6549         ListCtrl->InsertColumn(2, coldata);
6550         
6551     } else if (ColumnType == CE_KEY){
6552         
6553         coldata.SetId(0);
6554         coldata.SetText(_("Key information"));
6555         coldata.SetWidth(224);
6556         ListCtrl->InsertColumn(0, coldata);
6557         
6558         coldata.SetId(1);
6559         coldata.SetText(_("Type"));
6560         coldata.SetWidth(64);
6561         ListCtrl->InsertColumn(1, coldata);             
6562         
6563         coldata.SetId(2);
6564         coldata.SetText(_("Pri."));
6565         coldata.SetWidth(32);
6566         ListCtrl->InsertColumn(2, coldata);
6567         
6568     } else if (ColumnType == CE_TOKEN){
6569         
6570         coldata.SetId(0);
6571         coldata.SetText(_("Token"));
6572         coldata.SetWidth(320);
6573         ListCtrl->InsertColumn(0, coldata);
6574         
6575     }
6576     
6579 int frmContactEditor::GetLastInt(std::map<int, wxString> *MapData){
6580     
6581     /*
6582      int intResult = 0;
6583      
6584      std::map<int,wxString>::iterator iwxsit;
6585      
6586      for( iwxsit=(*MapData).begin(); iwxsit != (*MapData).end(); iwxsit++){
6587      intResult = (*iwxsit).first;
6588      }
6589      
6590      return intResult;
6591      */
6592     
6593     intValueSeek++;
6594     return intValueSeek;
6595     
6598 int frmContactEditor::GetLastInt(std::map<int, std::string> *MapData){
6599     
6600     /* int intResult = 0;
6601      
6602      std::map<int,std::string>::iterator iwxsit;
6603      
6604      for( iwxsit=(*MapData).begin(); iwxsit != (*MapData).end(); iwxsit++){
6605      intResult = (*iwxsit).first;
6606      }*/
6607     
6608     intValueSeek++;
6609     return intValueSeek;
6610     
6613 bool frmContactEditor::GetSelectedItem(wxListCtrl *ListCtrlPtr, 
6614                                        long *longSelected,
6615                                        int *intSelectedData){
6616     
6617     *longSelected = -1;
6618     *intSelectedData = 0;
6619     
6620     *longSelected = ListCtrlPtr->GetNextItem(*longSelected, 
6621                                              wxLIST_NEXT_ALL,
6622                                              wxLIST_STATE_SELECTED);
6623     
6624     if (*longSelected == -1){
6625         return FALSE;
6626     }
6627     else {
6628         return TRUE;
6629     }
6630     
6633 void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map<int, std::string>* MapData){
6634     MapData->erase(IndexNum);
6637 void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map<int, wxString>* MapData){
6638     MapData->erase(IndexNum);
6641 void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map<int, int>* MapData){
6642     MapData->erase(IndexNum);
6645 void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map<int, bool>* MapData){
6646     MapData->erase(IndexNum);
6649 void frmContactEditor::ProcessSaveDataProc( wxString PropName,
6650                                            std::map<int,int>* MapData){
6651     
6652     int intIterVal = (*iterDataPtr)->first;
6653     
6654     std::map<int,int>::iterator intIter;
6655     
6656     intIter = MapData->find(intIterVal);
6657     
6658     int intPropValue; 
6659     
6660     if (intIter->first == intIterVal){
6661         
6662         intPropValue = intIter->second;
6663         
6664         if (intPropValue){
6665             
6666             if (*boolAdditionalPtr == TRUE){
6667                 
6668                 strPropertyPtr->Append(wxT(";"));
6669                 
6670             } else {
6671                 
6672                 *boolAdditionalPtr = TRUE;
6673                 
6674             }
6675             
6676             strPropertyPtr->Append(PropName + wxT("=") + wxString::Format(wxT("%i"), intPropValue));
6677             
6678             *boolExtraPtr = TRUE;
6679             
6680         }
6681         
6682     }
6683     
6686 void frmContactEditor::ProcessSaveDataProc( wxString PropName,
6687                                            std::map<int,wxString>* MapData){
6688     
6689     int intIterVal;
6690     
6691     intIterVal = (*iterDataPtr)->first;
6692     
6693     std::map<int,wxString>::iterator strIter;
6694     
6695     strIter = MapData->find(intIterVal);
6696     
6697     if (strIter == MapData->end()){
6698         
6699         return;
6700         
6701     }
6702     
6703     wxString strPropValue;
6704     
6705     if (strIter->first == intIterVal){
6706         
6707         strPropValue = strIter->second;
6708         
6709         if (!strPropValue.IsEmpty() && PropName.IsEmpty()){
6710             
6711             strPropValue.Trim();
6712             strPropValue.Trim();
6713             
6714             if (*boolAdditionalPtr == TRUE){
6715                 
6716                 strPropertyPtr->Append(wxT(";"));
6717                 
6718             } else {
6719                 
6720                 *boolAdditionalPtr = TRUE;
6721                 
6722             }
6723             
6724             strPropertyPtr->Append(strPropValue);       
6725             
6726             *boolExtraPtr = TRUE;
6727             
6728             return;
6729             
6730         }
6731         
6732         if (!strPropValue.IsEmpty()){
6733             
6734             strPropValue.Trim();
6735             strPropValue.Trim();
6736             
6737             if (*boolAdditionalPtr == TRUE){
6738                 
6739                 strPropertyPtr->Append(wxT(";"));
6740                 
6741             } else {
6742                 
6743                 *boolAdditionalPtr = TRUE;
6744                 
6745             }
6746             
6747             // Look for semi-colon in property name and if there is then
6748             // quote the value.
6749             
6750             if (PropName != wxT("TYPE")){
6751                 
6752                 EscapeString(&strPropValue, FALSE);     
6753                 
6754             }
6755             
6756             if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND &&
6757                 strPropValue.find(wxT(",")) == wxNOT_FOUND){
6758                 
6759                 strPropertyPtr->Append(PropName + wxT("=") + strPropValue);
6760                 
6761             } else {
6762                 
6763                 strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\""));
6764                 
6765             }
6766             
6767             *boolExtraPtr = TRUE;
6768             
6769         }
6770         
6771     }
6772     
6775 void frmContactEditor::ProcessSaveDataStrProc( wxString PropName,
6776                                               std::map<int,std::string>* MapData){
6777     
6778     int intIterVal = (*iterDataStringPtr)->first;
6779     
6780     //std::map<int,wxString>::iterator strIter;
6781     
6782     std::map<int,std::string>::iterator stdstrIter;
6783     
6784     stdstrIter = MapData->find(intIterVal);     
6785     
6786     if (stdstrIter->first == intIterVal){
6787         
6788         wxString strPropValue(stdstrIter->second.c_str(), wxConvUTF8);
6789         
6790         if (!strPropValue.IsEmpty() && PropName.IsEmpty()){
6791             
6792             strPropValue.Trim();
6793             strPropValue.Trim();
6794             
6795             if (*boolAdditionalPtr == TRUE){
6796                 
6797                 strPropertyPtr->Append(wxT(";"));
6798                 
6799             } else {
6800                 
6801                 *boolAdditionalPtr = TRUE;
6802                 
6803             }
6804             
6805             strPropertyPtr->Append(strPropValue);
6806             
6807             *boolExtraPtr = TRUE;
6808             
6809             return;
6810             
6811         }
6812         
6813         if (!strPropValue.IsEmpty()){
6814             
6815             strPropValue.Trim();
6816             strPropValue.Trim();
6817             
6818             if (*boolAdditionalPtr == TRUE){
6819                 
6820                 strPropertyPtr->Append(wxT(";"));
6821                 
6822             } else {
6823                 
6824                 *boolAdditionalPtr = TRUE;
6825                 
6826             }
6827             
6828             // Look for semi-colon in property name and if there is then
6829             // quote the value.
6830             
6831             if (PropName != wxT("TYPE")){
6832                 
6833                 EscapeString(&strPropValue, FALSE);
6834                 
6835             }
6836             
6837             if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND &&
6838                 strPropValue.find(wxT(",")) == wxNOT_FOUND){
6839                 
6840                 strPropertyPtr->Append(PropName + wxT("=") + strPropValue);
6841                 
6842             } else {
6843                 
6844                 strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\""));
6845                 
6846             }
6847             
6848             *boolExtraPtr = TRUE;
6849             
6850         }
6851         
6852     }
6853     
6857 void frmContactEditor::ProcessSaveDataStrProc( wxString PropName,
6858                                               std::map<int,int>* MapData){
6859     
6860     int intIterVal = (*iterDataStringPtr)->first;
6861     
6862     std::map<int,int>::iterator intIter;
6863     
6864     intIter = MapData->find(intIterVal);
6865     
6866     int intPropValue; 
6867     
6868     if (intIter->first == intIterVal){
6869         
6870         intPropValue = intIter->second;
6871         
6872         if (intPropValue){
6873             
6874             if (*boolAdditionalPtr == TRUE){
6875                 
6876                 strPropertyPtr->Append(wxT(";"));
6877                 
6878             } else {
6879                 
6880                 *boolAdditionalPtr = TRUE;
6881                 
6882             }
6883             
6884             strPropertyPtr->Append(PropName + wxT("=") + wxString::Format(wxT("%i"), intPropValue));
6885             
6886             *boolExtraPtr = TRUE;
6887             
6888         }
6889         
6890     }
6891     
6894 void frmContactEditor::ProcessSaveDataStrProc( wxString PropName,
6895                                               std::map<int,wxString>* MapData){
6896     
6897     int intIterVal;
6898     
6899     intIterVal = (*iterDataStringPtr)->first;
6900     
6901     std::map<int,wxString>::iterator strIter;
6902     
6903     strIter = MapData->find(intIterVal);
6904     
6905     wxString strPropValue;
6906     
6907     if (strIter->first == intIterVal){
6908         
6909         strPropValue = strIter->second;
6910         
6911         if (!strPropValue.IsEmpty() && PropName.IsEmpty()){
6912             
6913             strPropValue.Trim();
6914             strPropValue.Trim();
6915             
6916             if (*boolAdditionalPtr == TRUE){
6917                 
6918                 strPropertyPtr->Append(wxT(";"));
6919                 
6920             } else {
6921                 
6922                 *boolAdditionalPtr = TRUE;
6923                 
6924             }
6925             
6926             strPropertyPtr->Append(strPropValue);       
6927             
6928             *boolExtraPtr = TRUE;
6929             
6930             return;
6931             
6932         }
6933         
6934         if (!strPropValue.IsEmpty()){
6935             
6936             strPropValue.Trim();
6937             strPropValue.Trim();
6938             
6939             if (*boolAdditionalPtr == TRUE){
6940                 
6941                 strPropertyPtr->Append(wxT(";"));
6942                 
6943             } else {
6944                 
6945                 *boolAdditionalPtr = TRUE;
6946                 
6947             }
6948             
6949             // Look for semi-colon in property name and if there is then
6950             // quote the value.
6951             
6952             if (PropName != wxT("TYPE")){
6953                 
6954                 EscapeString(&strPropValue, FALSE);
6955                 
6956             }
6957             
6958             if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND &&
6959                 strPropValue.find(wxT(",")) == wxNOT_FOUND){
6960                 
6961                 strPropertyPtr->Append(PropName + wxT("=") + strPropValue);
6962                 
6963             } else {
6964                 
6965                 strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\""));
6966                 
6967             }
6968             
6969             *boolExtraPtr = TRUE;
6970             
6971         }
6972         
6973     }
6974     
6977 void frmContactEditor::ProcessCaptureStringsProc(wxString *strCapture){
6978     
6979     CaptureString(strCapture, FALSE);
6980     
6983 void frmContactEditor::ResetSaveProcessData(){
6984     
6985     strValue.Clear();
6986     strValue2.Clear();
6987     strValue3.Clear();    
6988     
6989     boolValue = FALSE;
6990     boolValue2 = FALSE;    
6991     intValue2 = 0;
6992     intValue  = 0;
6993     
6996 void frmContactEditor::SetupPointers(frmActivityMgr *ActMgr, wxETagProcessTimer *ETagProc,
6997                                      frmMain *MainPtrInc){
6998     
6999     ActMgrPtr = ActMgr;
7000     ETagTmrPtr = ETagProc;
7001     MainPtr = MainPtrInc;
7002     
7005 void frmContactEditor::ClearContact(){
7006     
7007     // Clear out the GUI and values.
7008     
7009     // Clear GUI.
7010     
7011     txtTitle->Clear();
7012     txtForename->Clear();
7013     txtSurname->Clear();
7014     txtOtherNames->Clear();
7015     txtSuffix->Clear();
7016     cmbDisplayAs->Clear();
7017     cmbDisplayAs->SetValue(wxT(""));
7018     wxDateTime EmptyDate;
7019     wxBitmap EmptyBitmap;
7020     dapAnniversary->SetValue(EmptyDate);
7021     dapBirthday->SetValue(EmptyDate);
7022     txtBirthday->Clear();
7023     txtAnniversary->Clear();
7024     cmbGender->Select(0);
7025     txtGenderDescription->Clear();
7026     
7027     lboNicknames->DeleteAllItems();
7028     lboHomeNicknames->DeleteAllItems();
7029     lboBusinessNicknames->DeleteAllItems();
7030     
7031     lboAddresses->DeleteAllItems();
7032     lboHomeAddresses->DeleteAllItems();
7033     lboBusinessAddresses->DeleteAllItems();
7034     
7035     lboEmails->DeleteAllItems();
7036     lboHomeEmails->DeleteAllItems();
7037     lboBusinessEmail->DeleteAllItems();
7038     
7039     lboIM->DeleteAllItems();
7040     lboHomeIM->DeleteAllItems();
7041     lboBusinessIM->DeleteAllItems();
7042     
7043     lboTelephone->DeleteAllItems();
7044     lboHomeTelephone->DeleteAllItems();
7045     lboBusinessTelephone->DeleteAllItems();
7046     
7047     lboLanguages->DeleteAllItems();
7048     lboHomeLanguages->DeleteAllItems();
7049     lboBusinessLanguages->DeleteAllItems();
7050     
7051     lboTimezones->DeleteAllItems();
7052     lboHomeTimezones->DeleteAllItems();
7053     lboBusinessTimezones->DeleteAllItems();
7054     
7055     lboGeoposition->DeleteAllItems();
7056     lboHomeGeoposition->DeleteAllItems();
7057     lboBusinessGeoposition->DeleteAllItems();
7058     
7059     lboRelated->DeleteAllItems();
7060     
7061     lboWebsites->DeleteAllItems();
7062     lboHomeWebsites->DeleteAllItems();
7063     lboBusinessWebsites->DeleteAllItems();
7064     
7065     lboTitles->DeleteAllItems();
7066     lboHomeTitles->DeleteAllItems();
7067     lboBusinessTitles->DeleteAllItems();
7068     
7069     lboRoles->DeleteAllItems();
7070     lboHomeRoles->DeleteAllItems();
7071     lboBusinessRoles->DeleteAllItems();
7072     
7073     lboOrganisations->DeleteAllItems();
7074     lboHomeOrganisations->DeleteAllItems();
7075     lboBusinessOrganisations->DeleteAllItems();
7076     
7077     lboNotes->DeleteAllItems();
7078     lboHomeNotes->DeleteAllItems();
7079     lboBusinessNotes->DeleteAllItems();
7080     
7081     lboCategories->DeleteAllItems();
7082     
7083     lboGroups->DeleteAllItems();
7084     
7085     // Clear Picture
7086     lboPictures->DeleteAllItems();
7087     imgPicture->SetBitmap(EmptyBitmap);
7088     
7089     // Clear Logo
7090     lboLogos->DeleteAllItems();
7091     imgLogo->SetBitmap(EmptyBitmap);
7092     
7093     lboSounds->DeleteAllItems();
7094     
7095     lboCalendarAddresses->DeleteAllItems();
7096     lboCalendarRequestAddress->DeleteAllItems();
7097     lboFreeBusyAddresses->DeleteAllItems();
7098     
7099     lboKeys->DeleteAllItems();
7100     
7101     lboVendorNamespace->DeleteAllItems();
7102     lboXToken->DeleteAllItems();
7103     
7104     // Clear values out.
7105     
7106     wxString NameTitle;
7107     wxString NameForename;
7108     wxString NameSurname;
7109     wxString NameOtherNames;
7110     wxString NameSuffix;
7111     wxString NameNickname;
7112     wxString NameDisplayAs;
7113     wxString NameLanguage;
7114     wxString NameAltID;
7115     wxString NameTokens;
7116     
7117     wxString Birthday;
7118     wxString BirthdayAltID;
7119     wxString BirthdayCalScale;
7120     wxString BirthdayTokens;
7121     wxString Anniversary;
7122     wxString AnniversaryAltID;
7123     wxString AnniversaryCalScale;
7124     wxString AnniversaryTokens;
7125     
7126     wxString Gender;
7127     wxString GenderDetails;
7128     wxString GenderTokens;
7129     
7130     wxString UIDToken;
7131     
7132     /* We don't use these at the moment but we want to keep
7133      them for compatability reasons */
7134     
7135     /*std::map<int, wxString> ExtraFullNames;*/
7136     /*std::map<int, wxString> ExtraNicknames;*/
7137     
7138     FullNamesList.clear();    
7139     FullNamesListType.clear();
7140     FullNamesListLanguage.clear();
7141     FullNamesListAltID.clear();
7142     FullNamesListPID.clear();
7143     FullNamesListTokens.clear();
7144     FullNamesListPref.clear();
7145     
7146     GeneralNicknamesList.clear();
7147     GeneralNicknamesListType.clear();
7148     GeneralNicknamesListLanguage.clear();
7149     GeneralNicknamesListAltID.clear();
7150     GeneralNicknamesListPID.clear();
7151     GeneralNicknamesListTokens.clear();        
7152     GeneralNicknamesListPref.clear();        
7153     
7154     GeneralAddressList.clear();
7155     GeneralAddressListTown.clear();
7156     GeneralAddressListCounty.clear();
7157     GeneralAddressListPostCode.clear();
7158     GeneralAddressListCountry.clear();
7159     GeneralAddressListLabel.clear();
7160     GeneralAddressListLang.clear();        
7161     GeneralAddressListAltID.clear();
7162     GeneralAddressListPID.clear();
7163     GeneralAddressListTokens.clear();
7164     GeneralAddressListGeo.clear();
7165     GeneralAddressListTimezone.clear();        
7166     GeneralAddressListType.clear();
7167     GeneralAddressListMediatype.clear();
7168     GeneralAddressListPref.clear();
7169     
7170     GeneralEmailList.clear();
7171     GeneralEmailListAltID.clear();
7172     GeneralEmailListPID.clear();
7173     GeneralEmailListType.clear();
7174     GeneralEmailListTokens.clear();
7175     GeneralEmailListPref.clear();
7176     
7177     GeneralIMList.clear();
7178     GeneralIMListAltID.clear();
7179     GeneralIMListPID.clear();
7180     GeneralIMListType.clear();
7181     GeneralIMListTokens.clear();
7182     GeneralIMListMediatype.clear();
7183     GeneralIMListPref.clear();
7184     
7185     GeneralTelephoneList.clear();
7186     GeneralTelephoneListAltID.clear();
7187     GeneralTelephoneListPID.clear();
7188     GeneralTelephoneListType.clear();
7189     GeneralTelephoneListTokens.clear();
7190     GeneralTelephoneListPref.clear();
7191     
7192     GeneralLanguageList.clear();
7193     GeneralLanguageListAltID.clear();
7194     GeneralLanguageListPID.clear();
7195     GeneralLanguageListType.clear();
7196     GeneralLanguageListTokens.clear();
7197     GeneralLanguageListPref.clear();
7198     
7199     GeneralTZList.clear();
7200     GeneralTZListAltID.clear();
7201     GeneralTZListPID.clear();
7202     GeneralTZListType.clear();
7203     GeneralTZListTokens.clear();
7204     GeneralTZListMediatype.clear();
7205     GeneralTZListPref.clear();
7206     
7207     GeneralGeographyList.clear();
7208     GeneralGeographyListAltID.clear();
7209     GeneralGeographyListPID.clear();
7210     GeneralGeographyListType.clear();
7211     GeneralGeographyListTokens.clear();
7212     GeneralGeographyListMediatype.clear();
7213     GeneralGeographyListPref.clear();
7214     
7215     GeneralRelatedList.clear();
7216     GeneralRelatedListRelType.clear();
7217     GeneralRelatedListLanguage.clear();
7218     GeneralRelatedListAltID.clear();
7219     GeneralRelatedListPID.clear();
7220     GeneralRelatedListType.clear();
7221     GeneralRelatedListTokens.clear();
7222     GeneralRelatedListPref.clear();
7223     
7224     GeneralWebsiteList.clear();
7225     GeneralWebsiteListAltID.clear();
7226     GeneralWebsiteListPID.clear();
7227     GeneralWebsiteListType.clear();
7228     GeneralWebsiteListTokens.clear();
7229     GeneralWebsiteListMediatype.clear();
7230     GeneralWebsiteListPref.clear();
7231     
7232     GeneralTitleList.clear();
7233     GeneralTitleListLanguage.clear();        
7234     GeneralTitleListAltID.clear();
7235     GeneralTitleListPID.clear();
7236     GeneralTitleListType.clear();
7237     GeneralTitleListTokens.clear();
7238     GeneralTitleListPref.clear();
7239     
7240     GeneralRoleList.clear();
7241     GeneralRoleListLanguage.clear();        
7242     GeneralRoleListAltID.clear();
7243     GeneralRoleListPID.clear();
7244     GeneralRoleListType.clear();
7245     GeneralRoleListTokens.clear();
7246     GeneralRoleListPref.clear();
7247     
7248     GeneralOrganisationsList.clear();
7249     GeneralOrganisationsListLanguage.clear();        
7250     GeneralOrganisationsListAltID.clear();
7251     GeneralOrganisationsListPID.clear();
7252     GeneralOrganisationsListType.clear();
7253     GeneralOrganisationsListTokens.clear();
7254     GeneralOrganisationsListSortAs.clear();
7255     GeneralOrganisationsListPref.clear();
7256     
7257     GeneralNoteList.clear();
7258     GeneralNoteListLanguage.clear();        
7259     GeneralNoteListAltID.clear();
7260     GeneralNoteListPID.clear();
7261     GeneralNoteListType.clear();
7262     GeneralNoteListTokens.clear();
7263     GeneralNoteListPref.clear();
7264     
7265     /* Items on Home Tab */        
7266     
7267     HomeNicknamesList.clear();
7268     HomeNicknamesListType.clear();
7269     HomeNicknamesListLanguage.clear();
7270     HomeNicknamesListAltID.clear();
7271     HomeNicknamesListPID.clear();
7272     HomeNicknamesListTokens.clear();        
7273     HomeNicknamesListPref.clear();        
7274     
7275     HomeAddressList.clear();
7276     HomeAddressListTown.clear();
7277     HomeAddressListCounty.clear();
7278     HomeAddressListPostCode.clear();
7279     HomeAddressListCountry.clear();
7280     HomeAddressListLabel.clear();
7281     HomeAddressListLang.clear();        
7282     HomeAddressListAltID.clear();
7283     HomeAddressListPID.clear();
7284     HomeAddressListTokens.clear();
7285     HomeAddressListGeo.clear();
7286     HomeAddressListTimezone.clear();        
7287     HomeAddressListType.clear();
7288     HomeAddressListMediatype.clear();
7289     HomeAddressListPref.clear();
7290     
7291     HomeEmailList.clear();
7292     HomeEmailListAltID.clear();
7293     HomeEmailListPID.clear();
7294     HomeEmailListType.clear();
7295     HomeEmailListTokens.clear();
7296     HomeEmailListPref.clear();
7297     
7298     HomeIMList.clear();
7299     HomeIMListAltID.clear();
7300     HomeIMListPID.clear();
7301     HomeIMListType.clear();
7302     HomeIMListTokens.clear();
7303     HomeIMListMediatype.clear();
7304     HomeIMListPref.clear();
7305     
7306     HomeTelephoneList.clear();
7307     HomeTelephoneListAltID.clear();
7308     HomeTelephoneListPID.clear();
7309     HomeTelephoneListType.clear();
7310     HomeTelephoneListTokens.clear();
7311     HomeTelephoneListPref.clear();
7312     
7313     HomeLanguageList.clear();
7314     HomeLanguageListAltID.clear();
7315     HomeLanguageListPID.clear();
7316     HomeLanguageListType.clear();
7317     HomeLanguageListTokens.clear();
7318     HomeLanguageListPref.clear();
7319     
7320     HomeTZList.clear();
7321     HomeTZListAltID.clear();
7322     HomeTZListPID.clear();
7323     HomeTZListType.clear();
7324     HomeTZListTokens.clear();
7325     HomeTZListMediatype.clear();
7326     HomeTZListPref.clear();
7327     
7328     HomeGeographyList.clear();
7329     HomeGeographyListAltID.clear();
7330     HomeGeographyListPID.clear();
7331     HomeGeographyListType.clear();
7332     HomeGeographyListTokens.clear();
7333     HomeGeographyListMediatype.clear();
7334     HomeGeographyListPref.clear();
7335     
7336     HomeRelatedList.clear();
7337     HomeRelatedListRelType.clear();
7338     HomeRelatedListLanguage.clear();
7339     HomeRelatedListAltID.clear();
7340     HomeRelatedListPID.clear();
7341     HomeRelatedListType.clear();
7342     HomeRelatedListTokens.clear();
7343     HomeRelatedListPref.clear();        
7344     
7345     HomeWebsiteList.clear();
7346     HomeWebsiteListAltID.clear();
7347     HomeWebsiteListPID.clear();
7348     HomeWebsiteListType.clear();
7349     HomeWebsiteListTokens.clear();
7350     HomeWebsiteListMediatype.clear();
7351     HomeWebsiteListPref.clear();
7352     
7353     HomeTitleList.clear();
7354     HomeTitleListLanguage.clear();
7355     HomeTitleListAltID.clear();
7356     HomeTitleListPID.clear();
7357     HomeTitleListType.clear();
7358     HomeTitleListTokens.clear();
7359     HomeTitleListPref.clear();
7360     
7361     HomeRoleList.clear();
7362     HomeRoleListLanguage.clear();        
7363     HomeRoleListAltID.clear();
7364     HomeRoleListPID.clear();
7365     HomeRoleListType.clear();
7366     HomeRoleListTokens.clear();
7367     HomeRoleListPref.clear();
7368     
7369     HomeOrganisationsList.clear();
7370     HomeOrganisationsListLanguage.clear();        
7371     HomeOrganisationsListAltID.clear();
7372     HomeOrganisationsListPID.clear();
7373     HomeOrganisationsListType.clear();
7374     HomeOrganisationsListTokens.clear();
7375     HomeOrganisationsListSortAs.clear();
7376     HomeOrganisationsListPref.clear();
7377     
7378     HomeNoteList.clear();
7379     HomeNoteListLanguage.clear();        
7380     HomeNoteListAltID.clear();
7381     HomeNoteListPID.clear();
7382     HomeNoteListType.clear();
7383     HomeNoteListTokens.clear();
7384     HomeNoteListPref.clear();        
7385     
7386     /* Items on the Business tab */
7387     
7388     BusinessNicknamesList.clear();
7389     BusinessNicknamesListType.clear();
7390     BusinessNicknamesListLanguage.clear();
7391     BusinessNicknamesListAltID.clear();
7392     BusinessNicknamesListPID.clear();
7393     BusinessNicknamesListTokens.clear();        
7394     BusinessNicknamesListPref.clear();        
7395     
7396     BusinessAddressList.clear();
7397     BusinessAddressListTown.clear();
7398     BusinessAddressListCounty.clear();
7399     BusinessAddressListPostCode.clear();
7400     BusinessAddressListCountry.clear();
7401     BusinessAddressListLabel.clear();
7402     BusinessAddressListLang.clear();        
7403     BusinessAddressListAltID.clear();
7404     BusinessAddressListPID.clear();
7405     BusinessAddressListTokens.clear();
7406     BusinessAddressListGeo.clear();
7407     BusinessAddressListTimezone.clear();        
7408     BusinessAddressListType.clear();
7409     BusinessAddressListMediatype.clear();
7410     BusinessAddressListPref.clear();
7411     
7412     BusinessEmailList.clear();
7413     BusinessEmailListAltID.clear();
7414     BusinessEmailListPID.clear();
7415     BusinessEmailListType.clear();
7416     BusinessEmailListTokens.clear();
7417     BusinessEmailListPref.clear();
7418     
7419     BusinessIMList.clear();
7420     BusinessIMListAltID.clear();
7421     BusinessIMListPID.clear();
7422     BusinessIMListType.clear();
7423     BusinessIMListTokens.clear();
7424     BusinessIMListMediatype.clear();
7425     BusinessIMListPref.clear();
7426     
7427     BusinessTelephoneList.clear();
7428     BusinessTelephoneListAltID.clear();
7429     BusinessTelephoneListPID.clear();
7430     BusinessTelephoneListType.clear();
7431     BusinessTelephoneListTokens.clear();
7432     BusinessTelephoneListPref.clear();
7433     
7434     BusinessLanguageList.clear();
7435     BusinessLanguageListAltID.clear();
7436     BusinessLanguageListPID.clear();
7437     BusinessLanguageListType.clear();
7438     BusinessLanguageListTokens.clear();
7439     BusinessLanguageListPref.clear();
7440     
7441     BusinessTZList.clear();
7442     BusinessTZListAltID.clear();
7443     BusinessTZListPID.clear();
7444     BusinessTZListType.clear();
7445     BusinessTZListTokens.clear();
7446     BusinessTZListMediatype.clear();
7447     BusinessTZListPref.clear();
7448     
7449     BusinessGeographyList.clear();
7450     BusinessGeographyListAltID.clear();
7451     BusinessGeographyListPID.clear();
7452     BusinessGeographyListType.clear();
7453     BusinessGeographyListTokens.clear();
7454     BusinessGeographyListMediatype.clear();
7455     BusinessGeographyListPref.clear();
7456     
7457     BusinessRelatedList.clear();
7458     BusinessRelatedListRelType.clear();
7459     BusinessRelatedListLanguage.clear();
7460     BusinessRelatedListAltID.clear();
7461     BusinessRelatedListPID.clear();
7462     BusinessRelatedListType.clear();
7463     BusinessRelatedListTokens.clear();
7464     BusinessRelatedListPref.clear();            
7465     
7466     BusinessWebsiteList.clear();
7467     BusinessWebsiteListAltID.clear();
7468     BusinessWebsiteListPID.clear();
7469     BusinessWebsiteListType.clear();
7470     BusinessWebsiteListTokens.clear();
7471     BusinessWebsiteListMediatype.clear();
7472     BusinessWebsiteListPref.clear();
7473     
7474     BusinessTitleList.clear();
7475     BusinessTitleListLanguage.clear();        
7476     BusinessTitleListAltID.clear();
7477     BusinessTitleListPID.clear();
7478     BusinessTitleListType.clear();
7479     BusinessTitleListTokens.clear();
7480     BusinessTitleListPref.clear();
7481     
7482     BusinessRoleList.clear();
7483     BusinessRoleListLanguage.clear();        
7484     BusinessRoleListAltID.clear();
7485     BusinessRoleListPID.clear();
7486     BusinessRoleListType.clear();
7487     BusinessRoleListTokens.clear();
7488     BusinessRoleListPref.clear();
7489     
7490     BusinessOrganisationsList.clear();
7491     BusinessOrganisationsListLanguage.clear();        
7492     BusinessOrganisationsListAltID.clear();
7493     BusinessOrganisationsListPID.clear();
7494     BusinessOrganisationsListType.clear();
7495     BusinessOrganisationsListTokens.clear();
7496     BusinessOrganisationsListSortAs.clear();        
7497     BusinessOrganisationsListPref.clear();
7498     
7499     BusinessNoteList.clear();
7500     BusinessNoteListLanguage.clear();        
7501     BusinessNoteListAltID.clear();
7502     BusinessNoteListPID.clear();
7503     BusinessNoteListType.clear();
7504     BusinessNoteListTokens.clear();
7505     BusinessNoteListPref.clear();        
7506     
7507     /* Items on the Categories tab */
7508     
7509     CategoriesList.clear();
7510     CategoriesListAltID.clear();
7511     CategoriesListPID.clear();
7512     CategoriesListType.clear();
7513     CategoriesListTokens.clear();
7514     CategoriesListPref.clear();    
7515     
7516     /* Items on the Groups tab */
7517     
7518     GroupsList.clear();
7519     GroupsListAltID.clear();
7520     GroupsListPID.clear();
7521     GroupsListType.clear();
7522     GroupsListTokens.clear();
7523     GroupsListPref.clear();
7524     
7525     /* Items on the Pictures tab */
7526     
7527     PicturesList.clear();
7528     PicturesListAltID.clear();
7529     PicturesListPID.clear();
7530     PicturesListType.clear();
7531     PicturesListPicEncType.clear();
7532     PicturesListPictureType.clear();
7533     PicturesListTokens.clear();
7534     PicturesListMediatype.clear();        
7535     PicturesListPref.clear();
7536     
7537     /* Items on the Logos tab */
7538     
7539     LogosList.clear();
7540     LogosListAltID.clear();
7541     LogosListPID.clear();
7542     LogosListType.clear();
7543     LogosListPicEncType.clear();        
7544     LogosListPictureType.clear();
7545     LogosListTokens.clear();
7546     LogosListMediatype.clear();        
7547     LogosListPref.clear();
7548     
7549     /* Items on the Sounds tab */
7550     
7551     SoundsList.clear();
7552     SoundsListAltID.clear();
7553     SoundsListPID.clear();
7554     SoundsListType.clear();
7555     SoundsListAudioEncType.clear();        
7556     SoundsListAudioType.clear();        
7557     SoundsListTokens.clear();
7558     SoundsListMediatype.clear();        
7559     SoundsListPref.clear();    
7560     
7561     /* Items on the Calendaring tab */
7562     
7563     CalendarList.clear();
7564     CalendarListAltID.clear();
7565     CalendarListPID.clear();
7566     CalendarListType.clear();
7567     CalendarListTokens.clear();
7568     CalendarListMediatype.clear();        
7569     CalendarListPref.clear();
7570     
7571     CalendarRequestList.clear();
7572     CalendarRequestListAltID.clear();
7573     CalendarRequestListPID.clear();
7574     CalendarRequestListType.clear();
7575     CalendarRequestListTokens.clear();
7576     CalendarRequestListMediatype.clear();        
7577     CalendarRequestListPref.clear();        
7578     
7579     FreeBusyList.clear();
7580     FreeBusyListAltID.clear();
7581     FreeBusyListPID.clear();
7582     FreeBusyListType.clear();
7583     FreeBusyListTokens.clear();
7584     FreeBusyListMediatype.clear();        
7585     FreeBusyListPref.clear();
7586     
7587     /* Items on the Security tab */
7588     
7589     KeyList.clear();
7590     KeyListAltID.clear();
7591     KeyListPID.clear();
7592     KeyListKeyType.clear();        
7593     KeyListDataType.clear();        
7594     KeyListDataEncType.clear();
7595     KeyListType.clear();
7596     KeyListTokens.clear();
7597     KeyListPref.clear();
7598     
7599     /* Items on the Other tab */
7600     
7601     VendorList.clear();
7602     VendorListPEN.clear();
7603     VendorListElement.clear();
7604     
7605     XTokenList.clear();        
7606     XTokenListTokens.clear();
7607     
7608     wxSContactFilename.Clear();
7609     boolContactModified = FALSE;
7610     intSeekSelectedData = 0;
7611     
7612     /* Section for saving/loading data */
7613     
7614     ETag.Clear();
7615     ETagOriginal.Clear();
7616     
7617     strValue.Clear();
7618     strValue2.Clear();
7619     strValue3.Clear();
7620     
7621     boolValue = FALSE;
7622     boolValue2 = FALSE;
7623     intValue = 0;
7624     intValue2 = 0;
7625     intValue3 = 0;
7626     BinaryDataProc = FALSE;
7627     EditMode = TRUE;
7628     DialogOpen = FALSE;
7629     
7630     PictureImage = wxNullBitmap;
7631     LogoImage = wxNullBitmap;
7632     
7635 void frmContactEditor::ContactFileChanged( wxCommandEvent &event ){
7636     
7637     // Stop the timer.
7638     
7639     FMTimer.Stop();
7640     
7641     // Check if a dialog is already open.
7642     
7643     if (DialogOpen == TRUE){
7644         
7645         FMTimer.Start(1000, FALSE);
7646         return;
7647         
7648     }
7649     
7650     // Bring up a Yes/No modal dialog asking if the changed file should be reloaded.
7651     
7652     int QuestionResponse;
7653     
7654     QuestionResponse = wxMessageBox(_("This contact has changed. Saving the contact may overwrite or lose any changes done by that change. Do you want to reload the contact with the changes made?"), _("Contact information has changed"), wxYES_NO, this);
7655     
7656     if (QuestionResponse == wxYES){
7657         
7658         // Reload the contact.
7659         wxString wxSReloadContactName = wxSContactFilename;
7660         ClearContact();
7661         LoadContact(wxSReloadContactName);
7662         
7663     } else {
7664         
7665         // Do nothing other than update the timestamp so this message
7666         // doesn't appear until the next time it changes.
7667         
7668         FMTimer.UpdateTimestamp();
7669         
7670     }  
7671     
7672     // Start the timer.
7673     
7674     FMTimer.Start();
7675     
7678 void frmContactEditor::UpdateMembersTab( wxCommandEvent &event ){
7679     
7680     if (cmbType->GetCurrentSelection() == 2){
7681         
7682         tabMembers->Show();     
7683         
7684     } else {
7685         
7686         tabMembers->Hide();
7687         
7688     }
7689     
7692 void frmContactEditor::SetUID(int UID){
7693     
7694     ContactEditorUID = UID;
7695     
7698 void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
7699     
7700     // Generate a drop down list of common names to use for the display as drop down box.
7701     
7702     wxString SetValue = cmbDisplayAs->GetValue();
7703     
7704     cmbDisplayAs->Clear();
7705     cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
7706     if (!txtOtherNames->GetValue().IsEmpty()){
7707         
7708         cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());     
7709         
7710     }
7711     cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue()); 
7712     if (!txtOtherNames->GetValue().IsEmpty()){
7713         
7714         cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
7715         
7716     }
7717     if (!txtTitle->GetValue().IsEmpty()){
7718         cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtSurname->GetValue() + wxT(" ") + txtForename->GetValue());
7719     }
7720     
7721     cmbDisplayAs->SetValue(SetValue);
7722     
7723     this->SetTitle(cmbDisplayAs->GetValue());
7724     
7727 void frmContactEditor::UpdateName( wxCommandEvent &event ){
7728     
7729     this->SetTitle(cmbDisplayAs->GetValue());
7730     
7731     WindowData *WData = new WindowData;
7732     
7733     WData->DataType = 1;
7734     WData->WindowPointer = this;
7735     WData->WindowID = ContactEditorUID;
7736     
7737     wxCommandEvent editevent(WINDOW_EDIT);
7738     editevent.SetClientData(WData);
7739     wxPostEvent(GetParent(), editevent);
7740     
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