Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Splitting frmContactEditor.cpp into 15 files to make it more manageable.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 9 Oct 2015 07:30:11 +0000 (08:30 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 9 Oct 2015 07:30:11 +0000 (08:30 +0100)
17 files changed:
source/contacteditor/frmContactEditor-Business.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Calendar.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Category.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Events.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-General.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Groups.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Home.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Init.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Key.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Logo.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Other.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Picture.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Reset.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Save.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor-Sound.cpp [new file with mode: 0644]
source/contacteditor/frmContactEditor.cpp
source/contacteditor/frmContactEditor.h

diff --git a/source/contacteditor/frmContactEditor-Business.cpp b/source/contacteditor/frmContactEditor-Business.cpp
new file mode 100644 (file)
index 0000000..62480c1
--- /dev/null
@@ -0,0 +1,920 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorNickname.h"
+#include "frmContactEditorAddress.h"
+#include "frmContactEditorEmail.h"
+#include "frmContactEditorIM.h"
+#include "frmContactEditorTelephone.h"
+#include "frmContactEditorLanguages.h"
+#include "frmContactEditorTimezones.h"
+#include "frmContactEditorRelated.h"
+#include "frmContactEditorWebsites.h"
+#include "frmContactEditorTitles.h"
+#include "frmContactEditorRoles.h"
+#include "frmContactEditorGeoposition.h"
+#include "frmContactEditorGroups.h"
+#include "frmContactEditorOrganisations.h"
+#include "frmContactEditorNotes.h"
+
+void frmContactEditor::AddBusinessNickname( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
+    frameCENickname->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessNicknamesList);
+    frameCENickname->SetupPointers(&BusinessNicknamesList,
+                                   &BusinessNicknamesListAltID,
+                                   &BusinessNicknamesListPID,
+                                   &BusinessNicknamesListType,
+                                   &BusinessNicknamesListLanguage,
+                                   &BusinessNicknamesListTokens,
+                                   &BusinessNicknamesListPref,
+                                   lboBusinessNicknames,
+                                   (intValueSeek));
+    frameCENickname->ShowModal();
+    delete frameCENickname;
+    frameCENickname = NULL;
+}
+
+void frmContactEditor::ModifyBusinessNickname( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessNicknames,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
+    frameCENickname->SetupPointers(&BusinessNicknamesList,
+                                   &BusinessNicknamesListAltID,
+                                   &BusinessNicknamesListPID,
+                                   &BusinessNicknamesListType,
+                                   &BusinessNicknamesListLanguage,
+                                   &BusinessNicknamesListTokens,
+                                   &BusinessNicknamesListPref,
+                                   lboBusinessNicknames,
+                                   intSelectedData);
+    frameCENickname->SetEditorMode(TRUE, CE_WORK);
+    frameCENickname->ShowModal();
+    delete frameCENickname;
+    frameCENickname = NULL;
+}
+
+void frmContactEditor::DeleteBusinessNickname( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessNicknames,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessNicknames->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData,
+                  &BusinessNicknamesList,
+                  &BusinessNicknamesListLanguage,
+                  &BusinessNicknamesListAltID,
+                  &BusinessNicknamesListPID,
+                  &BusinessNicknamesListTokens,
+                  &BusinessNicknamesListType,
+                  &BusinessNicknamesListPref);
+}
+
+void frmContactEditor::AddBusinessAddress( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+    frameCEAddress->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessAddressList);
+    frameCEAddress->SetupPointers(&BusinessAddressList,
+                                  &BusinessAddressListTown,
+                                  &BusinessAddressListCounty,
+                                  &BusinessAddressListPostCode,
+                                  &BusinessAddressListCountry,
+                                  &BusinessAddressListLabel,
+                                  &BusinessAddressListLang,
+                                  &BusinessAddressListAltID,
+                                  &BusinessAddressListPID,
+                                  &BusinessAddressListTokens,
+                                  &BusinessAddressListGeo,
+                                  &BusinessAddressListTimezone,
+                                  &BusinessAddressListType,
+                                  &BusinessAddressListMediatype,
+                                  &BusinessAddressListPref,
+                                  lboBusinessAddresses,
+                                  (intValueSeek));
+    frameCEAddress->ShowModal();
+    delete frameCEAddress;
+    frameCEAddress = NULL;
+}
+
+void frmContactEditor::ModifyBusinessAddress( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+    frameCEAddress->SetupPointers(&BusinessAddressList,
+                                  &BusinessAddressListTown,
+                                  &BusinessAddressListCounty,
+                                  &BusinessAddressListPostCode,
+                                  &BusinessAddressListCountry,
+                                  &BusinessAddressListLabel,
+                                  &BusinessAddressListLang,
+                                  &BusinessAddressListAltID,
+                                  &BusinessAddressListPID,
+                                  &BusinessAddressListTokens,
+                                  &BusinessAddressListGeo,
+                                  &BusinessAddressListTimezone,
+                                  &BusinessAddressListType,
+                                  &BusinessAddressListMediatype,
+                                  &BusinessAddressListPref,
+                                  lboBusinessAddresses,
+                                  intSelectedData);
+    frameCEAddress->SetEditorMode(TRUE, CE_WORK);
+    frameCEAddress->ShowModal();
+    delete frameCEAddress;
+    frameCEAddress = NULL;
+}
+
+void frmContactEditor::DeleteBusinessAddress( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessAddresses->DeleteItem(longSelected);
+    DeleteMapData(intSelectedData, &BusinessAddressList,
+                  &BusinessAddressListTown, &BusinessAddressListCounty,
+                  &BusinessAddressListPostCode, &BusinessAddressListCountry,
+                  &BusinessAddressList, &BusinessAddressListLabel,
+                  &BusinessAddressListLang, &BusinessAddressListAltID,
+                  &BusinessAddressListPID, &BusinessAddressListTokens,
+                  &BusinessAddressListGeo, &BusinessAddressListTimezone,
+                  &BusinessAddressListType, &BusinessAddressListMediatype,
+                  &BusinessAddressListPref);
+    
+}
+
+void frmContactEditor::AddBusinessEmail( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
+    frameCEEmail->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessAddressList);
+    frameCEEmail->SetupPointers(&BusinessEmailList,
+                                &BusinessEmailListAltID,
+                                &BusinessEmailListPID,
+                                &BusinessEmailListType,
+                                &BusinessEmailListTokens,
+                                &BusinessEmailListPref,
+                                lboBusinessEmail,
+                                (intValueSeek));
+    frameCEEmail->ShowModal();
+    delete frameCEEmail;
+    frameCEEmail = NULL;
+}
+
+void frmContactEditor::ModifyBusinessEmail( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessEmail,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
+    frameCEEmail->SetupPointers(&BusinessEmailList,
+                                &BusinessEmailListAltID,
+                                &BusinessEmailListPID,
+                                &BusinessEmailListType,
+                                &BusinessEmailListTokens,
+                                &BusinessEmailListPref,
+                                lboBusinessEmail,
+                                intSelectedData);
+    frameCEEmail->SetEditorMode(TRUE, CE_WORK);
+    frameCEEmail->ShowModal();
+    delete frameCEEmail;
+    frameCEEmail = NULL;
+}
+
+void frmContactEditor::DeleteBusinessEmail( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessEmail,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessEmail->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessEmailList,
+                  &BusinessEmailListAltID, &BusinessEmailListPID,
+                  &BusinessEmailListType, &BusinessEmailListTokens,
+                  &BusinessEmailListPref);
+    
+}
+
+void frmContactEditor::AddBusinessIM( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
+    frameCEIM->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessIMList);
+    frameCEIM->SetupPointers(&BusinessIMList,
+                             &BusinessIMListAltID,
+                             &BusinessIMListPID,
+                             &BusinessIMListType,
+                             &BusinessIMListTokens,
+                             &BusinessIMListMediatype,
+                             &BusinessIMListPref,
+                             lboBusinessIM,
+                             (intValueSeek));
+    frameCEIM->ShowModal();
+    delete frameCEIM;
+    frameCEIM = NULL;
+}
+
+void frmContactEditor::ModifyBusinessIM( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessIM,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
+    frameCEIM->SetupPointers(&BusinessIMList,
+                             &BusinessIMListAltID,
+                             &BusinessIMListPID,
+                             &BusinessIMListType,
+                             &BusinessIMListTokens,
+                             &BusinessIMListMediatype,
+                             &BusinessIMListPref,
+                             lboBusinessIM,
+                             intSelectedData);
+    frameCEIM->SetEditorMode(TRUE, CE_WORK);
+    frameCEIM->ShowModal();
+    delete frameCEIM;
+    frameCEIM = NULL;
+}
+
+void frmContactEditor::DeleteBusinessIM( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessIM,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessIM->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessIMList,
+                  &BusinessIMListAltID, &BusinessIMListPID,
+                  &BusinessIMListType, &BusinessIMListTokens,
+                  &BusinessIMListMediatype, &BusinessIMListPref);
+    
+}
+
+void frmContactEditor::AddBusinessTelephone( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
+    frameCETel->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessTelephoneList);
+    frameCETel->SetupPointers(&BusinessTelephoneList,
+                              &BusinessTelephoneListAltID,
+                              &BusinessTelephoneListPID,
+                              &BusinessTelephoneListType,
+                              &BusinessTelephoneListTokens,
+                              &BusinessTelephoneListPref,
+                              lboBusinessTelephone,
+                              (intValueSeek));
+    frameCETel->ShowModal();
+    delete frameCETel;
+    frameCETel = NULL;
+}
+
+void frmContactEditor::ModifyBusinessTelephone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessTelephone,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
+    frameCETel->SetupPointers(&BusinessTelephoneList,
+                              &BusinessTelephoneListAltID,
+                              &BusinessTelephoneListPID,
+                              &BusinessTelephoneListType,
+                              &BusinessTelephoneListTokens,
+                              &BusinessTelephoneListPref,
+                              lboBusinessTelephone,
+                              intSelectedData);
+    frameCETel->SetEditorMode(TRUE, CE_WORK);
+    frameCETel->ShowModal();
+    delete frameCETel;
+    frameCETel = NULL;
+}
+
+void frmContactEditor::DeleteBusinessTelephone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessTelephone,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessTelephone->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessTelephoneList,
+                  &BusinessTelephoneListAltID, &BusinessTelephoneListPID,
+                  &BusinessTelephoneListType, &BusinessTelephoneListTokens,
+                  &BusinessTelephoneListPref);
+    
+}
+
+void frmContactEditor::AddBusinessLanguage( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
+    frameCELang->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessLanguageList);
+    frameCELang->SetupPointers(&BusinessLanguageList,
+                               &BusinessLanguageListAltID,
+                               &BusinessLanguageListPID,
+                               &BusinessLanguageListType,
+                               &BusinessLanguageListTokens,
+                               &BusinessLanguageListPref,
+                               lboBusinessLanguages,
+                               (intValueSeek));
+    frameCELang->ShowModal();
+    delete frameCELang;
+    frameCELang = NULL;
+}
+
+void frmContactEditor::ModifyBusinessLanguage( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessLanguages,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
+    frameCELang->SetupPointers(&BusinessLanguageList,
+                               &BusinessLanguageListAltID,
+                               &BusinessLanguageListPID,
+                               &BusinessLanguageListType,
+                               &BusinessLanguageListTokens,
+                               &BusinessLanguageListPref,
+                               lboBusinessLanguages,
+                               intSelectedData);
+    frameCELang->SetEditorMode(TRUE, CE_WORK);
+    frameCELang->ShowModal();
+    delete frameCELang;
+    frameCELang = NULL;
+}
+
+void frmContactEditor::DeleteBusinessLanguage( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessLanguages,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessLanguages->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessLanguageList,
+                  &BusinessLanguageListAltID, &BusinessLanguageListPID,
+                  &BusinessLanguageListType, &BusinessLanguageListTokens,
+                  &BusinessLanguageListPref);
+    
+}
+
+void frmContactEditor::AddBusinessTimezone( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
+    frameCETZ->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessTZList);
+    frameCETZ->SetupPointers(&BusinessTZList,
+                             &BusinessTZListAltID,
+                             &BusinessTZListPID,
+                             &BusinessTZListType,
+                             &BusinessTZListTokens,
+                             &BusinessTZListMediatype,
+                             &BusinessTZListPref,
+                             lboBusinessTimezones,
+                             (intValueSeek));
+    frameCETZ->ShowModal();
+    delete frameCETZ;
+    frameCETZ = NULL;
+}
+
+void frmContactEditor::ModifyBusinessTimezone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessTimezones,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
+    frameCETZ->SetupPointers(&BusinessTZList,
+                             &BusinessTZListAltID,
+                             &BusinessTZListPID,
+                             &BusinessTZListType,
+                             &BusinessTZListTokens,
+                             &BusinessTZListMediatype,
+                             &BusinessTZListPref,
+                             lboBusinessTimezones,
+                             intSelectedData);
+    frameCETZ->SetEditorMode(TRUE, CE_WORK);
+    frameCETZ->ShowModal();
+    delete frameCETZ;
+    frameCETZ = NULL;
+}
+
+void frmContactEditor::DeleteBusinessTimezone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessTimezones,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessTimezones->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessTZList,
+                  &BusinessTZListAltID, &BusinessTZListPID,
+                  &BusinessTZListType, &BusinessTZListTokens,
+                  &BusinessTZListMediatype, &BusinessTZListPref);
+    
+}
+
+void frmContactEditor::AddBusinessGeoposition( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
+    frameCEGeo->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessGeographyList);
+    frameCEGeo->SetupPointers(&BusinessGeographyList,
+                              &BusinessGeographyListAltID,
+                              &BusinessGeographyListPID,
+                              &BusinessGeographyListType,
+                              &BusinessGeographyListTokens,
+                              &BusinessGeographyListMediatype,
+                              &BusinessGeographyListPref,
+                              lboBusinessGeoposition,
+                              (intValueSeek));
+    frameCEGeo->ShowModal();
+    delete frameCEGeo;
+    frameCEGeo = NULL;
+}
+
+void frmContactEditor::ModifyBusinessGeoposition( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessGeoposition,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
+    frameCEGeo->SetupPointers(&BusinessGeographyList,
+                              &BusinessGeographyListAltID,
+                              &BusinessGeographyListPID,
+                              &BusinessGeographyListType,
+                              &BusinessGeographyListTokens,
+                              &BusinessGeographyListMediatype,
+                              &BusinessGeographyListPref,
+                              lboBusinessGeoposition,
+                              intSelectedData);
+    frameCEGeo->SetEditorMode(TRUE, CE_WORK);
+    frameCEGeo->ShowModal();
+    delete frameCEGeo;
+    frameCEGeo = NULL;
+}
+
+void frmContactEditor::DeleteBusinessGeoposition( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessGeoposition,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessGeoposition->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessGeographyList,
+                  &BusinessGeographyListAltID, &BusinessGeographyListPID,
+                  &BusinessGeographyListType, &BusinessGeographyListTokens,
+                  &BusinessGeographyListMediatype, &BusinessGeographyListPref);
+    
+}
+
+void frmContactEditor::AddBusinessWebsite( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
+    frameCEWeb->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessWebsiteList);
+    frameCEWeb->SetupPointers(&BusinessWebsiteList,
+                              &BusinessWebsiteListAltID,
+                              &BusinessWebsiteListPID,
+                              &BusinessWebsiteListType,
+                              &BusinessWebsiteListTokens,
+                              &BusinessWebsiteListMediatype,
+                              &BusinessWebsiteListPref,
+                              lboBusinessWebsites,
+                              (intValueSeek));
+    frameCEWeb->ShowModal();
+    delete frameCEWeb;
+    frameCEWeb = NULL;
+}
+
+void frmContactEditor::ModifyBusinessWebsite( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessWebsites,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
+    frameCEWeb->SetupPointers(&BusinessWebsiteList,
+                              &BusinessWebsiteListAltID,
+                              &BusinessWebsiteListPID,
+                              &BusinessWebsiteListType,
+                              &BusinessWebsiteListTokens,
+                              &BusinessWebsiteListMediatype,
+                              &BusinessWebsiteListPref,
+                              lboBusinessWebsites,
+                              intSelectedData);
+    frameCEWeb->SetEditorMode(TRUE, CE_WORK);
+    frameCEWeb->ShowModal();
+    delete frameCEWeb;
+    frameCEWeb = NULL;
+}
+
+void frmContactEditor::DeleteBusinessWebsite( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessWebsites,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessWebsites->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessWebsiteList,
+                  &BusinessWebsiteListAltID, &BusinessWebsiteListPID,
+                  &BusinessWebsiteListType, &BusinessWebsiteListTokens,
+                  &BusinessWebsiteListMediatype, &BusinessWebsiteListPref);
+    
+}
+
+void frmContactEditor::AddBusinessTitle( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
+    frameCETitle->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessTitleList);
+    frameCETitle->SetupPointers(&BusinessTitleList,
+                                &BusinessTitleListLanguage,
+                                &BusinessTitleListAltID,
+                                &BusinessTitleListPID,
+                                &BusinessTitleListType,
+                                &BusinessTitleListTokens,
+                                &BusinessTitleListPref,
+                                lboBusinessTitles,
+                                (intValueSeek));
+    frameCETitle->ShowModal();
+    delete frameCETitle;
+    frameCETitle = NULL;
+}
+
+void frmContactEditor::ModifyBusinessTitle( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessTitles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
+    frameCETitle->SetupPointers(&BusinessTitleList,
+                                &BusinessTitleListLanguage,
+                                &BusinessTitleListAltID,
+                                &BusinessTitleListPID,
+                                &BusinessTitleListType,
+                                &BusinessTitleListTokens,
+                                &BusinessTitleListPref,
+                                lboBusinessTitles,
+                                intSelectedData);
+    frameCETitle->SetEditorMode(TRUE, CE_WORK);
+    frameCETitle->ShowModal();
+    delete frameCETitle;
+    frameCETitle = NULL;
+}
+
+void frmContactEditor::DeleteBusinessTitle( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessTitles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboTitles->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessTitleList,
+                  &BusinessTitleListLanguage, &BusinessTitleListAltID,
+                  &BusinessTitleListPID, &BusinessTitleListType,
+                  &BusinessTitleListTokens, &BusinessTitleListPref);
+    
+}
+
+void frmContactEditor::AddBusinessRole( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
+    frameCERole->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessRoleList);
+    frameCERole->SetupPointers(&BusinessRoleList,
+                               &BusinessRoleListLanguage,
+                               &BusinessRoleListAltID,
+                               &BusinessRoleListPID,
+                               &BusinessRoleListType,
+                               &BusinessRoleListTokens,
+                               &BusinessRoleListPref,
+                               lboBusinessRoles,
+                               (intValueSeek));
+    frameCERole->ShowModal();
+    delete frameCERole;
+    frameCERole = NULL;
+}
+
+void frmContactEditor::ModifyBusinessRole( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessRoles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
+    frameCERole->SetupPointers(&BusinessRoleList,
+                               &BusinessRoleListLanguage,
+                               &BusinessRoleListAltID,
+                               &BusinessRoleListPID,
+                               &BusinessRoleListType,
+                               &BusinessRoleListTokens,
+                               &BusinessRoleListPref,
+                               lboBusinessRoles,
+                               intSelectedData);
+    frameCERole->SetEditorMode(TRUE, CE_WORK);
+    frameCERole->ShowModal();
+    delete frameCERole;
+    frameCERole = NULL;
+}
+
+void frmContactEditor::DeleteBusinessRole( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessRoles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessRoles->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessRoleList,
+                  &BusinessRoleListLanguage, &BusinessRoleListAltID,
+                  &BusinessRoleListPID, &BusinessRoleListType,
+                  &BusinessRoleListTokens, &BusinessRoleListPref);
+    
+}
+
+void frmContactEditor::AddBusinessOrganisation( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
+    frameCEOrg->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&GeneralOrganisationsList);
+    frameCEOrg->SetupPointers(&GeneralOrganisationsList,
+                              &BusinessOrganisationsListLanguage,
+                              &BusinessOrganisationsListSortAs,
+                              &BusinessOrganisationsListAltID,
+                              &BusinessOrganisationsListPID,
+                              &BusinessOrganisationsListType,
+                              &BusinessOrganisationsListTokens,
+                              &BusinessOrganisationsListPref,
+                              lboBusinessOrganisations,
+                              (intValueSeek));
+    frameCEOrg->ShowModal();
+    delete frameCEOrg;
+    frameCEOrg = NULL;
+}
+
+void frmContactEditor::ModifyBusinessOrganisation( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessOrganisations,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
+    frameCEOrg->SetupPointers(&BusinessOrganisationsList,
+                              &BusinessOrganisationsListLanguage,
+                              &BusinessOrganisationsListSortAs,
+                              &BusinessOrganisationsListAltID,
+                              &BusinessOrganisationsListPID,
+                              &BusinessOrganisationsListType,
+                              &BusinessOrganisationsListTokens,
+                              &BusinessOrganisationsListPref,
+                              lboBusinessOrganisations,
+                              intSelectedData);
+    frameCEOrg->SetEditorMode(TRUE, CE_WORK);
+    frameCEOrg->ShowModal();
+    delete frameCEOrg;
+    frameCEOrg = NULL;
+}
+
+void frmContactEditor::DeleteBusinessOrganisation( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessOrganisations,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessOrganisations->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessOrganisationsList,
+                  &BusinessOrganisationsListLanguage, &BusinessOrganisationsListSortAs,
+                  &BusinessOrganisationsListAltID, &BusinessOrganisationsListPID,
+                  &BusinessOrganisationsListType, &BusinessOrganisationsListTokens,
+                  &BusinessOrganisationsListPref);
+    
+}
+
+void frmContactEditor::AddBusinessNote( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
+    frameCENote->SetEditorMode(FALSE, CE_WORK);
+    intResult = GetLastInt(&BusinessNoteList);
+    frameCENote->SetupPointers(&BusinessNoteList,
+                               &BusinessNoteListLanguage,
+                               &BusinessNoteListAltID,
+                               &BusinessNoteListPID,
+                               &BusinessNoteListType,
+                               &BusinessNoteListTokens,
+                               &BusinessNoteListPref,
+                               lboBusinessNotes,
+                               (intValueSeek));
+    frameCENote->ShowModal();
+    delete frameCENote;
+    frameCENote = NULL;
+}
+
+void frmContactEditor::ModifyBusinessNote( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessNotes,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
+    frameCENote->SetupPointers(&BusinessNoteList,
+                               &BusinessNoteListLanguage,
+                               &BusinessNoteListAltID,
+                               &BusinessNoteListPID,
+                               &BusinessNoteListType,
+                               &BusinessNoteListTokens,
+                               &BusinessNoteListPref,
+                               lboBusinessNotes,
+                               intSelectedData);
+    frameCENote->SetEditorMode(TRUE, CE_WORK);
+    frameCENote->ShowModal();
+    delete frameCENote;
+    frameCENote = NULL;
+}
+
+void frmContactEditor::DeleteBusinessNote( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboBusinessNotes,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboBusinessNotes->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &BusinessNoteList,
+                  &BusinessNoteListLanguage, &BusinessNoteListAltID,
+                  &BusinessNoteListPID, &BusinessNoteListType,
+                  &BusinessNoteListTokens, &BusinessNoteListPref);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Calendar.cpp b/source/contacteditor/frmContactEditor-Calendar.cpp
new file mode 100644 (file)
index 0000000..def234c
--- /dev/null
@@ -0,0 +1,197 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorCalAdr.h"
+
+void frmContactEditor::AddCalendarAddress( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
+    frameCECalAdr->SetEditorMode(FALSE);
+    intResult = GetLastInt(&CalendarList);
+    frameCECalAdr->SetupPointers(&CalendarList,
+                                 &CalendarListAltID,
+                                 &CalendarListPID,
+                                 &CalendarListType,
+                                 &CalendarListTokens,
+                                 &CalendarListPref,
+                                 lboCalendarAddresses,
+                                 (intValueSeek));
+    frameCECalAdr->ShowModal();
+    delete frameCECalAdr;
+    frameCECalAdr = NULL;
+}
+
+void frmContactEditor::ModifyCalendarAddress( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboCalendarAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
+    frameCECalAdr->SetupPointers(&CalendarList,
+                                 &CalendarListAltID,
+                                 &CalendarListPID,
+                                 &CalendarListType,
+                                 &CalendarListTokens,
+                                 &CalendarListPref,
+                                 lboCalendarAddresses,
+                                 intSelectedData);
+    frameCECalAdr->SetEditorMode(TRUE);
+    frameCECalAdr->ShowModal();
+    delete frameCECalAdr;
+    frameCECalAdr = NULL;
+}
+
+void frmContactEditor::DeleteCalendarAddress( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboCalendarAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboCalendarAddresses->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &CalendarList, &CalendarListAltID,
+                  &CalendarListPID, &CalendarListType, &CalendarListTokens,
+                  &CalendarListPref);
+    
+}
+
+void frmContactEditor::AddCalendarRequest( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
+    frameCECalAdr->SetEditorMode(FALSE);
+    intResult = GetLastInt(&CalendarRequestList);
+    frameCECalAdr->SetupPointers(&CalendarRequestList,
+                                 &CalendarRequestListAltID,
+                                 &CalendarRequestListPID,
+                                 &CalendarRequestListType,
+                                 &CalendarRequestListTokens,
+                                 &CalendarRequestListPref,
+                                 lboCalendarRequestAddress,
+                                 (intValueSeek));
+    frameCECalAdr->ShowModal();
+    delete frameCECalAdr;
+    frameCECalAdr = NULL;
+}
+
+void frmContactEditor::ModifyCalendarRequest( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboCalendarRequestAddress,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
+    frameCECalAdr->SetupPointers(&CalendarList,
+                                 &CalendarRequestListAltID,
+                                 &CalendarRequestListPID,
+                                 &CalendarRequestListType,
+                                 &CalendarRequestListTokens,
+                                 &CalendarRequestListPref,
+                                 lboCalendarRequestAddress,
+                                 intSelectedData);
+    frameCECalAdr->SetEditorMode(TRUE);
+    frameCECalAdr->ShowModal();
+    delete frameCECalAdr;
+    frameCECalAdr = NULL;
+}
+
+void frmContactEditor::DeleteCalendarRequest( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboCalendarRequestAddress,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboCalendarRequestAddress->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &CalendarRequestList,
+                  &CalendarRequestListAltID, &CalendarRequestListPID,
+                  &CalendarRequestListType, &CalendarRequestListTokens,
+                  &CalendarRequestListPref);
+}
+
+void frmContactEditor::AddFreeBusy( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
+    frameCECalAdr->SetEditorMode(FALSE);
+    intResult = GetLastInt(&FreeBusyList);
+    frameCECalAdr->SetupPointers(&FreeBusyList,
+                                 &FreeBusyListAltID,
+                                 &FreeBusyListPID,
+                                 &FreeBusyListType,
+                                 &FreeBusyListTokens,
+                                 &FreeBusyListPref,
+                                 lboFreeBusyAddresses,
+                                 (intValueSeek));
+    frameCECalAdr->ShowModal();
+    delete frameCECalAdr;
+    frameCECalAdr = NULL;
+}
+
+void frmContactEditor::ModifyFreeBusy( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboFreeBusyAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
+    frameCECalAdr->SetupPointers(&FreeBusyList,
+                                 &FreeBusyListAltID,
+                                 &FreeBusyListPID,
+                                 &FreeBusyListType,
+                                 &FreeBusyListTokens,
+                                 &FreeBusyListPref,
+                                 lboFreeBusyAddresses,
+                                 intSelectedData);
+    frameCECalAdr->SetEditorMode(TRUE);
+    frameCECalAdr->ShowModal();
+    delete frameCECalAdr;
+    frameCECalAdr = NULL;
+}
+
+void frmContactEditor::DeleteFreeBusy( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboFreeBusyAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboFreeBusyAddresses->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &FreeBusyList, &FreeBusyListAltID,
+                  &FreeBusyListPID, &FreeBusyListType, &FreeBusyListTokens,
+                  &FreeBusyListPref);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Category.cpp b/source/contacteditor/frmContactEditor-Category.cpp
new file mode 100644 (file)
index 0000000..88e9c85
--- /dev/null
@@ -0,0 +1,68 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorCategory.h"
+
+void frmContactEditor::AddCategory( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
+    frameCECategory->SetEditorMode(FALSE);
+    intResult = GetLastInt(&CategoriesList);
+    frameCECategory->SetupPointers(&CategoriesList,
+                                   &CategoriesListAltID,
+                                   &CategoriesListPID,
+                                   &CategoriesListType,
+                                   &CategoriesListTokens,
+                                   &CategoriesListPref,
+                                   lboCategories,
+                                   (intValueSeek));
+    frameCECategory->ShowModal();
+    delete frameCECategory;
+    frameCECategory = NULL;
+}
+
+void frmContactEditor::ModifyCategory( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboCategories,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
+    frameCECategory->SetupPointers(&CategoriesList,
+                                   &CategoriesListAltID,
+                                   &CategoriesListPID,
+                                   &CategoriesListType,
+                                   &CategoriesListTokens,
+                                   &CategoriesListPref,
+                                   lboCategories,
+                                   intSelectedData);
+    frameCECategory->SetEditorMode(TRUE);
+    frameCECategory->ShowModal();
+    delete frameCECategory;
+    frameCECategory = NULL;
+}
+
+void frmContactEditor::DeleteCategory( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboCategories,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboCategories->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &CategoriesList,
+                  &CategoriesListAltID, &CategoriesListPID,
+                  &CategoriesListType, &CategoriesListTokens,
+                  &CategoriesListPref);
+    
+}
\ No newline at end of file
diff --git a/source/contacteditor/frmContactEditor-Events.cpp b/source/contacteditor/frmContactEditor-Events.cpp
new file mode 100644 (file)
index 0000000..39eca49
--- /dev/null
@@ -0,0 +1,91 @@
+#include "frmContactEditor.h"
+
+bool frmContactEditor::ProcessEvent(wxEvent& event)
+{
+    
+    // This section has been taken from the wxWidgets sample code of richtext.cpp
+    // so that simple Cut/Copy/Paste code can be made.
+    
+    // As this code comes from the samples of the wxWidgets library, this is licenced
+    // under the wxWindows Library Licence and is compatable with the LGPL and is
+    // compatable with Xestia Address Book's licence.
+    
+    if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
+    {
+        // Problem: we can get infinite recursion because the events
+        // climb back up to this frame, and repeat.
+        // Assume that command events don't cause another command event
+        // to be called, so we can rely on inCommand not being overwritten
+        
+        static int s_eventType = 0;
+        static wxWindowID s_id = 0;
+        
+        if (s_id != event.GetId() && s_eventType != event.GetEventType())
+        {
+            s_eventType = event.GetEventType();
+            s_id = event.GetId();
+            
+            wxWindow* focusWin = wxFindFocusDescendant(this);
+            if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
+            {
+                //s_command = NULL;
+                s_eventType = 0;
+                s_id = 0;
+                return true;
+            }
+            s_eventType = 0;
+            s_id = 0;
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    return wxFrame::ProcessEvent(event);
+}
+
+void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
+    
+    // Generate a drop down list of common names to use for the display as drop down box.
+    
+    wxString SetValue = cmbDisplayAs->GetValue();
+    
+    cmbDisplayAs->Clear();
+    cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
+    if (!txtOtherNames->GetValue().IsEmpty()){
+        
+        cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());    
+        
+    }
+    cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue());        
+    if (!txtOtherNames->GetValue().IsEmpty()){
+        
+        cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
+        
+    }
+    if (!txtTitle->GetValue().IsEmpty()){
+        cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
+    }
+    
+    cmbDisplayAs->SetValue(SetValue);
+    
+    this->SetTitle(cmbDisplayAs->GetValue());
+    
+}
+
+void frmContactEditor::UpdateName( wxCommandEvent &event ){
+    
+    this->SetTitle(cmbDisplayAs->GetValue());
+    
+    WindowData *WData = new WindowData;
+    
+    WData->DataType = 1;
+    WData->WindowPointer = this;
+    WData->WindowID = ContactEditorUID;
+    
+    wxCommandEvent editevent(WINDOW_EDIT);
+    editevent.SetClientData(WData);
+    wxPostEvent(GetParent(), editevent);
+    
+}
\ No newline at end of file
diff --git a/source/contacteditor/frmContactEditor-General.cpp b/source/contacteditor/frmContactEditor-General.cpp
new file mode 100644 (file)
index 0000000..eb30a3e
--- /dev/null
@@ -0,0 +1,1003 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorNickname.h"
+#include "frmContactEditorAddress.h"
+#include "frmContactEditorEmail.h"
+#include "frmContactEditorIM.h"
+#include "frmContactEditorTelephone.h"
+#include "frmContactEditorLanguages.h"
+#include "frmContactEditorTimezones.h"
+#include "frmContactEditorRelated.h"
+#include "frmContactEditorWebsites.h"
+#include "frmContactEditorTitles.h"
+#include "frmContactEditorRoles.h"
+#include "frmContactEditorGeoposition.h"
+#include "frmContactEditorGroups.h"
+#include "frmContactEditorOrganisations.h"
+#include "frmContactEditorNotes.h"
+
+void frmContactEditor::AddGeneralNickname( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
+    frameCENickname->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralNicknamesList);
+    frameCENickname->SetupPointers(&GeneralNicknamesList,
+                                   &GeneralNicknamesListAltID,
+                                   &GeneralNicknamesListPID,
+                                   &GeneralNicknamesListType,
+                                   &GeneralNicknamesListLanguage,
+                                   &GeneralNicknamesListTokens,
+                                   &GeneralNicknamesListPref,
+                                   lboNicknames,
+                                   (intValueSeek));
+    frameCENickname->ShowModal();
+    delete frameCENickname;
+    frameCENickname = NULL;
+}
+
+void frmContactEditor::ModifyGeneralNickname( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboNicknames,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
+    frameCENickname->SetupPointers(&GeneralNicknamesList,
+                                   &GeneralNicknamesListAltID,
+                                   &GeneralNicknamesListPID,
+                                   &GeneralNicknamesListType,
+                                   &GeneralNicknamesListLanguage,
+                                   &GeneralNicknamesListTokens,
+                                   &GeneralNicknamesListPref,
+                                   lboNicknames,
+                                   intSelectedData);
+    frameCENickname->SetEditorMode(TRUE, CE_GENERAL);
+    frameCENickname->ShowModal();
+    delete frameCENickname;
+    frameCENickname = NULL;
+    
+}
+
+void frmContactEditor::DeleteGeneralNickname( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboNicknames,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboNicknames->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData,
+                  &GeneralNicknamesList,
+                  &GeneralNicknamesListLanguage,
+                  &GeneralNicknamesListAltID,
+                  &GeneralNicknamesListPID,
+                  &GeneralNicknamesListTokens,
+                  &GeneralNicknamesListType,
+                  &GeneralNicknamesListPref);
+    
+}
+
+void frmContactEditor::AddGeneralAddress( wxCommandEvent& event )
+{
+    
+    int intResult = 0;
+    
+    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+    frameCEAddress->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralAddressList);
+    frameCEAddress->SetupPointers(&GeneralAddressList,
+                                  &GeneralAddressListTown,
+                                  &GeneralAddressListCounty,
+                                  &GeneralAddressListPostCode,
+                                  &GeneralAddressListCountry,
+                                  &GeneralAddressListLabel,
+                                  &GeneralAddressListLang,
+                                  &GeneralAddressListAltID,
+                                  &GeneralAddressListPID,
+                                  &GeneralAddressListTokens,
+                                  &GeneralAddressListGeo,
+                                  &GeneralAddressListTimezone,
+                                  &GeneralAddressListType,
+                                  &GeneralAddressListMediatype,
+                                  &GeneralAddressListPref,
+                                  lboAddresses,
+                                  (intValueSeek));
+    frameCEAddress->ShowModal();
+    delete frameCEAddress;
+    frameCEAddress = NULL;
+}
+
+void frmContactEditor::ModifyGeneralAddress( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    if (longSelected == -1){
+        return;
+    }
+    
+    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+    frameCEAddress->SetupPointers(&GeneralAddressList,
+                                  &GeneralAddressListTown,
+                                  &GeneralAddressListCounty,
+                                  &GeneralAddressListPostCode,
+                                  &GeneralAddressListCountry,
+                                  &GeneralAddressListLabel,
+                                  &GeneralAddressListLang,
+                                  &GeneralAddressListAltID,
+                                  &GeneralAddressListPID,
+                                  &GeneralAddressListTokens,
+                                  &GeneralAddressListGeo,
+                                  &GeneralAddressListTimezone,
+                                  &GeneralAddressListType,
+                                  &GeneralAddressListMediatype,
+                                  &GeneralAddressListPref,
+                                  lboAddresses,
+                                  intSelectedData);
+    frameCEAddress->SetEditorMode(TRUE, CE_GENERAL);
+    frameCEAddress->ShowModal();
+    delete frameCEAddress;
+    frameCEAddress = NULL;
+    
+}
+
+void frmContactEditor::DeleteGeneralAddress( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboAddresses->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralAddressList,
+                  &GeneralAddressListTown, &GeneralAddressListCounty,
+                  &GeneralAddressListPostCode, &GeneralAddressListCountry,
+                  &GeneralAddressList, &GeneralAddressListLabel,
+                  &GeneralAddressListLang, &GeneralAddressListAltID,
+                  &GeneralAddressListPID, &GeneralAddressListTokens,
+                  &GeneralAddressListGeo, &GeneralAddressListTimezone,
+                  &GeneralAddressListType, &GeneralAddressListMediatype,
+                  &GeneralAddressListPref);
+    
+}
+
+void frmContactEditor::AddGeneralEmail( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
+    frameCEEmail->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralAddressList);
+    frameCEEmail->SetupPointers(&GeneralEmailList,
+                                &GeneralEmailListAltID,
+                                &GeneralEmailListPID,
+                                &GeneralEmailListType,
+                                &GeneralEmailListTokens,
+                                &GeneralEmailListPref,
+                                lboEmails,
+                                (intValueSeek));
+    frameCEEmail->ShowModal();
+    delete frameCEEmail;
+    frameCEEmail = NULL;
+}
+
+void frmContactEditor::ModifyGeneralEmail( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboEmails,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
+    frameCEEmail->SetupPointers(&GeneralEmailList,
+                                &GeneralEmailListAltID,
+                                &GeneralEmailListPID,
+                                &GeneralEmailListType,
+                                &GeneralEmailListTokens,
+                                &GeneralEmailListPref,
+                                lboEmails,
+                                intSelectedData);
+    frameCEEmail->SetEditorMode(TRUE, CE_GENERAL);
+    frameCEEmail->ShowModal();
+    delete frameCEEmail;
+    frameCEEmail = NULL;
+}
+
+void frmContactEditor::DeleteGeneralEmail( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboEmails,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboEmails->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralEmailList,
+                  &GeneralEmailListAltID, &GeneralEmailListPID,
+                  &GeneralEmailListType, &GeneralEmailListTokens,
+                  &GeneralEmailListPref);
+    
+}
+
+void frmContactEditor::AddGeneralIM( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
+    frameCEIM->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralIMList);
+    frameCEIM->SetupPointers(&GeneralIMList,
+                             &GeneralIMListAltID,
+                             &GeneralIMListPID,
+                             &GeneralIMListType,
+                             &GeneralIMListTokens,
+                             &GeneralIMListMediatype,
+                             &GeneralIMListPref,
+                             lboIM,
+                             (intValueSeek));
+    frameCEIM->ShowModal();
+    delete frameCEIM;
+    frameCEIM = NULL;
+}
+
+void frmContactEditor::ModifyGeneralIM( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboIM,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
+    frameCEIM->SetupPointers(&GeneralIMList,
+                             &GeneralIMListAltID,
+                             &GeneralIMListPID,
+                             &GeneralIMListType,
+                             &GeneralIMListTokens,
+                             &GeneralIMListMediatype,
+                             &GeneralIMListPref,
+                             lboIM,
+                             intSelectedData);
+    frameCEIM->SetEditorMode(TRUE, CE_GENERAL);
+    frameCEIM->ShowModal();
+    delete frameCEIM;
+    frameCEIM = NULL;
+}
+
+void frmContactEditor::DeleteGeneralIM( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboIM,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboIM->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralIMList,
+                  &GeneralIMListAltID, &GeneralIMListPID,
+                  &GeneralIMListType, &GeneralIMListTokens,
+                  &GeneralIMListMediatype, &GeneralIMListPref);
+    
+}
+
+void frmContactEditor::AddGeneralTelephone( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
+    frameCETel->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralTelephoneList);
+    frameCETel->SetupPointers(&GeneralTelephoneList,
+                              &GeneralTelephoneListAltID,
+                              &GeneralTelephoneListPID,
+                              &GeneralTelephoneListType,
+                              &GeneralTelephoneListTokens,
+                              &GeneralTelephoneListPref,
+                              lboTelephone,
+                              (intValueSeek));
+    frameCETel->ShowModal();
+    delete frameCETel;
+    frameCETel = NULL;
+}
+
+void frmContactEditor::ModifyGeneralTelephone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboTelephone,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
+    frameCETel->SetupPointers(&GeneralTelephoneList,
+                              &GeneralTelephoneListAltID,
+                              &GeneralTelephoneListPID,
+                              &GeneralTelephoneListType,
+                              &GeneralTelephoneListTokens,
+                              &GeneralTelephoneListPref,
+                              lboTelephone,
+                              intSelectedData);
+    frameCETel->SetEditorMode(TRUE, CE_GENERAL);
+    frameCETel->ShowModal();
+    delete frameCETel;
+    frameCETel = NULL;
+}
+
+void frmContactEditor::DeleteGeneralTelephone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboTelephone,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboTelephone->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralTelephoneList,
+                  &GeneralTelephoneListAltID, &GeneralTelephoneListPID,
+                  &GeneralTelephoneListType, &GeneralTelephoneListTokens,
+                  &GeneralTelephoneListPref);
+    
+}
+
+void frmContactEditor::AddGeneralLanguages( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
+    frameCELang->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralLanguageList);
+    frameCELang->SetupPointers(&GeneralLanguageList,
+                               &GeneralLanguageListAltID,
+                               &GeneralLanguageListPID,
+                               &GeneralLanguageListType,
+                               &GeneralLanguageListTokens,
+                               &GeneralLanguageListPref,
+                               lboLanguages,
+                               (intValueSeek));
+    frameCELang->ShowModal();
+    delete frameCELang;
+    frameCELang = NULL;
+}
+
+void frmContactEditor::ModifyGeneralLanguages( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboLanguages,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
+    frameCELang->SetupPointers(&GeneralLanguageList,
+                               &GeneralLanguageListAltID,
+                               &GeneralLanguageListPID,
+                               &GeneralLanguageListType,
+                               &GeneralLanguageListTokens,
+                               &GeneralLanguageListPref,
+                               lboLanguages,
+                               intSelectedData);
+    frameCELang->SetEditorMode(TRUE, CE_GENERAL);
+    frameCELang->ShowModal();
+    delete frameCELang;
+    frameCELang = NULL;
+}
+
+void frmContactEditor::DeleteGeneralLanguage( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboLanguages,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboLanguages->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralLanguageList,
+                  &GeneralLanguageListAltID, &GeneralLanguageListPID,
+                  &GeneralLanguageListType, &GeneralLanguageListTokens,
+                  &GeneralLanguageListPref);
+    
+}
+
+void frmContactEditor::AddGeneralTimezone( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
+    frameCETZ->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralTZList);
+    frameCETZ->SetupPointers(&GeneralTZList,
+                             &GeneralTZListAltID,
+                             &GeneralTZListPID,
+                             &GeneralTZListType,
+                             &GeneralTZListTokens,
+                             &GeneralTZListMediatype,
+                             &GeneralTZListPref,
+                             lboTimezones,
+                             (intValueSeek));
+    frameCETZ->ShowModal();
+    delete frameCETZ;
+    frameCETZ = NULL;
+}
+
+void frmContactEditor::ModifyGeneralTimezone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboTimezones,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
+    frameCETZ->SetupPointers(&GeneralTZList,
+                             &GeneralTZListAltID,
+                             &GeneralTZListPID,
+                             &GeneralTZListType,
+                             &GeneralTZListTokens,
+                             &GeneralTZListMediatype,
+                             &GeneralTZListPref,
+                             lboTimezones,
+                             intSelectedData);
+    frameCETZ->SetEditorMode(TRUE, CE_GENERAL);
+    frameCETZ->ShowModal();
+    delete frameCETZ;
+    frameCETZ = NULL;
+}
+
+void frmContactEditor::DeleteGeneralTimezone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboTimezones,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboTimezones->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralTZList,
+                  &GeneralTZListAltID, &GeneralTZListPID,
+                  &GeneralTZListType, &GeneralTZListTokens,
+                  &GeneralTZListMediatype, &GeneralTZListPref);
+    
+}
+
+void frmContactEditor::AddGeneralGeoposition( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
+    frameCEGeo->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralGeographyList);
+    frameCEGeo->SetupPointers(&GeneralGeographyList,
+                              &GeneralGeographyListAltID,
+                              &GeneralGeographyListPID,
+                              &GeneralGeographyListType,
+                              &GeneralGeographyListTokens,
+                              &GeneralGeographyListMediatype,
+                              &GeneralGeographyListPref,
+                              lboGeoposition,
+                              (intValueSeek));
+    frameCEGeo->ShowModal();
+    delete frameCEGeo;
+    frameCEGeo = NULL;
+}
+
+void frmContactEditor::ModifyGeneralGeoposition( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboGeoposition,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
+    frameCEGeo->SetupPointers(&GeneralGeographyList,
+                              &GeneralGeographyListAltID,
+                              &GeneralGeographyListPID,
+                              &GeneralGeographyListType,
+                              &GeneralGeographyListTokens,
+                              &GeneralGeographyListMediatype,
+                              &GeneralGeographyListPref,
+                              lboGeoposition,
+                              intSelectedData);
+    frameCEGeo->SetEditorMode(TRUE, CE_GENERAL);
+    frameCEGeo->ShowModal();
+    delete frameCEGeo;
+    frameCEGeo = NULL;
+}
+
+void frmContactEditor::DeleteGeneralGeoposition( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboGeoposition,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboGeoposition->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralGeographyList,
+                  &GeneralGeographyListAltID, &GeneralGeographyListPID,
+                  &GeneralGeographyListType, &GeneralGeographyListTokens,
+                  &GeneralGeographyListMediatype, &GeneralGeographyListPref);
+    
+}
+
+void frmContactEditor::AddGeneralRelated( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorRelated *frameCERel = new frmContactEditorRelated ( this );
+    frameCERel->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralRelatedList);
+    frameCERel->SetupPointers(&GeneralRelatedList,
+                              &GeneralRelatedListRelType,
+                              &GeneralRelatedListAltID,
+                              &GeneralRelatedListPID,
+                              &GeneralRelatedListType,
+                              &GeneralRelatedListTokens,
+                              &GeneralRelatedListPref,
+                              lboRelated,
+                              (intValueSeek));
+    frameCERel->ShowModal();
+    delete frameCERel;
+    frameCERel = NULL;
+}
+
+void frmContactEditor::ModifyGeneralRelated( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboRelated,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorRelated *frameCERel = new frmContactEditorRelated ( this );
+    frameCERel->SetupPointers(&GeneralRelatedList,
+                              &GeneralRelatedListRelType,
+                              &GeneralRelatedListAltID,
+                              &GeneralRelatedListPID,
+                              &GeneralRelatedListType,
+                              &GeneralRelatedListTokens,
+                              &GeneralRelatedListPref,
+                              lboRelated,
+                              intSelectedData);
+    frameCERel->SetEditorMode(TRUE, CE_GENERAL);
+    frameCERel->ShowModal();
+    delete frameCERel;
+    frameCERel = NULL;
+}
+
+void frmContactEditor::DeleteGeneralRelated( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboRelated,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboRelated->DeleteItem(longSelected);
+    
+    GeneralRelatedList.erase(intSelectedData);
+    GeneralRelatedListRelType.erase(intSelectedData);
+    GeneralRelatedListAltID.erase(intSelectedData);
+    GeneralRelatedListPID.erase(intSelectedData);
+    GeneralRelatedListType.erase(intSelectedData);
+    GeneralRelatedListTokens.erase(intSelectedData);
+    GeneralRelatedListPref.erase(intSelectedData);
+}
+
+void frmContactEditor::AddGeneralWebsite( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
+    frameCEWeb->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralWebsiteList);
+    frameCEWeb->SetupPointers(&GeneralWebsiteList,
+                              &GeneralWebsiteListAltID,
+                              &GeneralWebsiteListPID,
+                              &GeneralWebsiteListType,
+                              &GeneralWebsiteListTokens,
+                              &GeneralWebsiteListMediatype,
+                              &GeneralWebsiteListPref,
+                              lboWebsites,
+                              (intValueSeek));
+    frameCEWeb->ShowModal();
+    delete frameCEWeb;
+    frameCEWeb = NULL;
+}
+
+void frmContactEditor::ModifyGeneralWebsite( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboWebsites,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
+    frameCEWeb->SetupPointers(&GeneralWebsiteList,
+                              &GeneralWebsiteListAltID,
+                              &GeneralWebsiteListPID,
+                              &GeneralWebsiteListType,
+                              &GeneralWebsiteListTokens,
+                              &GeneralWebsiteListMediatype,
+                              &GeneralWebsiteListPref,
+                              lboWebsites,
+                              intSelectedData);
+    frameCEWeb->SetEditorMode(TRUE, CE_GENERAL);
+    frameCEWeb->ShowModal();
+    delete frameCEWeb;
+    frameCEWeb = NULL;
+}
+
+void frmContactEditor::DeleteGeneralWebsite( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboWebsites,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboWebsites->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralWebsiteList,
+                  &GeneralWebsiteListAltID, &GeneralWebsiteListPID,
+                  &GeneralWebsiteListType, &GeneralWebsiteListTokens,
+                  &GeneralWebsiteListMediatype, &GeneralWebsiteListPref);
+    
+}
+
+void frmContactEditor::AddGeneralTitle( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
+    frameCETitle->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralTitleList);
+    frameCETitle->SetupPointers(&GeneralTitleList,
+                                &GeneralTitleListLanguage,
+                                &GeneralTitleListAltID,
+                                &GeneralTitleListPID,
+                                &GeneralTitleListType,
+                                &GeneralTitleListTokens,
+                                &GeneralTitleListPref,
+                                lboTitles,
+                                (intValueSeek));
+    frameCETitle->ShowModal();
+    delete frameCETitle;
+    frameCETitle = NULL;
+}
+
+void frmContactEditor::ModifyGeneralTitle( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboTitles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
+    frameCETitle->SetupPointers(&GeneralTitleList,
+                                &GeneralTitleListLanguage,
+                                &GeneralTitleListAltID,
+                                &GeneralTitleListPID,
+                                &GeneralTitleListType,
+                                &GeneralTitleListTokens,
+                                &GeneralTitleListPref,
+                                lboTitles,
+                                intSelectedData);
+    frameCETitle->SetEditorMode(TRUE, CE_GENERAL);
+    frameCETitle->ShowModal();
+    delete frameCETitle;
+    frameCETitle = NULL;
+}
+
+void frmContactEditor::DeleteGeneralTitle( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboTitles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboTitles->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralTitleList,
+                  &GeneralTitleListLanguage, &GeneralTitleListAltID,
+                  &GeneralTitleListPID, &GeneralTitleListType,
+                  &GeneralTitleListTokens, &GeneralTitleListPref);
+    
+}
+
+void frmContactEditor::AddGeneralRole( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
+    frameCERole->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralRoleList);
+    frameCERole->SetupPointers(&GeneralRoleList,
+                               &GeneralRoleListLanguage,
+                               &GeneralRoleListAltID,
+                               &GeneralRoleListPID,
+                               &GeneralRoleListType,
+                               &GeneralRoleListTokens,
+                               &GeneralRoleListPref,
+                               lboRoles,
+                               (intValueSeek));
+    frameCERole->ShowModal();
+    delete frameCERole;
+    frameCERole = NULL;
+}
+
+void frmContactEditor::ModifyGeneralRole( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboRoles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
+    frameCERole->SetupPointers(&GeneralRoleList,
+                               &GeneralRoleListLanguage,
+                               &GeneralRoleListAltID,
+                               &GeneralRoleListPID,
+                               &GeneralRoleListType,
+                               &GeneralRoleListTokens,
+                               &GeneralRoleListPref,
+                               lboRoles,
+                               intSelectedData);
+    frameCERole->SetEditorMode(TRUE, CE_GENERAL);
+    frameCERole->ShowModal();
+    delete frameCERole;
+    frameCERole = NULL;
+}
+
+void frmContactEditor::DeleteGeneralRole( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboRoles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboRoles->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralRoleList,
+                  &GeneralRoleListLanguage, &GeneralRoleListAltID,
+                  &GeneralRoleListPID, &GeneralRoleListType,
+                  &GeneralRoleListTokens, &GeneralRoleListPref);
+    
+}
+
+void frmContactEditor::AddGeneralOrganisation( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
+    frameCEOrg->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralOrganisationsList);
+    frameCEOrg->SetupPointers(&GeneralOrganisationsList,
+                              &GeneralOrganisationsListLanguage,
+                              &GeneralOrganisationsListSortAs,
+                              &GeneralOrganisationsListAltID,
+                              &GeneralOrganisationsListPID,
+                              &GeneralOrganisationsListType,
+                              &GeneralOrganisationsListTokens,
+                              &GeneralOrganisationsListPref,
+                              lboOrganisations,
+                              (intValueSeek));
+    frameCEOrg->ShowModal();
+    delete frameCEOrg;
+    frameCEOrg = NULL;
+}
+
+void frmContactEditor::ModifyGeneralOrganisation( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboOrganisations,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
+    frameCEOrg->SetupPointers(&GeneralOrganisationsList,
+                              &GeneralOrganisationsListLanguage,
+                              &GeneralOrganisationsListSortAs,
+                              &GeneralOrganisationsListAltID,
+                              &GeneralOrganisationsListPID,
+                              &GeneralOrganisationsListType,
+                              &GeneralOrganisationsListTokens,
+                              &GeneralOrganisationsListPref,
+                              lboOrganisations,
+                              intSelectedData);
+    frameCEOrg->SetEditorMode(TRUE, CE_GENERAL);
+    frameCEOrg->ShowModal();
+    delete frameCEOrg;
+    frameCEOrg = NULL;
+}
+
+void frmContactEditor::DeleteGeneralOrganisation( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboOrganisations,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboOrganisations->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralOrganisationsList,
+                  &GeneralOrganisationsListLanguage, &GeneralOrganisationsListSortAs,
+                  &GeneralOrganisationsListAltID, &GeneralOrganisationsListPID,
+                  &GeneralOrganisationsListType, &GeneralOrganisationsListTokens,
+                  &GeneralOrganisationsListPref);
+    
+}
+
+void frmContactEditor::AddGeneralNote( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
+    frameCENote->SetEditorMode(FALSE, CE_GENERAL);
+    intResult = GetLastInt(&GeneralNoteList);
+    frameCENote->SetupPointers(&GeneralNoteList,
+                               &GeneralNoteListLanguage,
+                               &GeneralNoteListAltID,
+                               &GeneralNoteListPID,
+                               &GeneralNoteListType,
+                               &GeneralNoteListTokens,
+                               &GeneralNoteListPref,
+                               lboNotes,
+                               (intValueSeek));
+    frameCENote->ShowModal();
+    delete frameCENote;
+    frameCENote = NULL;
+}
+
+void frmContactEditor::ModifyGeneralNote( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboNotes,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
+    frameCENote->SetupPointers(&GeneralNoteList,
+                               &GeneralNoteListLanguage,
+                               &GeneralNoteListAltID,
+                               &GeneralNoteListPID,
+                               &GeneralNoteListType,
+                               &GeneralNoteListTokens,
+                               &GeneralNoteListPref,
+                               lboNotes,
+                               intSelectedData);
+    frameCENote->SetEditorMode(TRUE, CE_GENERAL);
+    frameCENote->ShowModal();
+    delete frameCENote;
+    frameCENote = NULL;
+}
+
+void frmContactEditor::DeleteGeneralNote( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboNotes,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboNotes->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GeneralNoteList,
+                  &GeneralNoteListLanguage, &GeneralNoteListAltID,
+                  &GeneralNoteListPID, &GeneralNoteListType,
+                  &GeneralNoteListTokens, &GeneralNoteListPref);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Groups.cpp b/source/contacteditor/frmContactEditor-Groups.cpp
new file mode 100644 (file)
index 0000000..91329ae
--- /dev/null
@@ -0,0 +1,48 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorGroups.h"
+#include "../frmMain.h"
+
+void frmContactEditor::AddGroup( wxCommandEvent& event )
+{
+    
+    int intResult = 0;
+    
+    XABViewMode XVMData = MainPtr->GetViewMode();
+    
+    frmContactEditorGroup *frameCEGroup = new frmContactEditorGroup ( this );
+    frameCEGroup->SetEditorMode(FALSE, XVMData);
+    intResult = GetLastInt(&GroupsList);
+    frameCEGroup->SetupPointers(&GroupsList,
+                                lboGroups,
+                                wxSContactAccount,
+                                intValueSeek);
+    frameCEGroup->ShowModal();
+    delete frameCEGroup;
+    frameCEGroup = NULL;
+    
+}
+
+void frmContactEditor::ModifyGroup( wxCommandEvent& event )
+{
+    
+    return;
+    
+}
+
+void frmContactEditor::DeleteGroup( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboGroups,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboGroups->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &GroupsList);
+    
+}
\ No newline at end of file
diff --git a/source/contacteditor/frmContactEditor-Home.cpp b/source/contacteditor/frmContactEditor-Home.cpp
new file mode 100644 (file)
index 0000000..1c8d9f5
--- /dev/null
@@ -0,0 +1,925 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorNickname.h"
+#include "frmContactEditorAddress.h"
+#include "frmContactEditorEmail.h"
+#include "frmContactEditorIM.h"
+#include "frmContactEditorTelephone.h"
+#include "frmContactEditorLanguages.h"
+#include "frmContactEditorTimezones.h"
+#include "frmContactEditorRelated.h"
+#include "frmContactEditorWebsites.h"
+#include "frmContactEditorTitles.h"
+#include "frmContactEditorRoles.h"
+#include "frmContactEditorGeoposition.h"
+#include "frmContactEditorGroups.h"
+#include "frmContactEditorOrganisations.h"
+#include "frmContactEditorNotes.h"
+
+void frmContactEditor::AddHomeNickname( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
+    frameCENickname->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeNicknamesList);
+    frameCENickname->SetupPointers(&HomeNicknamesList,
+                                   &HomeNicknamesListAltID,
+                                   &HomeNicknamesListPID,
+                                   &HomeNicknamesListType,
+                                   &HomeNicknamesListLanguage,
+                                   &HomeNicknamesListTokens,
+                                   &HomeNicknamesListPref,
+                                   lboHomeNicknames,
+                                   (intValueSeek));
+    frameCENickname->ShowModal();
+    delete frameCENickname;
+    frameCENickname = NULL;
+}
+
+void frmContactEditor::ModifyHomeNickname( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeNicknames,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
+    frameCENickname->SetupPointers(&HomeNicknamesList,
+                                   &HomeNicknamesListAltID,
+                                   &HomeNicknamesListPID,
+                                   &HomeNicknamesListType,
+                                   &HomeNicknamesListLanguage,
+                                   &HomeNicknamesListTokens,
+                                   &HomeNicknamesListPref,
+                                   lboHomeNicknames,
+                                   intSelectedData);
+    frameCENickname->SetEditorMode(TRUE, CE_HOME);
+    frameCENickname->ShowModal();
+    delete frameCENickname;
+    frameCENickname = NULL;
+}
+
+void frmContactEditor::DeleteHomeNickname( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeNicknames,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeNicknames->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData,
+                  &HomeNicknamesList,
+                  &HomeNicknamesListLanguage,
+                  &HomeNicknamesListAltID,
+                  &HomeNicknamesListPID,
+                  &HomeNicknamesListTokens,
+                  &HomeNicknamesListType,
+                  &HomeNicknamesListPref);
+    
+}
+
+void frmContactEditor::AddHomeAddress( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+    frameCEAddress->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeAddressList);
+    frameCEAddress->SetupPointers(&HomeAddressList,
+                                  &HomeAddressListTown,
+                                  &HomeAddressListCounty,
+                                  &HomeAddressListPostCode,
+                                  &HomeAddressListCountry,
+                                  &HomeAddressListLabel,
+                                  &HomeAddressListLang,
+                                  &HomeAddressListAltID,
+                                  &HomeAddressListPID,
+                                  &HomeAddressListTokens,
+                                  &HomeAddressListGeo,
+                                  &HomeAddressListTimezone,
+                                  &HomeAddressListType,
+                                  &HomeAddressListMediatype,
+                                  &HomeAddressListPref,
+                                  lboHomeAddresses,
+                                  (intValueSeek));
+    frameCEAddress->ShowModal();
+    delete frameCEAddress;
+    frameCEAddress = NULL;
+}
+
+void frmContactEditor::ModifyHomeAddress( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+    frameCEAddress->SetupPointers(&HomeAddressList,
+                                  &HomeAddressListTown,
+                                  &HomeAddressListCounty,
+                                  &HomeAddressListPostCode,
+                                  &HomeAddressListCountry,
+                                  &HomeAddressListLabel,
+                                  &HomeAddressListLang,
+                                  &HomeAddressListAltID,
+                                  &HomeAddressListPID,
+                                  &HomeAddressListTokens,
+                                  &HomeAddressListGeo,
+                                  &HomeAddressListTimezone,
+                                  &HomeAddressListType,
+                                  &HomeAddressListMediatype,
+                                  &HomeAddressListPref,
+                                  lboHomeAddresses,
+                                  intSelectedData);
+    frameCEAddress->SetEditorMode(TRUE, CE_HOME);
+    frameCEAddress->ShowModal();
+    delete frameCEAddress;
+    frameCEAddress = NULL;
+}
+
+void frmContactEditor::DeleteHomeAddress( wxCommandEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeAddresses,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeAddresses->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeAddressList,
+                  &HomeAddressListTown, &HomeAddressListCounty,
+                  &HomeAddressListPostCode, &HomeAddressListCountry,
+                  &HomeAddressList, &HomeAddressListLabel,
+                  &HomeAddressListLang, &HomeAddressListAltID,
+                  &HomeAddressListPID, &HomeAddressListTokens,
+                  &HomeAddressListGeo, &HomeAddressListTimezone,
+                  &HomeAddressListType, &HomeAddressListMediatype,
+                  &HomeAddressListPref);
+    
+}
+
+void frmContactEditor::AddHomeEmail( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
+    frameCEEmail->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeAddressList);
+    frameCEEmail->SetupPointers(&HomeEmailList,
+                                &HomeEmailListAltID,
+                                &HomeEmailListPID,
+                                &HomeEmailListType,
+                                &HomeEmailListTokens,
+                                &HomeEmailListPref,
+                                lboHomeEmails,
+                                (intValueSeek));
+    frameCEEmail->ShowModal();
+    delete frameCEEmail;
+    frameCEEmail = NULL;
+}
+
+void frmContactEditor::ModifyHomeEmail( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeEmails,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
+    frameCEEmail->SetupPointers(&HomeEmailList,
+                                &HomeEmailListAltID,
+                                &HomeEmailListPID,
+                                &HomeEmailListType,
+                                &HomeEmailListTokens,
+                                &HomeEmailListPref,
+                                lboHomeEmails,
+                                intSelectedData);
+    frameCEEmail->SetEditorMode(TRUE, CE_HOME);
+    frameCEEmail->ShowModal();
+    delete frameCEEmail;
+    frameCEEmail = NULL;
+}
+
+
+void frmContactEditor::DeleteHomeEmail( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeEmails,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeEmails->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeEmailList,
+                  &HomeEmailListAltID, &HomeEmailListPID,
+                  &HomeEmailListType, &HomeEmailListTokens,
+                  &HomeEmailListPref);
+}
+
+
+void frmContactEditor::AddHomeIM( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
+    frameCEIM->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeIMList);
+    frameCEIM->SetupPointers(&HomeIMList,
+                             &HomeIMListAltID,
+                             &HomeIMListPID,
+                             &HomeIMListType,
+                             &HomeIMListTokens,
+                             &HomeIMListMediatype,
+                             &HomeIMListPref,
+                             lboHomeIM,
+                             (intValueSeek));
+    frameCEIM->ShowModal();
+    delete frameCEIM;
+    frameCEIM = NULL;
+}
+
+void frmContactEditor::ModifyHomeIM( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeIM,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
+    frameCEIM->SetupPointers(&HomeIMList,
+                             &HomeIMListAltID,
+                             &HomeIMListPID,
+                             &HomeIMListType,
+                             &HomeIMListTokens,
+                             &HomeIMListMediatype,
+                             &HomeIMListPref,
+                             lboHomeIM,
+                             intSelectedData);
+    frameCEIM->SetEditorMode(TRUE, CE_HOME);
+    frameCEIM->ShowModal();
+    delete frameCEIM;
+    frameCEIM = NULL;
+}
+
+void frmContactEditor::DeleteHomeIM( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeIM,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeIM->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeIMList,
+                  &HomeIMListAltID, &HomeIMListPID,
+                  &HomeIMListType, &HomeIMListTokens,
+                  &HomeIMListMediatype, &HomeIMListPref);
+    
+}
+
+void frmContactEditor::AddHomeTelephone( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
+    frameCETel->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeTelephoneList);
+    frameCETel->SetupPointers(&HomeTelephoneList,
+                              &HomeTelephoneListAltID,
+                              &HomeTelephoneListPID,
+                              &HomeTelephoneListType,
+                              &HomeTelephoneListTokens,
+                              &HomeTelephoneListPref,
+                              lboHomeTelephone,
+                              (intValueSeek));
+    frameCETel->ShowModal();
+    delete frameCETel;
+    frameCETel = NULL;
+}
+
+void frmContactEditor::ModifyHomeTelephone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeTelephone,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
+    frameCETel->SetupPointers(&HomeTelephoneList,
+                              &HomeTelephoneListAltID,
+                              &HomeTelephoneListPID,
+                              &HomeTelephoneListType,
+                              &HomeTelephoneListTokens,
+                              &HomeTelephoneListPref,
+                              lboHomeTelephone,
+                              intSelectedData);
+    frameCETel->SetEditorMode(TRUE, CE_HOME);
+    frameCETel->ShowModal();
+    delete frameCETel;
+    frameCETel = NULL;
+}
+
+void frmContactEditor::DeleteHomeTelephone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeTelephone,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeTelephone->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeTelephoneList,
+                  &HomeTelephoneListAltID, &HomeTelephoneListPID,
+                  &HomeTelephoneListType, &HomeTelephoneListTokens,
+                  &HomeTelephoneListPref);
+    
+}
+
+void frmContactEditor::AddHomeLanguage( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
+    frameCELang->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeLanguageList);
+    frameCELang->SetupPointers(&HomeLanguageList,
+                               &HomeLanguageListAltID,
+                               &HomeLanguageListPID,
+                               &HomeLanguageListType,
+                               &HomeLanguageListTokens,
+                               &HomeLanguageListPref,
+                               lboHomeLanguages,
+                               (intValueSeek));
+    frameCELang->ShowModal();
+    delete frameCELang;
+    frameCELang = NULL;
+}
+
+void frmContactEditor::ModifyHomeLanguage( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeLanguages,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
+    frameCELang->SetupPointers(&HomeLanguageList,
+                               &HomeLanguageListAltID,
+                               &HomeLanguageListPID,
+                               &HomeLanguageListType,
+                               &HomeLanguageListTokens,
+                               &HomeLanguageListPref,
+                               lboHomeLanguages,
+                               intSelectedData);
+    frameCELang->SetEditorMode(TRUE, CE_HOME);
+    frameCELang->ShowModal();
+    delete frameCELang;
+    frameCELang = NULL;
+}
+
+void frmContactEditor::DeleteHomeLanguage( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeLanguages,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeLanguages->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeLanguageList,
+                  &HomeLanguageListAltID, &HomeLanguageListPID,
+                  &HomeLanguageListType, &HomeLanguageListTokens,
+                  &HomeLanguageListPref);
+    
+}
+
+void frmContactEditor::AddHomeTimezone( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
+    frameCETZ->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeTZList);
+    frameCETZ->SetupPointers(&HomeTZList,
+                             &HomeTZListAltID,
+                             &HomeTZListPID,
+                             &HomeTZListType,
+                             &HomeTZListTokens,
+                             &HomeTZListMediatype,
+                             &HomeTZListPref,
+                             lboHomeTimezones,
+                             (intValueSeek));
+    frameCETZ->ShowModal();
+    delete frameCETZ;
+    frameCETZ = NULL;
+}
+
+void frmContactEditor::ModifyHomeTimezone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeTimezones,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
+    frameCETZ->SetupPointers(&HomeTZList,
+                             &HomeTZListAltID,
+                             &HomeTZListPID,
+                             &HomeTZListType,
+                             &HomeTZListTokens,
+                             &HomeTZListMediatype,
+                             &HomeTZListPref,
+                             lboHomeTimezones,
+                             intSelectedData);
+    frameCETZ->SetEditorMode(TRUE, CE_HOME);
+    frameCETZ->ShowModal();
+    delete frameCETZ;
+    frameCETZ = NULL;
+}
+
+void frmContactEditor::DeleteHomeTimezone( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeTimezones,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeTimezones->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeTZList,
+                  &HomeTZListAltID, &HomeTZListPID,
+                  &HomeTZListType, &HomeTZListTokens,
+                  &HomeTZListMediatype, &HomeTZListPref);
+    
+}
+
+void frmContactEditor::AddHomeGeoposition( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
+    frameCEGeo->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeGeographyList);
+    frameCEGeo->SetupPointers(&HomeGeographyList,
+                              &HomeGeographyListAltID,
+                              &HomeGeographyListPID,
+                              &HomeGeographyListType,
+                              &HomeGeographyListTokens,
+                              &HomeGeographyListMediatype,
+                              &HomeGeographyListPref,
+                              lboHomeGeoposition,
+                              (intValueSeek));
+    frameCEGeo->ShowModal();
+    delete frameCEGeo;
+    frameCEGeo = NULL;
+}
+
+void frmContactEditor::ModifyHomeGeoposition( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeGeoposition,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
+    frameCEGeo->SetupPointers(&HomeGeographyList,
+                              &HomeGeographyListAltID,
+                              &HomeGeographyListPID,
+                              &HomeGeographyListType,
+                              &HomeGeographyListTokens,
+                              &HomeGeographyListMediatype,
+                              &HomeGeographyListPref,
+                              lboHomeGeoposition,
+                              intSelectedData);
+    frameCEGeo->SetEditorMode(TRUE, CE_HOME);
+    frameCEGeo->ShowModal();
+    delete frameCEGeo;
+    frameCEGeo = NULL;
+}
+
+void frmContactEditor::DeleteHomeGeoposition( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeGeoposition,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeGeoposition->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeGeographyList,
+                  &HomeGeographyListAltID, &HomeGeographyListPID,
+                  &HomeGeographyListType, &HomeGeographyListTokens,
+                  &HomeGeographyListMediatype, &HomeGeographyListPref);
+    
+}
+
+void frmContactEditor::AddHomeWebsite( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
+    frameCEWeb->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeWebsiteList);
+    frameCEWeb->SetupPointers(&HomeWebsiteList,
+                              &HomeWebsiteListAltID,
+                              &HomeWebsiteListPID,
+                              &HomeWebsiteListType,
+                              &HomeWebsiteListTokens,
+                              &HomeWebsiteListMediatype,
+                              &HomeWebsiteListPref,
+                              lboHomeWebsites,
+                              (intValueSeek));
+    frameCEWeb->ShowModal();
+    delete frameCEWeb;
+    frameCEWeb = NULL;
+}
+
+void frmContactEditor::ModifyHomeWebsite( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeWebsites,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
+    frameCEWeb->SetupPointers(&HomeWebsiteList,
+                              &HomeWebsiteListAltID,
+                              &HomeWebsiteListPID,
+                              &HomeWebsiteListType,
+                              &HomeWebsiteListTokens,
+                              &HomeWebsiteListMediatype,
+                              &HomeWebsiteListPref,
+                              lboHomeWebsites,
+                              intSelectedData);
+    frameCEWeb->SetEditorMode(TRUE, CE_HOME);
+    frameCEWeb->ShowModal();
+    delete frameCEWeb;
+    frameCEWeb = NULL;
+}
+
+void frmContactEditor::DeleteHomeWebsite( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeWebsites,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeWebsites->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeWebsiteList,
+                  &HomeWebsiteListAltID, &HomeWebsiteListPID,
+                  &HomeWebsiteListType, &HomeWebsiteListTokens,
+                  &HomeWebsiteListMediatype, &HomeWebsiteListPref);
+    
+}
+
+void frmContactEditor::AddHomeTitle( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
+    frameCETitle->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeTitleList);
+    frameCETitle->SetupPointers(&HomeTitleList,
+                                &HomeTitleListLanguage,
+                                &HomeTitleListAltID,
+                                &HomeTitleListPID,
+                                &HomeTitleListType,
+                                &HomeTitleListTokens,
+                                &HomeTitleListPref,
+                                lboHomeTitles,
+                                (intValueSeek));
+    frameCETitle->ShowModal();
+    delete frameCETitle;
+    frameCETitle = NULL;
+}
+
+void frmContactEditor::ModifyHomeTitle( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeTitles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
+    frameCETitle->SetupPointers(&HomeTitleList,
+                                &HomeTitleListLanguage,
+                                &HomeTitleListAltID,
+                                &HomeTitleListPID,
+                                &HomeTitleListType,
+                                &HomeTitleListTokens,
+                                &HomeTitleListPref,
+                                lboHomeTitles,
+                                intSelectedData);
+    frameCETitle->SetEditorMode(TRUE, CE_HOME);
+    frameCETitle->ShowModal();
+    delete frameCETitle;
+    frameCETitle = NULL;
+}
+
+void frmContactEditor::DeleteHomeTitle( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeTitles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeTitles->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeTitleList,
+                  &HomeTitleListLanguage, &HomeTitleListAltID,
+                  &HomeTitleListPID, &HomeTitleListType,
+                  &HomeTitleListTokens, &HomeTitleListPref);
+    
+}
+
+void frmContactEditor::AddHomeRole( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
+    frameCERole->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeRoleList);
+    frameCERole->SetupPointers(&HomeRoleList,
+                               &HomeRoleListLanguage,
+                               &HomeRoleListAltID,
+                               &HomeRoleListPID,
+                               &HomeRoleListType,
+                               &HomeRoleListTokens,
+                               &HomeRoleListPref,
+                               lboHomeRoles,
+                               (intValueSeek));
+    frameCERole->ShowModal();
+    delete frameCERole;
+    frameCERole = NULL;
+}
+
+void frmContactEditor::ModifyHomeRole( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeRoles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
+    frameCERole->SetupPointers(&HomeRoleList,
+                               &HomeRoleListLanguage,
+                               &HomeRoleListAltID,
+                               &HomeRoleListPID,
+                               &HomeRoleListType,
+                               &HomeRoleListTokens,
+                               &HomeRoleListPref,
+                               lboHomeRoles,
+                               intSelectedData);
+    frameCERole->SetEditorMode(TRUE, CE_HOME);
+    frameCERole->ShowModal();
+    delete frameCERole;
+    frameCERole = NULL;
+}
+
+void frmContactEditor::DeleteHomeRole( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeRoles,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeRoles->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeRoleList,
+                  &HomeRoleListLanguage, &HomeRoleListAltID,
+                  &HomeRoleListPID, &HomeRoleListType,
+                  &HomeRoleListTokens, &HomeRoleListPref);
+    
+}
+
+void frmContactEditor::AddHomeOrganisation( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
+    frameCEOrg->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeOrganisationsList);
+    frameCEOrg->SetupPointers(&HomeOrganisationsList,
+                              &HomeOrganisationsListLanguage,
+                              &HomeOrganisationsListSortAs,
+                              &HomeOrganisationsListAltID,
+                              &HomeOrganisationsListPID,
+                              &HomeOrganisationsListType,
+                              &HomeOrganisationsListTokens,
+                              &HomeOrganisationsListPref,
+                              lboHomeOrganisations,
+                              (intValueSeek));
+    frameCEOrg->ShowModal();
+    delete frameCEOrg;
+    frameCEOrg = NULL;
+}
+
+void frmContactEditor::ModifyHomeOrganisation( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeOrganisations,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
+    frameCEOrg->SetupPointers(&HomeOrganisationsList,
+                              &HomeOrganisationsListLanguage,
+                              &HomeOrganisationsListSortAs,
+                              &HomeOrganisationsListAltID,
+                              &HomeOrganisationsListPID,
+                              &HomeOrganisationsListType,
+                              &HomeOrganisationsListTokens,
+                              &HomeOrganisationsListPref,
+                              lboHomeOrganisations,
+                              intSelectedData);
+    frameCEOrg->SetEditorMode(TRUE, CE_HOME);
+    frameCEOrg->ShowModal();
+    delete frameCEOrg;
+    frameCEOrg = NULL;
+}
+
+void frmContactEditor::DeleteHomeOrganisation( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeOrganisations,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboHomeOrganisations->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeOrganisationsList,
+                  &HomeOrganisationsListLanguage, &HomeOrganisationsListSortAs,
+                  &HomeOrganisationsListAltID, &HomeOrganisationsListPID,
+                  &HomeOrganisationsListType, &HomeOrganisationsListTokens,
+                  &HomeOrganisationsListPref);
+    
+}
+
+void frmContactEditor::AddHomeNote( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
+    frameCENote->SetEditorMode(FALSE, CE_HOME);
+    intResult = GetLastInt(&HomeNoteList);
+    frameCENote->SetupPointers(&HomeNoteList,
+                               &HomeNoteListLanguage,
+                               &HomeNoteListAltID,
+                               &HomeNoteListPID,
+                               &HomeNoteListType,
+                               &HomeNoteListTokens,
+                               &HomeNoteListPref,
+                               lboHomeNotes,
+                               (intValueSeek));
+    frameCENote->ShowModal();
+    delete frameCENote;
+    frameCENote = NULL;
+}
+
+void frmContactEditor::ModifyHomeNote( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeNotes,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
+    frameCENote->SetupPointers(&HomeNoteList,
+                               &HomeNoteListLanguage,
+                               &HomeNoteListAltID,
+                               &HomeNoteListPID,
+                               &HomeNoteListType,
+                               &HomeNoteListTokens,
+                               &HomeNoteListPref,
+                               lboHomeNotes,
+                               intSelectedData);
+    frameCENote->SetEditorMode(TRUE, CE_HOME);
+    frameCENote->ShowModal();
+    delete frameCENote;
+    frameCENote = NULL;
+}
+
+void frmContactEditor::DeleteHomeNote( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboHomeNotes,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboNotes->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &HomeNoteList,
+                  &HomeNoteListLanguage, &HomeNoteListAltID,
+                  &HomeNoteListPID, &HomeNoteListType,
+                  &HomeNoteListTokens, &HomeNoteListPref);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Init.cpp b/source/contacteditor/frmContactEditor-Init.cpp
new file mode 100644 (file)
index 0000000..d092370
--- /dev/null
@@ -0,0 +1,388 @@
+#include "frmContactEditor.h"
+
+void frmContactEditor::SetupHeaders()
+{
+    
+    /* Items for the General Tab */
+    
+    SetupColumn(CE_NICKNAME, lboNicknames);
+    SetupColumn(CE_ADDRESS, lboAddresses);
+    SetupColumn(CE_EMAIL, lboEmails);
+    SetupColumn(CE_IM, lboIM);
+    SetupColumn(CE_TELEPHONE, lboTelephone);
+    SetupColumn(CE_LANG, lboLanguages);
+    SetupColumn(CE_TZ, lboTimezones);
+    SetupColumn(CE_GEOPOSITION, lboGeoposition);
+    SetupColumn(CE_RELATED, lboRelated);
+    SetupColumn(CE_WEBSITE, lboWebsites);
+    SetupColumn(CE_TITLE, lboTitles);
+    SetupColumn(CE_ROLE, lboRoles);
+    SetupColumn(CE_ORG, lboOrganisations);
+    SetupColumn(CE_NOTE, lboNotes);
+    
+    /* Items for the Home Tab */
+    
+    SetupColumn(CE_NICKNAME, lboHomeNicknames);
+    SetupColumn(CE_ADDRESS, lboHomeAddresses);
+    SetupColumn(CE_EMAIL, lboHomeEmails);
+    SetupColumn(CE_IM, lboHomeIM);
+    SetupColumn(CE_TELEPHONE, lboHomeTelephone);       
+    SetupColumn(CE_LANG, lboHomeLanguages);
+    SetupColumn(CE_TZ, lboHomeTimezones);
+    SetupColumn(CE_GEOPOSITION, lboHomeGeoposition);
+    SetupColumn(CE_WEBSITE, lboHomeWebsites);
+    SetupColumn(CE_TITLE, lboHomeTitles);
+    SetupColumn(CE_ROLE, lboHomeRoles);
+    SetupColumn(CE_ORG, lboHomeOrganisations);
+    SetupColumn(CE_NOTE, lboHomeNotes);
+    
+    /* Items for the Business Tab */
+    
+    SetupColumn(CE_NICKNAME, lboBusinessNicknames);
+    SetupColumn(CE_ADDRESS, lboBusinessAddresses);
+    SetupColumn(CE_EMAIL, lboBusinessEmail);
+    SetupColumn(CE_IM, lboBusinessIM);
+    SetupColumn(CE_TELEPHONE, lboBusinessTelephone);   
+    SetupColumn(CE_LANG, lboBusinessLanguages);
+    SetupColumn(CE_TZ, lboBusinessTimezones);
+    SetupColumn(CE_GEOPOSITION, lboBusinessGeoposition);
+    SetupColumn(CE_WEBSITE, lboBusinessWebsites);
+    SetupColumn(CE_TITLE, lboBusinessTitles);
+    SetupColumn(CE_ROLE, lboBusinessRoles);
+    SetupColumn(CE_ORG, lboBusinessOrganisations);
+    SetupColumn(CE_NOTE, lboBusinessNotes);    
+    
+    /* Items for the Categories Tab */
+    
+    SetupColumn(CE_CATEGORIES, lboCategories);
+    
+    /* Items for the Groups Tab */
+    
+    SetupColumn(CE_GROUPS, lboGroups);
+    
+    /* Items for the Pictures and Logos Tab */
+    
+    SetupColumn(CE_PICTURES, lboPictures);
+    SetupColumn(CE_PICTURES, lboLogos);        
+    
+    /* Items for the Sounds Tab */
+    
+    SetupColumn(CE_SOUNDS, lboSounds);
+    
+    /* Items for the Calendaring Tab */
+    
+    SetupColumn(CE_CALENDAR, lboCalendarAddresses);
+    SetupColumn(CE_CALENDAR, lboCalendarRequestAddress);
+    SetupColumn(CE_CALENDAR, lboFreeBusyAddresses);    
+    
+    /* Items for the Security Tab */
+    
+    SetupColumn(CE_KEY, lboKeys);
+    
+    /* Items for the Other Tab */
+    
+    SetupColumn(CE_TOKEN, lboVendorNamespace);
+    SetupColumn(CE_TOKEN, lboXToken);
+    
+}
+
+void frmContactEditor::SetupColumn(wxString ColumnType, wxListCtrl *ListCtrl)
+{
+    
+    wxListItem coldata;        
+    
+    if (ColumnType == CE_NICKNAME){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Nickname"));
+        coldata.SetWidth(128);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+    } else if (ColumnType == CE_ADDRESS){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Address"));
+        coldata.SetWidth(128);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Town"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+        coldata.SetId(2);
+        coldata.SetText(_("County"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(2, coldata);
+        
+        coldata.SetId(3);
+        coldata.SetText(_("Post code"));
+        coldata.SetWidth(48);
+        ListCtrl->InsertColumn(3, coldata);
+        
+        coldata.SetId(4);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(4, coldata);            
+        
+    } else if (ColumnType == CE_EMAIL){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Email address"));
+        coldata.SetWidth(304);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_IM){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Address"));
+        coldata.SetWidth(240);
+        ListCtrl->InsertColumn(1, coldata);
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);            
+        
+    } else if (ColumnType == CE_TELEPHONE){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Telephone number"));
+        coldata.SetWidth(128);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);            
+        
+    } else if (ColumnType == CE_LANG){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Language"));
+        coldata.SetWidth(128);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+    } else if (ColumnType == CE_TZ){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Timezone"));
+        coldata.SetWidth(192);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+    } else if (ColumnType == CE_RELATED){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Name/Description"));
+        coldata.SetWidth(192);
+        ListCtrl->InsertColumn(1, coldata);
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);
+        
+    } else if (ColumnType == CE_WEBSITE){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Website"));
+        coldata.SetWidth(288);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_TITLE){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Title"));
+        coldata.SetWidth(288);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_ROLE){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Role"));
+        coldata.SetWidth(288);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_ORG){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Organisation"));
+        coldata.SetWidth(288);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_NOTE){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Notes"));
+        coldata.SetWidth(288);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);    
+        
+    } else if (ColumnType == CE_CATEGORIES){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Category"));
+        coldata.SetWidth(320);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_GROUPS){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Member"));
+        coldata.SetWidth(320);
+        ListCtrl->InsertColumn(0, coldata);
+        
+    } else if (ColumnType == CE_GEOPOSITION){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Geoposition"));
+        coldata.SetWidth(320);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(1, coldata);
+        
+    } else if (ColumnType == CE_PICTURES){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Pictures"));
+        coldata.SetWidth(128);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);
+        
+    } else if (ColumnType == CE_SOUNDS){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Sounds"));
+        coldata.SetWidth(128);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);
+        
+    } else if (ColumnType == CE_CALENDAR){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Calendar Address"));
+        coldata.SetWidth(224);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);
+        
+    } else if (ColumnType == CE_KEY){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Key information"));
+        coldata.SetWidth(224);
+        ListCtrl->InsertColumn(0, coldata);
+        
+        coldata.SetId(1);
+        coldata.SetText(_("Type"));
+        coldata.SetWidth(64);
+        ListCtrl->InsertColumn(1, coldata);            
+        
+        coldata.SetId(2);
+        coldata.SetText(_("Pri."));
+        coldata.SetWidth(32);
+        ListCtrl->InsertColumn(2, coldata);
+        
+    } else if (ColumnType == CE_TOKEN){
+        
+        coldata.SetId(0);
+        coldata.SetText(_("Token"));
+        coldata.SetWidth(320);
+        ListCtrl->InsertColumn(0, coldata);
+        
+    }
+    
+}
\ No newline at end of file
diff --git a/source/contacteditor/frmContactEditor-Key.cpp b/source/contacteditor/frmContactEditor-Key.cpp
new file mode 100644 (file)
index 0000000..12dfa09
--- /dev/null
@@ -0,0 +1,71 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorKey.h"
+
+void frmContactEditor::AddKey( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this );
+    frameCEKey->SetEditorMode(FALSE);
+    intResult = GetLastInt(&KeyList);
+    frameCEKey->SetupPointers(&KeyList,
+                              &KeyListAltID,
+                              &KeyListPID,
+                              &KeyListKeyType,
+                              &KeyListDataType,
+                              &KeyListType,
+                              &KeyListTokens,
+                              &KeyListPref,
+                              lboKeys,
+                              (intValueSeek));
+    frameCEKey->ShowModal();
+    delete frameCEKey;
+    frameCEKey = NULL;
+}
+
+void frmContactEditor::ModifyKey( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboKeys,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this );
+    frameCEKey->SetupPointers(&KeyList,
+                              &KeyListAltID,
+                              &KeyListPID,
+                              &KeyListKeyType,
+                              &KeyListDataType,
+                              &KeyListType,
+                              &KeyListTokens,
+                              &KeyListPref,
+                              lboKeys,
+                              intSelectedData);
+    frameCEKey->SetEditorMode(TRUE);
+    frameCEKey->ShowModal();
+    delete frameCEKey;
+    frameCEKey = NULL;
+}
+
+void frmContactEditor::DeleteKey( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboKeys,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboKeys->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &KeyList, &KeyListAltID,
+                  &KeyListPID, &KeyListKeyType, &KeyListDataType, &KeyListType,
+                  &KeyListTokens, &KeyListPref);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Logo.cpp b/source/contacteditor/frmContactEditor-Logo.cpp
new file mode 100644 (file)
index 0000000..b749bd6
--- /dev/null
@@ -0,0 +1,118 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorPicture.h"
+#include "../common/base64.h"
+
+void frmContactEditor::LoadLogo( wxListEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboLogos,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    std::string base64dec;
+    
+    std::map<int,std::string>::iterator initier;
+    
+    initier = LogosList.find(intSelectedData);
+    
+    base64dec = base64_decode(initier->second);
+    
+    
+    wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
+    wxImage photo;
+    //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
+    
+    if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
+        
+        return;
+        
+    }
+    
+    
+    LogoImage = (wxBitmap)photo;
+    imgLogo->SetBitmap(LogoImage);
+    
+}
+
+void frmContactEditor::AddLogo( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
+    frameCELogo->SetEditorMode(FALSE);
+    intResult = GetLastInt(&LogosList);
+    frameCELogo->SetupPointers(&LogosList,
+                               &LogosListAltID,
+                               &LogosListPID,
+                               &LogosListType,
+                               &LogosListPicEncType,
+                               &LogosListPictureType,
+                               &LogosListTokens,
+                               &LogosListMediatype,
+                               &LogosListPref,
+                               lboLogos,
+                               (intValueSeek));
+    frameCELogo->ShowModal();
+    delete frameCELogo;
+    frameCELogo = NULL;
+}
+
+void frmContactEditor::ModifyLogo( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboLogos,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
+    frameCELogo->SetupPointers(&LogosList,
+                               &LogosListAltID,
+                               &LogosListPID,
+                               &LogosListType,
+                               &LogosListPicEncType,
+                               &LogosListPictureType,
+                               &LogosListTokens,
+                               &LogosListMediatype,
+                               &LogosListPref,
+                               lboLogos,
+                               intSelectedData);
+    frameCELogo->SetEditorMode(TRUE);
+    frameCELogo->ShowModal();
+    delete frameCELogo;
+    frameCELogo = NULL;
+}
+
+void frmContactEditor::DeleteLogo( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboLogos,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboLogos->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData,
+                  &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
+                  &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
+                  &LogosListMediatype, &LogosListPref);
+    
+    wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
+    wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
+    LogoImage = (wxBitmap)misc_emptyimage_png;
+    
+    imgLogo->SetBitmap(LogoImage);
+}
+
diff --git a/source/contacteditor/frmContactEditor-Other.cpp b/source/contacteditor/frmContactEditor-Other.cpp
new file mode 100644 (file)
index 0000000..a0ab8e3
--- /dev/null
@@ -0,0 +1,116 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorVendor.h"
+#include "frmContactEditorXToken.h"
+
+void frmContactEditor::AddVendorNamespace( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorVendor *frameCEVen = new frmContactEditorVendor ( this );
+    frameCEVen->SetEditorMode(FALSE);
+    intResult = GetLastInt(&VendorList);
+    frameCEVen->SetupPointers(&VendorList,
+                              &VendorListPEN,
+                              &VendorListElement,
+                              lboVendorNamespace,
+                              (intValueSeek));
+    frameCEVen->ShowModal();
+    delete frameCEVen;
+    frameCEVen = NULL;
+}
+
+void frmContactEditor::ModifyVendorNamespace( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboVendorNamespace,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorVendor *frameCEVen = new frmContactEditorVendor ( this );
+    frameCEVen->SetupPointers(&VendorList,
+                              &VendorListPEN,
+                              &VendorListElement,
+                              lboVendorNamespace,
+                              intSelectedData);
+    frameCEVen->SetEditorMode(TRUE);
+    frameCEVen->ShowModal();
+    delete frameCEVen;
+    frameCEVen = NULL;
+}
+
+void frmContactEditor::DeleteVendorNamespace( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboVendorNamespace,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboVendorNamespace->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &VendorList, &VendorListPEN,
+                  &VendorListElement);
+    
+}
+
+void frmContactEditor::AddXToken( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorXToken *frameCEXT = new frmContactEditorXToken ( this );
+    frameCEXT->SetEditorMode(FALSE);
+    intResult = GetLastInt(&XTokenList);
+    frameCEXT->SetupPointers(&XTokenList,
+                             &XTokenListTokens,
+                             lboXToken,
+                             (intValueSeek));
+    frameCEXT->ShowModal();
+    delete frameCEXT;
+    frameCEXT = NULL;
+}
+
+void frmContactEditor::ModifyXToken( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboXToken,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorXToken *frameCEXT = new frmContactEditorXToken ( this );
+    frameCEXT->SetupPointers(&XTokenList,
+                             &XTokenListTokens,
+                             lboXToken,
+                             intSelectedData);
+    frameCEXT->SetEditorMode(TRUE);
+    frameCEXT->ShowModal();
+    delete frameCEXT;
+    frameCEXT = NULL;
+}
+
+void frmContactEditor::DeleteXToken( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboXToken,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboXToken->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &XTokenList, &XTokenListTokens);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Picture.cpp b/source/contacteditor/frmContactEditor-Picture.cpp
new file mode 100644 (file)
index 0000000..5412b99
--- /dev/null
@@ -0,0 +1,142 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorPicture.h"
+#include "../common/base64.h"
+
+void frmContactEditor::AddPicture( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this );
+    frameCEPicture->SetEditorMode(FALSE);
+    intResult = GetLastInt(&PicturesList);
+    frameCEPicture->SetupPointers(&PicturesList,
+                                  &PicturesListAltID,
+                                  &PicturesListPID,
+                                  &PicturesListType,
+                                  &PicturesListPicEncType,
+                                  &PicturesListPictureType,
+                                  &PicturesListTokens,
+                                  &PicturesListMediatype,
+                                  &PicturesListPref,
+                                  lboPictures,
+                                  (intValueSeek));
+    frameCEPicture->ShowModal();
+    delete frameCEPicture;
+    frameCEPicture = NULL;
+}
+
+void frmContactEditor::ModifyPicture( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboPictures,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this );
+    frameCEPicture->SetupPointers(&PicturesList,
+                                  &PicturesListAltID,
+                                  &PicturesListPID,
+                                  &PicturesListType,
+                                  &PicturesListPicEncType,
+                                  &PicturesListPictureType,
+                                  &PicturesListTokens,
+                                  &PicturesListMediatype,
+                                  &PicturesListPref,
+                                  lboPictures,
+                                  intSelectedData);
+    frameCEPicture->SetEditorMode(TRUE);
+    frameCEPicture->ShowModal();
+    delete frameCEPicture;
+    frameCEPicture = NULL;
+    
+}
+
+void frmContactEditor::DeletePicture( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboPictures,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboPictures->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData,
+                  &PicturesList, &PicturesListAltID, &PicturesListPID, &PicturesListType,
+                  &PicturesListPicEncType, &PicturesListPictureType, &PicturesListTokens,
+                  &PicturesListMediatype, &PicturesListPref);
+    
+    wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
+    wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
+    PictureImage = (wxBitmap)misc_emptyimage_png;
+    
+    imgPicture->SetBitmap(PictureImage);
+}
+
+void frmContactEditor::LoadPicture( wxListEvent& event )
+{
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboPictures,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    std::string base64dec;
+    
+    std::map<int,std::string>::iterator initier;
+    std::map<int,wxString>::iterator pictypeiter;
+    
+    initier = PicturesList.find(intSelectedData);
+    pictypeiter = PicturesListPictureType.find(intSelectedData);
+    
+    base64dec = base64_decode(initier->second);
+    
+    wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
+    wxImage photo;
+    //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
+    
+    if (pictypeiter->second == wxT("image/jpeg")){
+        
+        if (!photo.LoadFile(istream, wxBITMAP_TYPE_JPEG)){
+        
+            return;
+        
+        }
+        
+    } else if (pictypeiter->second == wxT("image/png")){
+        
+        if (!photo.LoadFile(istream, wxBITMAP_TYPE_PNG)){
+            
+            return;
+            
+        }
+        
+    } else if (pictypeiter->second == wxT("image/gif")){
+        
+        if (!photo.LoadFile(istream, wxBITMAP_TYPE_GIF)){
+            
+            return;
+            
+        }
+        
+    } else {
+    
+        return;
+    
+    }
+    
+    PictureImage = (wxBitmap)photo;
+    imgPicture->SetBitmap(PictureImage);
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Reset.cpp b/source/contacteditor/frmContactEditor-Reset.cpp
new file mode 100644 (file)
index 0000000..aa413da
--- /dev/null
@@ -0,0 +1,631 @@
+#include "frmContactEditor.h"
+
+void frmContactEditor::ClearContact(){
+    
+    // Clear out the GUI and values.
+    
+    // Clear GUI.
+    
+    txtTitle->Clear();
+    txtForename->Clear();
+    txtSurname->Clear();
+    txtOtherNames->Clear();
+    txtSuffix->Clear();
+    cmbDisplayAs->Clear();
+    cmbDisplayAs->SetValue(wxT(""));
+    wxDateTime EmptyDate;
+    wxBitmap EmptyBitmap;
+    dapAnniversary->SetValue(EmptyDate);
+    dapBirthday->SetValue(EmptyDate);
+    txtBirthday->Clear();
+    txtAnniversary->Clear();
+    cmbGender->Select(0);
+    txtGenderDescription->Clear();
+    
+    lboNicknames->DeleteAllItems();
+    lboHomeNicknames->DeleteAllItems();
+    lboBusinessNicknames->DeleteAllItems();
+    
+    lboAddresses->DeleteAllItems();
+    lboHomeAddresses->DeleteAllItems();
+    lboBusinessAddresses->DeleteAllItems();
+    
+    lboEmails->DeleteAllItems();
+    lboHomeEmails->DeleteAllItems();
+    lboBusinessEmail->DeleteAllItems();
+    
+    lboIM->DeleteAllItems();
+    lboHomeIM->DeleteAllItems();
+    lboBusinessIM->DeleteAllItems();
+    
+    lboTelephone->DeleteAllItems();
+    lboHomeTelephone->DeleteAllItems();
+    lboBusinessTelephone->DeleteAllItems();
+    
+    lboLanguages->DeleteAllItems();
+    lboHomeLanguages->DeleteAllItems();
+    lboBusinessLanguages->DeleteAllItems();
+    
+    lboTimezones->DeleteAllItems();
+    lboHomeTimezones->DeleteAllItems();
+    lboBusinessTimezones->DeleteAllItems();
+    
+    lboGeoposition->DeleteAllItems();
+    lboHomeGeoposition->DeleteAllItems();
+    lboBusinessGeoposition->DeleteAllItems();
+    
+    lboRelated->DeleteAllItems();
+    
+    lboWebsites->DeleteAllItems();
+    lboHomeWebsites->DeleteAllItems();
+    lboBusinessWebsites->DeleteAllItems();
+    
+    lboTitles->DeleteAllItems();
+    lboHomeTitles->DeleteAllItems();
+    lboBusinessTitles->DeleteAllItems();
+    
+    lboRoles->DeleteAllItems();
+    lboHomeRoles->DeleteAllItems();
+    lboBusinessRoles->DeleteAllItems();
+    
+    lboOrganisations->DeleteAllItems();
+    lboHomeOrganisations->DeleteAllItems();
+    lboBusinessOrganisations->DeleteAllItems();
+    
+    lboNotes->DeleteAllItems();
+    lboHomeNotes->DeleteAllItems();
+    lboBusinessNotes->DeleteAllItems();
+    
+    lboCategories->DeleteAllItems();
+    
+    lboGroups->DeleteAllItems();
+    
+    // Clear Picture
+    lboPictures->DeleteAllItems();
+    imgPicture->SetBitmap(EmptyBitmap);
+    
+    // Clear Logo
+    lboLogos->DeleteAllItems();
+    imgLogo->SetBitmap(EmptyBitmap);
+    
+    lboSounds->DeleteAllItems();
+    
+    lboCalendarAddresses->DeleteAllItems();
+    lboCalendarRequestAddress->DeleteAllItems();
+    lboFreeBusyAddresses->DeleteAllItems();
+    
+    lboKeys->DeleteAllItems();
+    
+    lboVendorNamespace->DeleteAllItems();
+    lboXToken->DeleteAllItems();
+    
+    // Clear values out.
+    
+    wxString NameTitle;
+    wxString NameForename;
+    wxString NameSurname;
+    wxString NameOtherNames;
+    wxString NameSuffix;
+    wxString NameNickname;
+    wxString NameDisplayAs;
+    wxString NameLanguage;
+    wxString NameAltID;
+    wxString NameTokens;
+    
+    wxString Birthday;
+    wxString BirthdayAltID;
+    wxString BirthdayCalScale;
+    wxString BirthdayTokens;
+    wxString Anniversary;
+    wxString AnniversaryAltID;
+    wxString AnniversaryCalScale;
+    wxString AnniversaryTokens;
+    
+    wxString Gender;
+    wxString GenderDetails;
+    wxString GenderTokens;
+    
+    wxString UIDToken;
+    
+    /* We don't use these at the moment but we want to keep
+     them for compatability reasons */
+    
+    /*std::map<int, wxString> ExtraFullNames;*/
+    /*std::map<int, wxString> ExtraNicknames;*/
+    
+    FullNamesList.clear();    
+    FullNamesListType.clear();
+    FullNamesListLanguage.clear();
+    FullNamesListAltID.clear();
+    FullNamesListPID.clear();
+    FullNamesListTokens.clear();
+    FullNamesListPref.clear();
+    
+    GeneralNicknamesList.clear();
+    GeneralNicknamesListType.clear();
+    GeneralNicknamesListLanguage.clear();
+    GeneralNicknamesListAltID.clear();
+    GeneralNicknamesListPID.clear();
+    GeneralNicknamesListTokens.clear();        
+    GeneralNicknamesListPref.clear();        
+    
+    GeneralAddressList.clear();
+    GeneralAddressListTown.clear();
+    GeneralAddressListCounty.clear();
+    GeneralAddressListPostCode.clear();
+    GeneralAddressListCountry.clear();
+    GeneralAddressListLabel.clear();
+    GeneralAddressListLang.clear();        
+    GeneralAddressListAltID.clear();
+    GeneralAddressListPID.clear();
+    GeneralAddressListTokens.clear();
+    GeneralAddressListGeo.clear();
+    GeneralAddressListTimezone.clear();        
+    GeneralAddressListType.clear();
+    GeneralAddressListMediatype.clear();
+    GeneralAddressListPref.clear();
+    
+    GeneralEmailList.clear();
+    GeneralEmailListAltID.clear();
+    GeneralEmailListPID.clear();
+    GeneralEmailListType.clear();
+    GeneralEmailListTokens.clear();
+    GeneralEmailListPref.clear();
+    
+    GeneralIMList.clear();
+    GeneralIMListAltID.clear();
+    GeneralIMListPID.clear();
+    GeneralIMListType.clear();
+    GeneralIMListTokens.clear();
+    GeneralIMListMediatype.clear();
+    GeneralIMListPref.clear();
+    
+    GeneralTelephoneList.clear();
+    GeneralTelephoneListAltID.clear();
+    GeneralTelephoneListPID.clear();
+    GeneralTelephoneListType.clear();
+    GeneralTelephoneListTokens.clear();
+    GeneralTelephoneListPref.clear();
+    
+    GeneralLanguageList.clear();
+    GeneralLanguageListAltID.clear();
+    GeneralLanguageListPID.clear();
+    GeneralLanguageListType.clear();
+    GeneralLanguageListTokens.clear();
+    GeneralLanguageListPref.clear();
+    
+    GeneralTZList.clear();
+    GeneralTZListAltID.clear();
+    GeneralTZListPID.clear();
+    GeneralTZListType.clear();
+    GeneralTZListTokens.clear();
+    GeneralTZListMediatype.clear();
+    GeneralTZListPref.clear();
+    
+    GeneralGeographyList.clear();
+    GeneralGeographyListAltID.clear();
+    GeneralGeographyListPID.clear();
+    GeneralGeographyListType.clear();
+    GeneralGeographyListTokens.clear();
+    GeneralGeographyListMediatype.clear();
+    GeneralGeographyListPref.clear();
+    
+    GeneralRelatedList.clear();
+    GeneralRelatedListRelType.clear();
+    GeneralRelatedListLanguage.clear();
+    GeneralRelatedListAltID.clear();
+    GeneralRelatedListPID.clear();
+    GeneralRelatedListType.clear();
+    GeneralRelatedListTokens.clear();
+    GeneralRelatedListPref.clear();
+    
+    GeneralWebsiteList.clear();
+    GeneralWebsiteListAltID.clear();
+    GeneralWebsiteListPID.clear();
+    GeneralWebsiteListType.clear();
+    GeneralWebsiteListTokens.clear();
+    GeneralWebsiteListMediatype.clear();
+    GeneralWebsiteListPref.clear();
+    
+    GeneralTitleList.clear();
+    GeneralTitleListLanguage.clear();        
+    GeneralTitleListAltID.clear();
+    GeneralTitleListPID.clear();
+    GeneralTitleListType.clear();
+    GeneralTitleListTokens.clear();
+    GeneralTitleListPref.clear();
+    
+    GeneralRoleList.clear();
+    GeneralRoleListLanguage.clear();        
+    GeneralRoleListAltID.clear();
+    GeneralRoleListPID.clear();
+    GeneralRoleListType.clear();
+    GeneralRoleListTokens.clear();
+    GeneralRoleListPref.clear();
+    
+    GeneralOrganisationsList.clear();
+    GeneralOrganisationsListLanguage.clear();        
+    GeneralOrganisationsListAltID.clear();
+    GeneralOrganisationsListPID.clear();
+    GeneralOrganisationsListType.clear();
+    GeneralOrganisationsListTokens.clear();
+    GeneralOrganisationsListSortAs.clear();
+    GeneralOrganisationsListPref.clear();
+    
+    GeneralNoteList.clear();
+    GeneralNoteListLanguage.clear();        
+    GeneralNoteListAltID.clear();
+    GeneralNoteListPID.clear();
+    GeneralNoteListType.clear();
+    GeneralNoteListTokens.clear();
+    GeneralNoteListPref.clear();
+    
+    /* Items on Home Tab */        
+    
+    HomeNicknamesList.clear();
+    HomeNicknamesListType.clear();
+    HomeNicknamesListLanguage.clear();
+    HomeNicknamesListAltID.clear();
+    HomeNicknamesListPID.clear();
+    HomeNicknamesListTokens.clear();        
+    HomeNicknamesListPref.clear();        
+    
+    HomeAddressList.clear();
+    HomeAddressListTown.clear();
+    HomeAddressListCounty.clear();
+    HomeAddressListPostCode.clear();
+    HomeAddressListCountry.clear();
+    HomeAddressListLabel.clear();
+    HomeAddressListLang.clear();        
+    HomeAddressListAltID.clear();
+    HomeAddressListPID.clear();
+    HomeAddressListTokens.clear();
+    HomeAddressListGeo.clear();
+    HomeAddressListTimezone.clear();        
+    HomeAddressListType.clear();
+    HomeAddressListMediatype.clear();
+    HomeAddressListPref.clear();
+    
+    HomeEmailList.clear();
+    HomeEmailListAltID.clear();
+    HomeEmailListPID.clear();
+    HomeEmailListType.clear();
+    HomeEmailListTokens.clear();
+    HomeEmailListPref.clear();
+    
+    HomeIMList.clear();
+    HomeIMListAltID.clear();
+    HomeIMListPID.clear();
+    HomeIMListType.clear();
+    HomeIMListTokens.clear();
+    HomeIMListMediatype.clear();
+    HomeIMListPref.clear();
+    
+    HomeTelephoneList.clear();
+    HomeTelephoneListAltID.clear();
+    HomeTelephoneListPID.clear();
+    HomeTelephoneListType.clear();
+    HomeTelephoneListTokens.clear();
+    HomeTelephoneListPref.clear();
+    
+    HomeLanguageList.clear();
+    HomeLanguageListAltID.clear();
+    HomeLanguageListPID.clear();
+    HomeLanguageListType.clear();
+    HomeLanguageListTokens.clear();
+    HomeLanguageListPref.clear();
+    
+    HomeTZList.clear();
+    HomeTZListAltID.clear();
+    HomeTZListPID.clear();
+    HomeTZListType.clear();
+    HomeTZListTokens.clear();
+    HomeTZListMediatype.clear();
+    HomeTZListPref.clear();
+    
+    HomeGeographyList.clear();
+    HomeGeographyListAltID.clear();
+    HomeGeographyListPID.clear();
+    HomeGeographyListType.clear();
+    HomeGeographyListTokens.clear();
+    HomeGeographyListMediatype.clear();
+    HomeGeographyListPref.clear();
+    
+    HomeRelatedList.clear();
+    HomeRelatedListRelType.clear();
+    HomeRelatedListLanguage.clear();
+    HomeRelatedListAltID.clear();
+    HomeRelatedListPID.clear();
+    HomeRelatedListType.clear();
+    HomeRelatedListTokens.clear();
+    HomeRelatedListPref.clear();        
+    
+    HomeWebsiteList.clear();
+    HomeWebsiteListAltID.clear();
+    HomeWebsiteListPID.clear();
+    HomeWebsiteListType.clear();
+    HomeWebsiteListTokens.clear();
+    HomeWebsiteListMediatype.clear();
+    HomeWebsiteListPref.clear();
+    
+    HomeTitleList.clear();
+    HomeTitleListLanguage.clear();
+    HomeTitleListAltID.clear();
+    HomeTitleListPID.clear();
+    HomeTitleListType.clear();
+    HomeTitleListTokens.clear();
+    HomeTitleListPref.clear();
+    
+    HomeRoleList.clear();
+    HomeRoleListLanguage.clear();        
+    HomeRoleListAltID.clear();
+    HomeRoleListPID.clear();
+    HomeRoleListType.clear();
+    HomeRoleListTokens.clear();
+    HomeRoleListPref.clear();
+    
+    HomeOrganisationsList.clear();
+    HomeOrganisationsListLanguage.clear();        
+    HomeOrganisationsListAltID.clear();
+    HomeOrganisationsListPID.clear();
+    HomeOrganisationsListType.clear();
+    HomeOrganisationsListTokens.clear();
+    HomeOrganisationsListSortAs.clear();
+    HomeOrganisationsListPref.clear();
+    
+    HomeNoteList.clear();
+    HomeNoteListLanguage.clear();        
+    HomeNoteListAltID.clear();
+    HomeNoteListPID.clear();
+    HomeNoteListType.clear();
+    HomeNoteListTokens.clear();
+    HomeNoteListPref.clear();        
+    
+    /* Items on the Business tab */
+    
+    BusinessNicknamesList.clear();
+    BusinessNicknamesListType.clear();
+    BusinessNicknamesListLanguage.clear();
+    BusinessNicknamesListAltID.clear();
+    BusinessNicknamesListPID.clear();
+    BusinessNicknamesListTokens.clear();        
+    BusinessNicknamesListPref.clear();        
+    
+    BusinessAddressList.clear();
+    BusinessAddressListTown.clear();
+    BusinessAddressListCounty.clear();
+    BusinessAddressListPostCode.clear();
+    BusinessAddressListCountry.clear();
+    BusinessAddressListLabel.clear();
+    BusinessAddressListLang.clear();        
+    BusinessAddressListAltID.clear();
+    BusinessAddressListPID.clear();
+    BusinessAddressListTokens.clear();
+    BusinessAddressListGeo.clear();
+    BusinessAddressListTimezone.clear();        
+    BusinessAddressListType.clear();
+    BusinessAddressListMediatype.clear();
+    BusinessAddressListPref.clear();
+    
+    BusinessEmailList.clear();
+    BusinessEmailListAltID.clear();
+    BusinessEmailListPID.clear();
+    BusinessEmailListType.clear();
+    BusinessEmailListTokens.clear();
+    BusinessEmailListPref.clear();
+    
+    BusinessIMList.clear();
+    BusinessIMListAltID.clear();
+    BusinessIMListPID.clear();
+    BusinessIMListType.clear();
+    BusinessIMListTokens.clear();
+    BusinessIMListMediatype.clear();
+    BusinessIMListPref.clear();
+    
+    BusinessTelephoneList.clear();
+    BusinessTelephoneListAltID.clear();
+    BusinessTelephoneListPID.clear();
+    BusinessTelephoneListType.clear();
+    BusinessTelephoneListTokens.clear();
+    BusinessTelephoneListPref.clear();
+    
+    BusinessLanguageList.clear();
+    BusinessLanguageListAltID.clear();
+    BusinessLanguageListPID.clear();
+    BusinessLanguageListType.clear();
+    BusinessLanguageListTokens.clear();
+    BusinessLanguageListPref.clear();
+    
+    BusinessTZList.clear();
+    BusinessTZListAltID.clear();
+    BusinessTZListPID.clear();
+    BusinessTZListType.clear();
+    BusinessTZListTokens.clear();
+    BusinessTZListMediatype.clear();
+    BusinessTZListPref.clear();
+    
+    BusinessGeographyList.clear();
+    BusinessGeographyListAltID.clear();
+    BusinessGeographyListPID.clear();
+    BusinessGeographyListType.clear();
+    BusinessGeographyListTokens.clear();
+    BusinessGeographyListMediatype.clear();
+    BusinessGeographyListPref.clear();
+    
+    BusinessRelatedList.clear();
+    BusinessRelatedListRelType.clear();
+    BusinessRelatedListLanguage.clear();
+    BusinessRelatedListAltID.clear();
+    BusinessRelatedListPID.clear();
+    BusinessRelatedListType.clear();
+    BusinessRelatedListTokens.clear();
+    BusinessRelatedListPref.clear();            
+    
+    BusinessWebsiteList.clear();
+    BusinessWebsiteListAltID.clear();
+    BusinessWebsiteListPID.clear();
+    BusinessWebsiteListType.clear();
+    BusinessWebsiteListTokens.clear();
+    BusinessWebsiteListMediatype.clear();
+    BusinessWebsiteListPref.clear();
+    
+    BusinessTitleList.clear();
+    BusinessTitleListLanguage.clear();        
+    BusinessTitleListAltID.clear();
+    BusinessTitleListPID.clear();
+    BusinessTitleListType.clear();
+    BusinessTitleListTokens.clear();
+    BusinessTitleListPref.clear();
+    
+    BusinessRoleList.clear();
+    BusinessRoleListLanguage.clear();        
+    BusinessRoleListAltID.clear();
+    BusinessRoleListPID.clear();
+    BusinessRoleListType.clear();
+    BusinessRoleListTokens.clear();
+    BusinessRoleListPref.clear();
+    
+    BusinessOrganisationsList.clear();
+    BusinessOrganisationsListLanguage.clear();        
+    BusinessOrganisationsListAltID.clear();
+    BusinessOrganisationsListPID.clear();
+    BusinessOrganisationsListType.clear();
+    BusinessOrganisationsListTokens.clear();
+    BusinessOrganisationsListSortAs.clear();        
+    BusinessOrganisationsListPref.clear();
+    
+    BusinessNoteList.clear();
+    BusinessNoteListLanguage.clear();        
+    BusinessNoteListAltID.clear();
+    BusinessNoteListPID.clear();
+    BusinessNoteListType.clear();
+    BusinessNoteListTokens.clear();
+    BusinessNoteListPref.clear();        
+    
+    /* Items on the Categories tab */
+    
+    CategoriesList.clear();
+    CategoriesListAltID.clear();
+    CategoriesListPID.clear();
+    CategoriesListType.clear();
+    CategoriesListTokens.clear();
+    CategoriesListPref.clear();    
+    
+    /* Items on the Groups tab */
+    
+    GroupsList.clear();
+    GroupsListAltID.clear();
+    GroupsListPID.clear();
+    GroupsListType.clear();
+    GroupsListTokens.clear();
+    GroupsListPref.clear();
+    
+    /* Items on the Pictures tab */
+    
+    PicturesList.clear();
+    PicturesListAltID.clear();
+    PicturesListPID.clear();
+    PicturesListType.clear();
+    PicturesListPicEncType.clear();
+    PicturesListPictureType.clear();
+    PicturesListTokens.clear();
+    PicturesListMediatype.clear();        
+    PicturesListPref.clear();
+    
+    /* Items on the Logos tab */
+    
+    LogosList.clear();
+    LogosListAltID.clear();
+    LogosListPID.clear();
+    LogosListType.clear();
+    LogosListPicEncType.clear();        
+    LogosListPictureType.clear();
+    LogosListTokens.clear();
+    LogosListMediatype.clear();        
+    LogosListPref.clear();
+    
+    /* Items on the Sounds tab */
+    
+    SoundsList.clear();
+    SoundsListAltID.clear();
+    SoundsListPID.clear();
+    SoundsListType.clear();
+    SoundsListAudioEncType.clear();        
+    SoundsListAudioType.clear();        
+    SoundsListTokens.clear();
+    SoundsListMediatype.clear();        
+    SoundsListPref.clear();    
+    
+    /* Items on the Calendaring tab */
+    
+    CalendarList.clear();
+    CalendarListAltID.clear();
+    CalendarListPID.clear();
+    CalendarListType.clear();
+    CalendarListTokens.clear();
+    CalendarListMediatype.clear();        
+    CalendarListPref.clear();
+    
+    CalendarRequestList.clear();
+    CalendarRequestListAltID.clear();
+    CalendarRequestListPID.clear();
+    CalendarRequestListType.clear();
+    CalendarRequestListTokens.clear();
+    CalendarRequestListMediatype.clear();        
+    CalendarRequestListPref.clear();        
+    
+    FreeBusyList.clear();
+    FreeBusyListAltID.clear();
+    FreeBusyListPID.clear();
+    FreeBusyListType.clear();
+    FreeBusyListTokens.clear();
+    FreeBusyListMediatype.clear();        
+    FreeBusyListPref.clear();
+    
+    /* Items on the Security tab */
+    
+    KeyList.clear();
+    KeyListAltID.clear();
+    KeyListPID.clear();
+    KeyListKeyType.clear();        
+    KeyListDataType.clear();        
+    KeyListDataEncType.clear();
+    KeyListType.clear();
+    KeyListTokens.clear();
+    KeyListPref.clear();
+    
+    /* Items on the Other tab */
+    
+    VendorList.clear();
+    VendorListPEN.clear();
+    VendorListElement.clear();
+    
+    XTokenList.clear();        
+    XTokenListTokens.clear();
+    
+    wxSContactFilename.Clear();
+    boolContactModified = FALSE;
+    intSeekSelectedData = 0;
+    
+    /* Section for saving/loading data */
+    
+    ETag.Clear();
+    ETagOriginal.Clear();
+    
+    strValue.Clear();
+    strValue2.Clear();
+    strValue3.Clear();
+    
+    boolValue = FALSE;
+    boolValue2 = FALSE;
+    intValue = 0;
+    intValue2 = 0;
+    intValue3 = 0;
+    BinaryDataProc = FALSE;
+    EditMode = TRUE;
+    DialogOpen = FALSE;
+    
+    PictureImage = wxNullBitmap;
+    LogoImage = wxNullBitmap;
+    
+}
diff --git a/source/contacteditor/frmContactEditor-Save.cpp b/source/contacteditor/frmContactEditor-Save.cpp
new file mode 100644 (file)
index 0000000..dd3851c
--- /dev/null
@@ -0,0 +1,2304 @@
+#include "frmContactEditor.h"
+#include "../enums.h"
+#include "../version.h"
+#include "../vcard/vcard.h"
+#include "../vcard/vcard34conv.h"
+#include "../common/textprocessing.h"
+#include "../common/preferences.h"
+#include "../common/uuid.h"
+#include "../common/dirs.h"
+
+void frmContactEditor::SaveContact( wxCommandEvent& event )
+{
+    
+    // Check if Display As combo box has a value in it.
+    // Do not go any further if there is no value.
+    
+    wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
+    
+    if (cmbDisplayAsValue.IsEmpty()){
+        
+        wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
+        return;
+        
+    }
+    
+    // Save the updated contact data.
+    
+    vCard ContactData;
+    wxString FilenameFinal;
+    bool ReplaceContact = FALSE;
+    
+    if (cmbType->GetCurrentSelection() == 1 ||
+        cmbType->GetCurrentSelection() == 3 ||
+        cmbType->GetCurrentSelection() == 4){
+        
+        if (IsGroup == TRUE){
+            
+            // Mark contact for replacing.
+            
+            ReplaceContact = TRUE;
+            
+        }
+        
+    } else if (cmbType->GetCurrentSelection() == 2){
+        
+        if (IsGroup == TRUE){
+            
+            // Mark contact for replacing.
+            
+            ReplaceContact = TRUE;
+            
+        }
+        
+    }
+    
+    if (ReplaceContact == TRUE){
+        
+        wxString wxDelSplitFilename;
+        wxString wxDelFinalFilename;
+        wxString wxSDelDataURL;
+        wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
+        while(wSTDelFilename.HasMoreTokens()){
+            
+            wxDelSplitFilename = wSTDelFilename.GetNextToken();
+            
+        }
+        
+        wxSDelDataURL = wxDelSplitFilename;
+        
+        // Delete the contact from the server as it will be useless in certain
+        // address book clients.
+        
+        ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
+        
+        // Clear the filename so the trigger to recreate the UID is done.
+        
+        wxSContactFilename.Clear();
+        EditMode = FALSE;
+        
+    }
+    
+    if (wxSContactFilename.IsEmpty()){
+        
+        // Generate a random UUID.
+        
+        UIDToken = GenerateUUID();
+        UIDToken = UIDToken.MakeUpper();
+        
+        // Setup the filename.
+        
+        FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
+        
+#if defined(__HAIKU__)
+        
+        //preffilename = wxT("noo");
+        
+#elif defined(__WIN32__)
+        
+        FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
+        FilenameFinal.Append(UIDToken);
+        FilenameFinal.Append(wxT(".vcf"));
+        wxSContactFilename = FilenameFinal;
+        
+#else
+        
+        FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
+        FilenameFinal.Append(UIDToken);
+        FilenameFinal.Append(wxT(".vcf"));
+        wxSContactFilename = FilenameFinal;
+        
+#endif
+        
+    } else {
+        
+        if (UIDToken.IsEmpty()){
+            
+            // UID Token is empty. (Shouldn't be).
+            // Generate a new UID Token.
+            
+            /*boost::uuids::uuid ContactUUID = boost::uuids::random_generator()();
+             std::string sstContactUUID = boost::uuids::to_string(ContactUUID);
+             wxString strContactUUID(sstContactUUID.c_str(), wxConvUTF8);
+             UIDToken = strContactUUID;*/
+            UIDToken = GenerateUUID();
+            UIDToken = UIDToken.MakeUpper();
+            
+        }
+        FilenameFinal = wxSContactFilename;
+        
+    }
+    
+    // Setup the data and write it into the account folder.
+    
+    // Begin preperations to write the contact to a file.
+    
+    bool boolValue = FALSE;
+    bool boolValue2 = FALSE;
+    bool FNFirst = TRUE;
+    bool NNGeneralFirst = TRUE;
+    bool NNHomeFirst = TRUE;
+    bool NNWorkFirst = TRUE;
+    int intFNCount = 0;
+    std::map<int,int>::iterator intiter;
+    std::map<int,wxString>::iterator striter;
+    
+    ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
+    ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
+    
+    // Setup the version string.
+    
+    strValue.Append(wxT("-//Xestia//Address Book Version "));
+    strValue.Append(wxT(XSDAB_VERSION));
+    strValue.Append(wxT("//KW"));
+    
+    ContactData.Add(wxT("PRODID"), strValue, FALSE);
+    
+    // Setup the name.
+    
+    strValue.Clear();
+    
+    // Setup the name field.
+    
+    strValue = txtSurname->GetValue() + wxT(";") +
+    txtForename->GetValue() + wxT(";") +
+    txtOtherNames->GetValue() + wxT(";") +
+    txtTitle->GetValue() + wxT(";") +
+    txtSuffix->GetValue();
+    
+    strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
+    strValue2.Trim();
+    
+    if (NameTokens.IsEmpty()){
+        ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
+    } else {
+        ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + NameTokens, strValue, FALSE);
+    }
+    
+    if (cmbType->GetCurrentSelection() == 1){
+        
+        ContactData.AddRaw(wxT("KIND"), wxT("individual"));
+        
+    } else if (cmbType->GetCurrentSelection() == 2){
+        
+        ContactData.AddRaw(wxT("KIND"), wxT("group"));
+        
+        // Go through each of the members and write them out.
+        
+        for (std::map<int, wxString>::iterator itemiter = GroupsList.begin();
+             itemiter != GroupsList.end(); ++itemiter){
+            
+            ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
+            
+        }
+        
+    } else if (cmbType->GetCurrentSelection() == 3){
+        
+        ContactData.AddRaw(wxT("KIND"), wxT("org"));
+        
+    } else if (cmbType->GetCurrentSelection() == 4){
+        
+        ContactData.AddRaw(wxT("KIND"), wxT("location"));
+        
+    }
+    
+    
+    // Setup the nicknames (General, Home & Business).
+    
+    strValue.Clear();
+    strValue2.Clear();
+    strValue3.Clear();
+    
+    boolValue = FALSE;
+    boolValue2 = FALSE;
+    intValue2 = 0;
+    intValue  = 0;
+    
+    // Setup the gender.
+    
+    if (cmbGender->GetCurrentSelection() != 0){
+        
+        switch(cmbGender->GetCurrentSelection()){
+                
+            case 1:
+                
+                strValue = wxT("M");
+                break;
+                
+            case 2:
+                
+                strValue = wxT("F");
+                break;
+                
+            case 3:
+                
+                strValue = wxT("O");
+                break;
+                
+            case 4:
+                
+                strValue = wxT("N");
+                break;
+                
+            case 5:
+                
+                strValue = wxT("U");
+                break;
+                
+        }
+        
+    }
+    
+    if (!txtGenderDescription->IsEmpty()){
+        
+        strValue2 = txtGenderDescription->GetValue();
+        
+    }
+    
+    if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
+        
+        EscapeString(&strValue2, FALSE);
+        
+        if (!GenderTokens.IsEmpty()){
+            
+            if (!strValue2.IsEmpty()){
+                
+                ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue + wxT(";") + strValue2);
+                
+            } else {
+                
+                ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue);
+                
+            }
+            
+        } else {
+            
+            if (!strValue2.IsEmpty()){
+                
+                ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
+                
+            } else {
+                
+                ContactData.AddRaw(wxT("GENDER"), strValue);
+                
+            }
+            
+        }
+        
+    }
+    
+    strValue.Clear();
+    strValue2.Clear();
+    strValue3.Clear();
+    
+    boolValue = FALSE;
+    boolValue2 = FALSE;
+    intValue2 = 0;
+    intValue  = 0;
+    
+    // Process Label.
+    
+    strValue3 = BirthdayAltID;
+    
+    if (!strValue3.IsEmpty()){
+        
+        strValue3.Trim();
+        strValue3.Trim();
+        boolValue2 = TRUE;
+        strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
+        
+        boolValue = TRUE;
+        
+    }
+    
+    //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
+    //strValue2 =
+    
+    // Process Language.
+    
+    strValue3 = BirthdayCalScale;
+    
+    if (!strValue3.IsEmpty()){
+        
+        strValue3.Trim();
+        strValue3.Trim();
+        
+        if (boolValue2 == TRUE){
+            
+            strValue2.Append(wxT(";"));
+            
+        } else {
+            
+            boolValue2 = TRUE;
+            
+        }
+        
+        strValue2.Append(wxT("CALSCALE=") + strValue3);
+        
+        boolValue = TRUE;
+        
+    }
+    
+    // Process Tokens.
+    
+    strValue2 = BirthdayTokens;
+    
+    // Get the birthday and write it.
+    
+    ResetSaveProcessData();
+    
+    if (!txtBirthday->IsEmpty()){
+        
+        strValue = txtBirthday->GetValue();
+        
+        if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
+            
+            if (!strValue2.IsEmpty()){
+                
+                EscapeString(&strValue2, FALSE);
+                EscapeString(&strValue, FALSE);
+                
+                ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
+                
+            } else {
+                
+                EscapeString(&strValue, FALSE);
+                
+                ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
+                
+            }
+            
+        }
+        
+    } else {
+        
+        // Deal with date.
+        
+        // Get Day, Month & Year.
+        
+        wxDateTime BirthdayDate;
+        wxDateTime::Month BirthdayMonth;
+        int BirthdayDay;
+        int BirthdayYear;
+        wxString DataBeforeT;
+        wxString DataAfterT;
+        wxString FinalBirthdayString;
+        bool ProcessDataAfterT = FALSE;
+        
+        BirthdayDate = dapBirthday->GetValue();
+        
+        if (BirthdayDate.IsValid()){
+            
+            BirthdayDay = BirthdayDate.GetDay();
+            BirthdayMonth = BirthdayDate.GetMonth();
+            BirthdayYear = BirthdayDate.GetYear();
+            
+            // Look for T and replace data before this.
+            
+            wxStringTokenizer wSTDate(Birthday, wxT("T"));
+            
+            while (wSTDate.HasMoreTokens()){
+                
+                if (ProcessDataAfterT == FALSE){
+                    
+                    DataBeforeT = wSTDate.GetNextToken();
+                    ProcessDataAfterT = TRUE;
+                    
+                } else {
+                    
+                    DataAfterT = wSTDate.GetNextToken();
+                    break;
+                    
+                }
+                
+            }
+            
+            // If there is not T then replace altogether.
+            
+            wxString FinalBirthdayDay;
+            wxString FinalBirthdayMonth;
+            wxString FinalBirthdayYear;
+            
+            if (BirthdayDay < 10){
+                
+                FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
+                
+            } else {
+                
+                FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
+                
+            }
+            
+            if (((int)BirthdayMonth + 1) < 10){
+                
+                FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
+                
+            } else {
+                
+                FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
+                
+            }
+            
+            if (BirthdayYear == 0){
+                
+                FinalBirthdayYear = wxT("--");
+                
+            } else {
+                
+                FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
+                
+            }
+            
+            if (!DataAfterT.IsEmpty()){
+                
+                FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
+                
+            } else {
+                
+                FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
+                
+            }
+            
+            if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
+                
+                if (!strValue2.IsEmpty()){
+                    
+                    EscapeString(&strValue2, FALSE);
+                    EscapeString(&strValue, FALSE);
+                    
+                    ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
+                    
+                } else {
+                    
+                    EscapeString(&strValue, FALSE);
+                    
+                    ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
+                    
+                }
+                
+            }
+            
+        }
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    // Process Label.
+    
+    strValue3 = AnniversaryAltID;
+    
+    if (!strValue3.IsEmpty()){
+        
+        strValue3.Trim();
+        strValue3.Trim();
+        boolValue2 = TRUE;
+        strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
+        
+        boolValue = TRUE;
+        
+    }
+    
+    //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
+    //strValue2 =
+    
+    // Process Language.
+    
+    strValue3 = AnniversaryCalScale;
+    
+    if (!strValue3.IsEmpty()){
+        
+        strValue3.Trim();
+        strValue3.Trim();
+        
+        if (boolValue2 == TRUE){
+            
+            strValue2.Append(wxT(";"));
+            
+        } else {
+            
+            boolValue2 = TRUE;
+            
+        }
+        
+        strValue2.Append(wxT("CALSCALE=") + strValue3);
+        
+        boolValue = TRUE;
+        
+    }
+    
+    // Process Tokens.
+    
+    strValue2 = AnniversaryTokens;
+    
+    // Deal with ANNIVERSARY.
+    
+    if (!txtAnniversary->IsEmpty()){
+        
+        strValue = txtAnniversary->GetValue();
+        
+        if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
+            
+            if (!strValue2.IsEmpty()){
+                
+                EscapeString(&strValue2, FALSE);
+                EscapeString(&strValue, FALSE);
+                
+                ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
+                
+            } else {
+                
+                EscapeString(&strValue, FALSE);
+                
+                ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
+                
+            }
+            
+        }
+        
+    } else {
+        
+        // Look for T and replace data before this.
+        
+        // Get Day, Month & Year.
+        
+        wxDateTime AnniversaryDate;
+        wxDateTime::Month AnniversaryMonth;
+        int AnniversaryDay;
+        int AnniversaryYear;
+        wxString DataBeforeT;
+        wxString DataAfterT;
+        wxString FinalAnniversaryString;
+        bool ProcessDataAfterT = FALSE;
+        
+        AnniversaryDate = dapAnniversary->GetValue();
+        
+        if (AnniversaryDate.IsValid()){
+            
+            AnniversaryDay = AnniversaryDate.GetDay();
+            AnniversaryMonth = AnniversaryDate.GetMonth();
+            AnniversaryYear = AnniversaryDate.GetYear();
+            
+            // Look for T and replace data before this.
+            
+            wxStringTokenizer wSTDate(Anniversary, wxT("T"));
+            
+            while (wSTDate.HasMoreTokens()){
+                
+                if (ProcessDataAfterT == FALSE){
+                    
+                    DataBeforeT = wSTDate.GetNextToken();
+                    ProcessDataAfterT = TRUE;
+                    
+                } else {
+                    
+                    DataAfterT = wSTDate.GetNextToken();
+                    break;
+                    
+                }
+                
+            }
+            
+            // If there is not T then replace altogether.
+            
+            wxString FinalAnniversaryDay;
+            wxString FinalAnniversaryMonth;
+            wxString FinalAnniversaryYear;
+            
+            if (AnniversaryDay < 10){
+                
+                FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
+                
+            } else {
+                
+                FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
+                
+            }
+            
+            if (((int)AnniversaryMonth + 1) < 10){
+                
+                FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
+                
+            } else {
+                
+                FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
+                
+            }
+            
+            if (AnniversaryYear == 0){
+                
+                FinalAnniversaryYear = wxT("--");
+                
+            } else {
+                
+                FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
+                
+            }
+            
+            if (!DataAfterT.IsEmpty()){
+                
+                FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
+                
+            } else {
+                
+                FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
+                
+            }
+            
+            if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
+                
+                if (!strValue2.IsEmpty()){
+                    
+                    EscapeString(&strValue2, FALSE);
+                    EscapeString(&strValue, FALSE);
+                    
+                    ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
+                    
+                } else {
+                    
+                    EscapeString(&strValue, FALSE);
+                    
+                    ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
+                    
+                }
+                
+            }
+            
+        }
+        
+    }
+    
+    // Setup the addresses (General, Home, Business).
+    
+    //intValue = GeneralAddressList.size();
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralAddressList.begin();
+         iter != GeneralAddressList.end(); ++iter){
+        
+        int intSeekValue = iter->first;
+        
+        wxString strAddressString;
+        wxString strAddressFinalValue;
+        std::map<int, wxString>::iterator iterValue;
+        
+        strAddressString.Append(wxT(";;"));
+        
+        // Get Address
+        
+        iterValue = GeneralAddressList.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        strAddressFinalValue.Clear();
+        
+        // Get Town
+        
+        iterValue = GeneralAddressListTown.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        strAddressFinalValue.Clear();
+        
+        // Get County
+        
+        iterValue = GeneralAddressListCounty.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        strAddressFinalValue.Clear();
+        
+        // Get Post Code
+        
+        iterValue = GeneralAddressListPostCode.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        strAddressFinalValue.Clear();
+        
+        // Get Country
+        
+        iterValue = GeneralAddressListCountry.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        strAddressString.Append(strAddressFinalValue);
+        strAddressFinalValue.Clear();
+        
+        ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressString, &ContactData,
+                        wxT("LABEL"), &GeneralAddressListLabel,
+                        wxT("LANGUAGE"), &GeneralAddressListLang,
+                        wxT("ALTID"), &GeneralAddressListAltID,
+                        wxT("PID"), &GeneralAddressListPID,
+                        wxT("GEO"), &GeneralAddressListGeo,
+                        wxT("TZ"), &GeneralAddressListTimezone,
+                        wxT("MEDIATYPE"), &GeneralAddressListMediatype,
+                        wxT("PREF"), &GeneralAddressListPref,
+                        wxT(""), &GeneralAddressListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeAddressList.begin();
+         iter != HomeAddressList.end(); ++iter){
+        
+        int intSeekValue = iter->first;
+        
+        wxString strAddressString;
+        wxString strAddressFinalValue;
+        std::map<int, wxString>::iterator iterValue;
+        
+        strAddressString.Append(wxT(";;"));
+        
+        // Get Address
+        
+        iterValue = HomeAddressList.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get Town
+        
+        iterValue = HomeAddressListTown.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get County
+        
+        iterValue = HomeAddressListCounty.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get Post Code
+        
+        iterValue = HomeAddressListPostCode.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get Country
+        
+        iterValue = HomeAddressListCountry.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue);
+        
+        ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressString, &ContactData,
+                        wxT("LABEL"), &HomeAddressListLabel,
+                        wxT("LANGUAGE"), &HomeAddressListLang,
+                        wxT("ALTID"), &HomeAddressListAltID,
+                        wxT("PID"), &HomeAddressListPID,
+                        wxT("GEO"), &HomeAddressListGeo,
+                        wxT("TZ"), &HomeAddressListTimezone,
+                        wxT("MEDIATYPE"), &HomeAddressListMediatype,
+                        wxT("PREF"), &HomeAddressListPref,
+                        wxT(""), &HomeAddressListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessAddressList.begin();
+         iter != BusinessAddressList.end(); ++iter){
+        
+        int intSeekValue = iter->first;
+        
+        wxString strAddressString;
+        wxString strAddressFinalValue;
+        std::map<int, wxString>::iterator iterValue;
+        
+        strAddressString.Append(wxT(";;"));
+        
+        // Get Address
+        
+        iterValue = BusinessAddressList.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get Town
+        
+        iterValue = BusinessAddressListTown.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get County
+        
+        iterValue = BusinessAddressListCounty.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get Post Code
+        
+        iterValue = BusinessAddressListPostCode.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue + wxT(";"));
+        
+        // Get Country
+        
+        iterValue = BusinessAddressListCountry.find(intSeekValue);
+        strAddressFinalValue = iterValue->second;
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressString.Append(strAddressFinalValue);
+        
+        ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressString, &ContactData,
+                        wxT("LABEL"), &BusinessAddressListLabel,
+                        wxT("LANGUAGE"), &BusinessAddressListLang,
+                        wxT("ALTID"), &BusinessAddressListAltID,
+                        wxT("PID"), &BusinessAddressListPID,
+                        wxT("GEO"), &BusinessAddressListGeo,
+                        wxT("TZ"), &BusinessAddressListTimezone,
+                        wxT("MEDIATYPE"), &BusinessAddressListMediatype,
+                        wxT("PREF"), &BusinessAddressListPref,
+                        wxT(""), &BusinessAddressListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    // Sort out nicknames (if any).
+    
+    for (std::map<int,wxString>::iterator iter = GeneralNicknamesList.begin();
+         iter != GeneralNicknamesList.end(); ++iter){
+        
+        intValue2 = iter->first;
+        
+        // Process Alternative ID.
+        
+        ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralNicknamesList, &ContactData,
+                        wxT("LANGUAGE"), &GeneralNicknamesListLanguage,
+                        wxT("ALTID"), &GeneralNicknamesListAltID,
+                        wxT("PID"), &GeneralNicknamesListPID,
+                        wxT("PREF"), &GeneralNicknamesListPref,
+                        wxT(""), &GeneralNicknamesListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeNicknamesList.begin();
+         iter != HomeNicknamesList.end(); ++iter){
+        
+        ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeNicknamesList, &ContactData,
+                        wxT("LANGUAGE"), &HomeNicknamesListLanguage,
+                        wxT("ALTID"), &HomeNicknamesListAltID,
+                        wxT("PID"), &HomeNicknamesListPID,
+                        wxT("PREF"), &HomeNicknamesListPref,
+                        wxT(""), &HomeNicknamesListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessNicknamesList.begin();
+         iter != BusinessNicknamesList.end(); ++iter){
+        
+        ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessNicknamesList, &ContactData,
+                        wxT("LANGUAGE"), &BusinessNicknamesListLanguage,
+                        wxT("ALTID"), &BusinessNicknamesListAltID,
+                        wxT("PID"), &BusinessNicknamesListPID,
+                        wxT("PREF"), &BusinessNicknamesListPref,
+                        wxT(""), &BusinessNicknamesListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    // Sort out email (general, home and business).
+    
+    for (std::map<int,wxString>::iterator iter = GeneralEmailList.begin();
+         iter != GeneralEmailList.end(); ++iter){
+        
+        //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
+        //strValue2 =
+        
+        wxString strAddressFinalValue;
+        std::map<int, wxString>::iterator iterValue;
+        
+        ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralEmailList, &ContactData,
+                        wxT("ALTID"), &GeneralEmailListAltID,
+                        wxT("PID"), &GeneralEmailListPID,
+                        wxT("PREF"), &GeneralEmailListPref,
+                        wxT(""), &GeneralEmailListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeEmailList.begin();
+         iter != HomeEmailList.end(); ++iter){
+        
+        //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
+        //strValue2 =
+        
+        ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeEmailList, &ContactData,
+                        wxT("ALTID"), &HomeEmailListAltID,
+                        wxT("PID"), &HomeEmailListPID,
+                        wxT("PREF"), &HomeEmailListPref,
+                        wxT(""), &HomeEmailListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessEmailList.begin();
+         iter != BusinessEmailList.end(); ++iter){
+        
+        //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
+        //strValue2 =
+        
+        ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessEmailList, &ContactData,
+                        wxT("ALTID"), &BusinessEmailListAltID,
+                        wxT("PID"), &BusinessEmailListPID,
+                        wxT("PREF"), &BusinessEmailListPref,
+                        wxT(""), &BusinessEmailListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralIMList.begin();
+         iter != GeneralIMList.end(); ++iter){
+        
+        intValue2 = iter->first;
+        
+        // Process Alternative ID.
+        
+        ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralIMList, &ContactData,
+                        wxT("ALTID"), &GeneralIMListAltID,
+                        wxT("PID"), &GeneralIMListPID,
+                        wxT("MEDIATYPE"), &GeneralIMListMediatype,
+                        wxT("PREF"), &GeneralIMListPref,
+                        wxT(""), &GeneralIMListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeIMList.begin();
+         iter != HomeIMList.end(); ++iter){
+        
+        ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeIMList, &ContactData,
+                        wxT("ALTID"), &HomeIMListAltID,
+                        wxT("PID"), &HomeIMListPID,
+                        wxT("MEDIATYPE"), &HomeIMListMediatype,
+                        wxT("PREF"), &HomeIMListPref,
+                        wxT(""), &HomeIMListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessIMList.begin();
+         iter != BusinessIMList.end(); ++iter){
+        
+        ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessIMList, &ContactData,
+                        wxT("ALTID"), &BusinessIMListAltID,
+                        wxT("PID"), &BusinessIMListPID,
+                        wxT("MEDIATYPE"), &BusinessIMListMediatype,
+                        wxT("PREF"), &BusinessIMListPref,
+                        wxT(""), &BusinessIMListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralTelephoneList.begin();
+         iter != GeneralTelephoneList.end(); ++iter){
+        
+        wxString strAddressFinalValue = iter->second;
+        
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressFinalValue.insert(0, wxT("tel:"));
+        
+        ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressFinalValue, &ContactData,
+                        wxT("ALTID"), &GeneralTelephoneListAltID,
+                        wxT("PID"), &GeneralTelephoneListPID,
+                        wxT("TYPE"), &GeneralTelephoneListType,
+                        wxT("PREF"), &GeneralTelephoneListPref,
+                        wxT(""), &GeneralTelephoneListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeTelephoneList.begin();
+         iter != HomeTelephoneList.end(); ++iter){
+        
+        wxString strAddressFinalValue = iter->second;
+        
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressFinalValue.insert(0, wxT("tel:"));
+        
+        ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressFinalValue, &ContactData,
+                        wxT("ALTID"), &HomeTelephoneListAltID,
+                        wxT("PID"), &HomeTelephoneListPID,
+                        wxT("TYPE"), &HomeTelephoneListType,
+                        wxT("PREF"), &HomeTelephoneListPref,
+                        wxT(""), &HomeTelephoneListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessTelephoneList.begin();
+         iter != BusinessTelephoneList.end(); ++iter){
+        
+        wxString strAddressFinalValue = iter->second;
+        
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressFinalValue.insert(0, wxT("tel:"));
+        
+        ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressFinalValue, &ContactData,
+                        wxT("ALTID"), &BusinessTelephoneListAltID,
+                        wxT("PID"), &BusinessTelephoneListPID,
+                        wxT("TYPE"), &BusinessTelephoneListType,
+                        wxT("PREF"), &BusinessTelephoneListPref,
+                        wxT(""), &BusinessTelephoneListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralLanguageList.begin();
+         iter != GeneralLanguageList.end(); ++iter){
+        
+        intValue2 = iter->first;
+        
+        ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralLanguageList, &ContactData,
+                        wxT("ALTID"), &GeneralLanguageListAltID,
+                        wxT("PID"), &GeneralLanguageListPID,
+                        wxT("PREF"), &GeneralLanguageListPref,
+                        wxT(""), &GeneralLanguageListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeLanguageList.begin();
+         iter != HomeLanguageList.end(); ++iter){
+        
+        ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeLanguageList, &ContactData,
+                        wxT("ALTID"), &HomeLanguageListAltID,
+                        wxT("PID"), &HomeLanguageListPID,
+                        wxT("PREF"), &HomeLanguageListPref,
+                        wxT(""), &HomeLanguageListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessLanguageList.begin();
+         iter != BusinessLanguageList.end(); ++iter){
+        
+        ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessLanguageList, &ContactData,
+                        wxT("ALTID"), &BusinessLanguageListAltID,
+                        wxT("PID"), &BusinessLanguageListPID,
+                        wxT("PREF"), &BusinessLanguageListPref,
+                        wxT(""), &BusinessLanguageListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralTZList.begin();
+         iter != GeneralTZList.end(); ++iter){
+        
+        ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralTZList, &ContactData,
+                        wxT("ALTID"), &GeneralTZListAltID,
+                        wxT("PID"), &GeneralTZListPID,
+                        wxT("MEDIATYPE"), &GeneralTZListMediatype,
+                        wxT("PREF"), &GeneralTZListPref,
+                        wxT(""), &GeneralTZListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeTZList.begin();
+         iter != HomeTZList.end(); ++iter){
+        
+        ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeTZList, &ContactData,
+                        wxT("ALTID"), &HomeTZListAltID,
+                        wxT("PID"), &HomeTZListPID,
+                        wxT("MEDIATYPE"), &HomeTZListMediatype,
+                        wxT("PREF"), &HomeTZListPref,
+                        wxT(""), &HomeTZListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessTZList.begin();
+         iter != BusinessTZList.end(); ++iter){
+        
+        ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessTZList, &ContactData,
+                        wxT("ALTID"), &BusinessTZListAltID,
+                        wxT("PID"), &BusinessTZListPID,
+                        wxT("MEDIATYPE"), &BusinessTZListMediatype,
+                        wxT("PREF"), &BusinessTZListPref,
+                        wxT(""), &BusinessTZListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralGeographyList.begin();
+         iter != GeneralGeographyList.end(); ++iter){
+        
+        wxString strAddressFinalValue = iter->second;
+        
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressFinalValue.insert(0, wxT("geo:"));
+        
+        ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &strAddressFinalValue, &ContactData,
+                        wxT("ALTID"), &GeneralGeographyListAltID,
+                        wxT("PID"), &GeneralGeographyListPID,
+                        wxT("MEDIATYPE"), &GeneralGeographyListMediatype,
+                        wxT("PREF"), &GeneralGeographyListPref,
+                        wxT(""), &GeneralGeographyListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeGeographyList.begin();
+         iter != HomeGeographyList.end(); ++iter){
+        
+        wxString strAddressFinalValue = iter->second;
+        
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressFinalValue.insert(0, wxT("geo:"));
+        
+        ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeGeographyList, &ContactData,
+                        wxT("ALTID"), &HomeGeographyListAltID,
+                        wxT("PID"), &HomeGeographyListPID,
+                        wxT("MEDIATYPE"), &HomeGeographyListMediatype,
+                        wxT("PREF"), &HomeGeographyListPref,
+                        wxT(""), &HomeGeographyListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessGeographyList.begin();
+         iter != BusinessGeographyList.end(); ++iter){
+        
+        wxString strAddressFinalValue = iter->second;
+        
+        ProcessCaptureStrings(&strAddressFinalValue);
+        
+        strAddressFinalValue.insert(0, wxT("geo:"));
+        
+        ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessGeographyList, &ContactData,
+                        wxT("ALTID"), &BusinessGeographyListAltID,
+                        wxT("PID"), &BusinessGeographyListPID,
+                        wxT("MEDIATYPE"), &BusinessGeographyListMediatype,
+                        wxT("PREF"), &BusinessGeographyListPref,
+                        wxT(""), &BusinessGeographyListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralRelatedList.begin();
+         iter != GeneralRelatedList.end(); ++iter){
+        
+        ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralRelatedList, &ContactData,
+                        wxT("ALTID"), &GeneralRelatedListAltID,
+                        wxT("PID"), &GeneralRelatedListPID,
+                        wxT("LANGUAGE"), &GeneralRelatedListLanguage,
+                        wxT("TYPE"), &GeneralRelatedListRelType,
+                        wxT("PREF"), &GeneralRelatedListPref,
+                        wxT(""), &GeneralRelatedListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralWebsiteList.begin();
+         iter != GeneralWebsiteList.end(); ++iter){
+        
+        ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralWebsiteList, &ContactData,
+                        wxT("ALTID"), &GeneralWebsiteListAltID,
+                        wxT("PID"), &GeneralWebsiteListPID,
+                        wxT("MEDIATYPE"), &GeneralWebsiteListMediatype,
+                        wxT("PREF"), &GeneralWebsiteListPref,
+                        wxT(""), &GeneralWebsiteListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeWebsiteList.begin();
+         iter != HomeWebsiteList.end(); ++iter){
+        
+        ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeWebsiteList, &ContactData,
+                        wxT("ALTID"), &HomeWebsiteListAltID,
+                        wxT("PID"), &HomeWebsiteListPID,
+                        wxT("MEDIATYPE"), &HomeWebsiteListMediatype,
+                        wxT("PREF"), &HomeWebsiteListPref,
+                        wxT(""), &HomeWebsiteListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessWebsiteList.begin();
+         iter != BusinessWebsiteList.end(); ++iter){
+        
+        ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessWebsiteList, &ContactData,
+                        wxT("ALTID"), &BusinessWebsiteListAltID,
+                        wxT("PID"), &BusinessWebsiteListPID,
+                        wxT("MEDIATYPE"), &BusinessWebsiteListMediatype,
+                        wxT("PREF"), &BusinessWebsiteListPref,
+                        wxT(""), &BusinessWebsiteListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralTitleList.begin();
+         iter != GeneralTitleList.end(); ++iter){
+        
+        ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralTitleList, &ContactData,
+                        wxT("ALTID"), &GeneralTitleListAltID,
+                        wxT("PID"), &GeneralTitleListPID,
+                        wxT("LANGUAGE"), &GeneralTitleListLanguage,
+                        wxT("PREF"), &GeneralTitleListPref,
+                        wxT(""), &GeneralTitleListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeTitleList.begin();
+         iter != HomeTitleList.end(); ++iter){
+        
+        ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeTitleList, &ContactData,
+                        wxT("ALTID"), &HomeTitleListAltID,
+                        wxT("PID"), &HomeTitleListPID,
+                        wxT("LANGUAGE"), &HomeTitleListLanguage,
+                        wxT("PREF"), &HomeTitleListPref,
+                        wxT(""), &HomeTitleListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessTitleList.begin();
+         iter != BusinessTitleList.end(); ++iter){
+        
+        ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessTitleList, &ContactData,
+                        wxT("ALTID"), &BusinessTitleListAltID,
+                        wxT("PID"), &BusinessTitleListPID,
+                        wxT("LANGUAGE"), &BusinessTitleListLanguage,
+                        wxT("PREF"), &BusinessTitleListPref,
+                        wxT(""), &BusinessTitleListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralRoleList.begin();
+         iter != GeneralRoleList.end(); ++iter){
+        
+        ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralRoleList, &ContactData,
+                        wxT("ALTID"), &GeneralRoleListAltID,
+                        wxT("PID"), &GeneralRoleListPID,
+                        wxT("LANGUAGE"), &GeneralRoleListLanguage,
+                        wxT("PREF"), &GeneralRoleListPref,
+                        wxT(""), &GeneralRoleListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeRoleList.begin();
+         iter != HomeRoleList.end(); ++iter){
+        
+        ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeRoleList, &ContactData,
+                        wxT("ALTID"), &HomeRoleListAltID,
+                        wxT("PID"), &HomeRoleListPID,
+                        wxT("LANGUAGE"), &HomeRoleListLanguage,
+                        wxT("PREF"), &HomeRoleListPref,
+                        wxT(""), &HomeRoleListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessRoleList.begin();
+         iter != BusinessRoleList.end(); ++iter){
+        
+        ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessRoleList, &ContactData,
+                        wxT("ALTID"), &BusinessRoleListAltID,
+                        wxT("PID"), &BusinessRoleListPID,
+                        wxT("LANGUAGE"), &BusinessRoleListLanguage,
+                        wxT("PREF"), &BusinessRoleListPref,
+                        wxT(""), &BusinessRoleListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralOrganisationsList.begin();
+         iter != GeneralOrganisationsList.end(); ++iter){
+        
+        ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralOrganisationsList, &ContactData,
+                        wxT("ALTID"), &GeneralOrganisationsListAltID,
+                        wxT("PID"), &GeneralOrganisationsListPID,
+                        wxT("LANGUAGE"), &GeneralOrganisationsListLanguage,
+                        wxT("SORT-AS"), &GeneralOrganisationsListSortAs,
+                        wxT("PREF"), &GeneralOrganisationsListPref,
+                        wxT(""), &GeneralOrganisationsListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeOrganisationsList.begin();
+         iter != HomeOrganisationsList.end(); ++iter){
+        
+        ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeOrganisationsList, &ContactData,
+                        wxT("ALTID"), &HomeOrganisationsListAltID,
+                        wxT("PID"), &HomeOrganisationsListPID,
+                        wxT("LANGUAGE"), &HomeOrganisationsListLanguage,
+                        wxT("SORT-AS"), &HomeOrganisationsListSortAs,
+                        wxT("PREF"), &HomeOrganisationsListPref,
+                        wxT(""), &HomeOrganisationsListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessOrganisationsList.begin();
+         iter != BusinessOrganisationsList.end(); ++iter){
+        
+        ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessOrganisationsList, &ContactData,
+                        wxT("ALTID"), &BusinessOrganisationsListAltID,
+                        wxT("PID"), &BusinessOrganisationsListPID,
+                        wxT("LANGUAGE"), &BusinessOrganisationsListLanguage,
+                        wxT("SORT-AS"), &BusinessOrganisationsListSortAs,
+                        wxT("PREF"), &BusinessOrganisationsListPref,
+                        wxT(""), &BusinessOrganisationsListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = GeneralNoteList.begin();
+         iter != GeneralNoteList.end(); ++iter){
+        
+        ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &GeneralNoteList, &ContactData,
+                        wxT("ALTID"), &GeneralNoteListAltID,
+                        wxT("PID"), &GeneralNoteListPID,
+                        wxT("LANGUAGE"), &GeneralNoteListLanguage,
+                        wxT("PREF"), &GeneralNoteListPref,
+                        wxT(""), &GeneralNoteListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = HomeNoteList.begin();
+         iter != HomeNoteList.end(); ++iter){
+        
+        ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &HomeNoteList, &ContactData,
+                        wxT("ALTID"), &HomeNoteListAltID,
+                        wxT("PID"), &HomeNoteListPID,
+                        wxT("LANGUAGE"), &HomeNoteListLanguage,
+                        wxT("PREF"), &HomeNoteListPref,
+                        wxT(""), &HomeNoteListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = BusinessNoteList.begin();
+         iter != BusinessNoteList.end(); ++iter){
+        
+        ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &BusinessNoteList, &ContactData,
+                        wxT("ALTID"), &BusinessNoteListAltID,
+                        wxT("PID"), &BusinessNoteListPID,
+                        wxT("LANGUAGE"), &BusinessNoteListLanguage,
+                        wxT("PREF"), &BusinessNoteListPref,
+                        wxT(""), &BusinessNoteListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = CategoriesList.begin();
+         iter != CategoriesList.end(); ++iter){
+        
+        ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &CategoriesList, &ContactData,
+                        wxT("ALTID"), &CategoriesListAltID,
+                        wxT("PID"), &CategoriesListPID,
+                        wxT("TYPE"), &CategoriesListType,
+                        wxT("PREF"), &CategoriesListPref,
+                        wxT(""), &CategoriesListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    // Pictures.
+    
+    for (std::map<int, std::string>::iterator iter = PicturesList.begin();
+         iter != PicturesList.end(); ++iter){
+        
+        int intValueIndex = iter->first;
+        
+        std::map<int, std::string>::iterator stdstriter;
+        std::map<int, wxString>::iterator enciter;
+        
+        striter = PicturesListPictureType.find(intValueIndex);
+        enciter = PicturesListPicEncType.find(intValueIndex);
+        
+        ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &PicturesList, &striter,
+                        &enciter, &ContactData,
+                        wxT("ALTID"), &PicturesListAltID,
+                        wxT("PID"), &PicturesListPID,
+                        wxT("TYPE"), &PicturesListType,
+                        wxT("PREF"), &PicturesListPref,
+                        wxT(""), &PicturesListTokens);
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    // Logos.
+    
+    for (std::map<int, std::string>::iterator iter = LogosList.begin();
+         iter != LogosList.end(); ++iter){
+        
+        int intValueIndex = iter->first;
+        
+        std::map<int, std::string>::iterator stdstriter;
+        std::map<int, wxString>::iterator enciter;
+        
+        striter = LogosListPictureType.find(intValueIndex);
+        enciter = LogosListPicEncType.find(intValueIndex);
+        
+        ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &LogosList, &striter,
+                        &enciter, &ContactData,
+                        wxT("ALTID"), &LogosListAltID,
+                        wxT("PID"), &LogosListPID,
+                        wxT("TYPE"), &LogosListType,
+                        wxT("PREF"), &LogosListPref,
+                        wxT(""), &LogosListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    // Sounds.
+    
+    for (std::map<int, std::string>::iterator iter = SoundsList.begin();
+         iter != SoundsList.end(); ++iter){
+        
+        int intValueIndex = iter->first;
+        
+        std::map<int, std::string>::iterator stdstriter;
+        std::map<int, wxString>::iterator enciter;
+        
+        striter = SoundsListAudioType.find(intValueIndex);
+        enciter = SoundsListAudioEncType.find(intValueIndex);
+        
+        ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &SoundsList, &striter,
+                        &enciter, &ContactData,
+                        wxT("ALTID"), &SoundsListAltID,
+                        wxT("PID"), &SoundsListPID,
+                        wxT("TYPE"), &SoundsListType,
+                        wxT("PREF"), &SoundsListPref,
+                        wxT(""), &SoundsListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = CalendarList.begin();
+         iter != CalendarList.end(); ++iter){
+        
+        ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &CalendarList, &ContactData,
+                        wxT("ALTID"), &CalendarListAltID,
+                        wxT("PID"), &CalendarListPID,
+                        wxT("MEDIATYPE"), &CalendarListMediatype,
+                        wxT("TYPE"), &CalendarListType,
+                        wxT("PREF"), &CalendarListPref,
+                        wxT(""), &CalendarListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = CalendarRequestList.begin();
+         iter != CalendarRequestList.end(); ++iter){
+        
+        ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &CalendarRequestList, &ContactData,
+                        wxT("ALTID"), &CalendarRequestListAltID,
+                        wxT("PID"), &CalendarRequestListPID,
+                        wxT("MEDIATYPE"), &CalendarRequestListMediatype,
+                        wxT("TYPE"), &CalendarRequestListType,
+                        wxT("PREF"), &CalendarRequestListPref,
+                        wxT(""), &CalendarRequestListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    for (std::map<int,wxString>::iterator iter = FreeBusyList.begin();
+         iter != FreeBusyList.end(); ++iter){
+        
+        ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
+                        &iter, &FreeBusyList, &ContactData,
+                        wxT("ALTID"), &FreeBusyListAltID,
+                        wxT("PID"), &FreeBusyListPID,
+                        wxT("MEDIATYPE"), &FreeBusyListMediatype,
+                        wxT("TYPE"), &FreeBusyListType,
+                        wxT("PREF"), &FreeBusyListPref,
+                        wxT(""), &FreeBusyListTokens );
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    for (std::map<int, wxString>::iterator iter = KeyList.begin();
+         iter != KeyList.end(); ++iter){
+        
+        intValue2 = iter->first;
+        
+        // Process Alternative ID.
+        
+        striter = KeyListAltID.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue3 = striter->second;
+            
+            if (!strValue3.IsEmpty()){
+                
+                strValue3.Trim();
+                strValue3.Trim();
+                
+                if (boolValue2 == TRUE){
+                    
+                    strValue2.Append(wxT(";"));
+                    
+                } else {
+                    
+                    boolValue2 = TRUE;
+                    
+                }
+                
+                strValue2.Append(wxT("ALTID=") + strValue3);
+                
+                boolValue = TRUE;
+                
+            }
+            
+        }
+        
+        // Process PID.
+        
+        striter = KeyListPID.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue3 = striter->second;
+            
+            if (!strValue3.IsEmpty()){
+                
+                strValue3.Trim();
+                strValue3.Trim();
+                
+                if (boolValue2 == TRUE){
+                    
+                    strValue2.Append(wxT(";"));
+                    
+                } else {
+                    
+                    boolValue2 = TRUE;
+                    
+                }
+                
+                strValue2.Append(wxT("PID=") + strValue3);
+                
+                boolValue = TRUE;
+                
+            }
+            
+        }
+        
+        // Process Type.
+        
+        striter = KeyListType.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue3 = striter->second;
+            
+            if (!strValue3.IsEmpty()){
+                
+                strValue3.Trim();
+                strValue3.Trim();
+                
+                if (boolValue2 == TRUE){
+                    
+                    strValue2.Append(wxT(";"));
+                    
+                } else {
+                    
+                    boolValue2 = TRUE;
+                    
+                }
+                
+                strValue2.Append(wxT("TYPE=") + strValue3);
+                
+                boolValue = TRUE;
+                
+            }
+            
+        }
+        
+        intiter = KeyListPref.find(intValue2);
+        
+        if (intiter->first == intValue2){
+            
+            intValue3 = intiter->second;
+            
+            if (intValue3){
+                
+                if (boolValue2 == TRUE){
+                    
+                    strValue2.Append(wxT(";"));
+                    
+                } else {
+                    
+                    boolValue2 = TRUE;
+                    
+                }
+                
+                strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
+                
+                boolValue = TRUE;
+                
+            }
+            
+        }      
+        
+        // Process Tokens.
+        
+        striter = KeyListTokens.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue3 = striter->second;
+            
+            if (!strValue3.IsEmpty()){
+                
+                strValue3.Trim();
+                strValue3.Trim();
+                
+                if (boolValue2 == TRUE){
+                    
+                    strValue2.Append(wxT(";"));
+                    
+                } else {
+                    
+                    boolValue2 = TRUE;
+                    
+                }
+                
+                strValue2.Append(strValue3);
+                
+                boolValue = TRUE;
+                
+            }
+            
+        }      
+        
+        // Get the key information.
+        
+        std::map<int, wxString>::iterator enciter;
+        
+        striter = KeyListDataType.find(intValue2);     
+        //enciter = KeyListAudioEncType.find(intValue2);
+        
+        wxString strValueData;
+        
+        strValueData = iter->second;   
+        //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
+        strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));      
+        
+        
+        // Add to the vCard.
+        
+        if (boolValue == TRUE){
+            
+            ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
+            
+        } else {
+            
+            ContactData.Add(wxT("KEY"), strValueData, TRUE);
+            
+        }
+        
+        ResetSaveProcessData();   
+        
+    }
+    
+    // Vendor specific items.
+    
+    ResetSaveProcessData();   
+    
+    for (std::map<int,wxString>::iterator iter = VendorList.begin();
+         iter != VendorList.end(); ++iter){
+        
+        intValue2 = iter->first;       
+        
+        // Get the IANA PEN number.
+        
+        striter = VendorListPEN.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue2 = striter->second;
+            
+        }
+        
+        // Get the element name.
+        
+        striter = VendorListElement.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue3 = striter->second;
+            
+        }
+        
+        // Get the address.
+        
+        striter = VendorList.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue = striter->second;
+            
+        }
+        
+        // Add to the vCard.
+        
+        if (boolValue == TRUE){
+            
+            ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
+            
+        } else {
+            
+            ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
+            
+        }
+        
+        ResetSaveProcessData();
+        
+    }              
+    
+    ResetSaveProcessData();  
+    
+    // X-Tokens.
+    
+    for (std::map<int,wxString>::iterator iter = XTokenList.begin();
+         iter != XTokenList.end(); ++iter){
+        
+        intValue2 = iter->first;       
+        
+        // Get the element name.
+        
+        striter = XTokenListTokens.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue2 = striter->second;
+            
+        }      
+        
+        // Get the address.
+        
+        striter = XTokenList.find(intValue2);
+        
+        if (striter->first == intValue2){
+            
+            strValue = striter->second;
+            
+        }
+        
+        // Add to the vCard.
+        
+        if (boolValue == TRUE){
+            
+            ContactData.AddRaw(wxT("X-") + strValue2, strValue);
+            
+        } else {
+            
+            ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
+            
+        }
+        
+        ResetSaveProcessData();
+        
+    }
+    
+    ResetSaveProcessData();
+    
+    if (FullNamesList.size() == 0){
+        
+        wxString FullName = cmbDisplayAs->GetValue();
+        FullNamesList.insert(std::make_pair(0, FullName));
+        FullNamesListAltID.insert(std::make_pair(0, wxT("")));
+        FullNamesListPID.insert(std::make_pair(0, wxT("")));
+        FullNamesListType.insert(std::make_pair(0, wxT("")));
+        FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
+        FullNamesListPref.insert(std::make_pair(0, 0));
+        FullNamesListTokens.insert(std::make_pair(0, wxT("")));
+        FNFirst = FALSE;
+        
+    }
+    
+    for (std::map<int, wxString>::iterator iter = FullNamesList.begin();
+         iter != FullNamesList.end(); ++iter){
+        
+        if (FNFirst == TRUE){
+            
+            iter->second = cmbDisplayAs->GetValue();
+            FNFirst = FALSE;
+            
+        }
+        
+        std::map<int,wxString>::iterator mapS;
+        
+        mapS = FullNamesListTokens.find(iter->first);
+        
+        ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue, 
+                        &iter, &FullNamesList, &ContactData,
+                        wxT("ALTID"), &FullNamesListAltID,
+                        wxT("PID"), &FullNamesListPID,
+                        wxT("TYPE"), &FullNamesListType,
+                        wxT("LANGUAGE"), &FullNamesListLanguage,
+                        wxT("PREF"), &FullNamesListPref,
+                        wxT(""), &FullNamesListTokens );
+        
+        // Get the address.
+        
+        ResetSaveProcessData();    
+        
+    }
+    
+    //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
+    
+    // Insert revision (REV) date.
+    
+    // Get today's date and time.
+    
+    wxDateTime DateTimeNow = wxDateTime::Now();
+    
+    wxString DateRev;
+    
+    // Set year, month and date.
+    
+    int intYear = DateTimeNow.GetYear();
+    int intMonth = DateTimeNow.GetMonth();
+    int intDay = DateTimeNow.GetDay();
+    
+    DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
+    
+    if (intMonth < 10){
+        
+        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
+        
+    } else {
+        
+        DateRev.Append(wxString::Format(wxT("%i"), intMonth));
+        
+    }
+    
+    if (intDay < 10){
+        
+        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
+        
+    } else {
+        
+        DateRev.Append(wxString::Format(wxT("%i"), intDay));
+        
+    }
+    
+    //DateRev.Append(wx);
+    //DateRev.Append(wx);
+    //DateRev.Append(wx);
+    DateRev.Append(wxT("T"));
+    
+    // Set hour, minute and second.
+    
+    int intHour = DateTimeNow.GetHour();
+    int intMinute = DateTimeNow.GetMinute();
+    int intSecond = DateTimeNow.GetSecond();
+    
+    if (intHour < 10){
+        
+        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
+        
+    } else {
+        
+        DateRev.Append(wxString::Format(wxT("%i"), intHour));    
+        
+    }
+    
+    if (intMinute < 10){
+        
+        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
+        
+    } else {
+        
+        DateRev.Append(wxString::Format(wxT("%i"), intMinute));
+        
+    }
+    
+    if (intSecond < 10){
+        
+        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
+        
+    } else {
+        
+        DateRev.Append(wxString::Format(wxT("%i"), intSecond));
+        
+    }
+    
+    //   DateRev.Append(wx);
+    //   DateRev.Append(wx);
+    //   DateRev.Append(wxString DateTimeNow->);
+    DateRev.Append(wxT("Z"));    
+    
+    ContactData.Add(wxT("UID"), UIDToken, FALSE);
+    
+    // End the vCard File.
+    
+    ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
+    
+    FMTimer.Stop();
+    ContactData.WriteFile(FilenameFinal);
+    
+    vCard34Conv ConvFileFun;
+    
+    wxString wxSData;
+    
+    ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
+    
+    wxString AccountDirPrefix;
+    wxString AccountDir;
+    wxString PrefDir;
+    
+#if defined(__HAIKU__)
+    
+    //preffilename = wxT("noo");
+
+#elif defined(__APPLE__)
+    
+    PrefDir = GetUserPrefDir();
+    
+    wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
+    
+#elif defined(__WIN32__)
+    
+    PrefDir = GetUserPrefDir();
+    
+    wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
+    
+#else
+    
+    PrefDir = GetUserPrefDir();
+    
+    wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
+    
+#endif
+    
+    XABPreferences PrefData(PrefDir);
+    
+    wxString AccountType;
+    
+    for (int i = 0; i < PrefData.accounts.GetCount(); i++){
+        
+        AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
+        
+        if (AccountDir == wxSContactAccount){
+            
+            AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
+            AccountDirPrefix.Trim();
+            AccountType = PrefData.accounts.GetAccountType(i);
+            break;
+            
+        }
+        
+    }
+    
+    wxString wxSplitFilename;
+    wxString wxSDataURL;
+    
+    while(wSTFilename.HasMoreTokens()){
+        
+        wxSplitFilename = wSTFilename.GetNextToken();
+        
+    }
+    
+    wxSDataURL = wxSplitFilename;
+    //wxSDataURL.Append(wxSplitFilename);
+    
+    // Find out if the filename exists in the table.
+    
+    if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
+        
+        wxString ETagResult;
+        wxString ETagOriginal;
+        
+        ETagDB *ETagDBPtr = NULL;
+        
+        ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
+        
+        wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
+        wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
+        
+        if (wxSETagOrig.IsEmpty()){
+            
+            // Generate the ETag.
+            
+            wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
+            
+        }
+        
+        if (wxSETag.IsEmpty()){
+            
+            // Update empty ETag.
+            
+            wxSETag = wxSETagOrig;
+            ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
+            
+        }
+        else {
+            
+            // Don't change original ETag.
+            
+            wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
+            ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
+            
+        }
+        
+        if (EditMode == FALSE){
+            
+            ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
+            EditMode = TRUE;
+            FMTimer.SetFilename(FilenameFinal);
+            FMTimer.UpdateTimestamp();
+            FMTimer.Start(10000, FALSE);
+           
+           wxCommandEvent reloadevent(RELOADCONTACTLIST);
+           reloadevent.SetString(wxSContactAccount);
+           wxPostEvent(this->GetParent(), reloadevent);
+            
+        }
+        else {
+            
+            ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
+            FMTimer.UpdateTimestamp();
+            FMTimer.Start(10000, FALSE);
+            
+        }
+        
+    }
+    
+    // Send a notification to update the main window
+    // with the new details.
+    
+    UCNotif *ucd;
+    ucd = new UCNotif;
+    
+    // TODO: Workout nickname settings by priority and
+    // type.
+    
+    ucd->ContactAccount = wxSContactAccount;
+    ucd->ContactFilename = FilenameFinal;
+    ucd->ContactName = cmbDisplayAs->GetValue();
+    ucd->ContactNameArray = ContactData.GetName();
+    
+    for (std::map<int,wxString>::iterator gniter = GeneralNicknamesList.begin();
+         gniter != GeneralNicknamesList.end(); gniter++){
+        
+        ucd->ContactNickname = gniter->second;
+        break;
+        
+    }
+    
+    wxCommandEvent event2(CE_UPDATECONTACTLIST);
+    event2.SetClientData(ucd);
+    wxPostEvent(MainPtr, event2);
+    
+}
+
+void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
+{
+    
+    // Save the updated contact data and close the form.
+    
+}
\ No newline at end of file
diff --git a/source/contacteditor/frmContactEditor-Sound.cpp b/source/contacteditor/frmContactEditor-Sound.cpp
new file mode 100644 (file)
index 0000000..094a7cb
--- /dev/null
@@ -0,0 +1,182 @@
+#include "frmContactEditor.h"
+#include "frmContactEditorSound.h"
+#include "../common/base64.h"
+#include <SFML/Audio.hpp>
+#include <thread>
+
+void frmContactEditor::AddSound( wxCommandEvent& event )
+{
+    int intResult = 0;
+    
+    frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
+    frameCESound->SetEditorMode(FALSE);
+    intResult = GetLastInt(&SoundsList);
+    frameCESound->SetupPointers(&SoundsList,
+                                &SoundsListAltID,
+                                &SoundsListPID,
+                                &SoundsListType,
+                                &SoundsListAudioType,
+                                &SoundsListAudioEncType,
+                                &SoundsListTokens,
+                                &SoundsListMediatype,
+                                &SoundsListPref,
+                                lboSounds,
+                                (intValueSeek));
+    frameCESound->ShowModal();
+    delete frameCESound;
+    frameCESound = NULL;
+}
+
+void frmContactEditor::ModifySound( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboSounds,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
+    frameCESound->SetupPointers(&SoundsList,
+                                &SoundsListAltID,
+                                &SoundsListPID,
+                                &SoundsListType,
+                                &SoundsListAudioType,
+                                &SoundsListAudioEncType,
+                                &SoundsListTokens,
+                                &SoundsListMediatype,
+                                &SoundsListPref,
+                                lboSounds,
+                                intSelectedData);
+    frameCESound->SetEditorMode(TRUE);
+    frameCESound->ShowModal();
+    delete frameCESound;
+    frameCESound = NULL;
+}
+
+void frmContactEditor::DeleteSound( wxCommandEvent& event )
+{
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    if (!GetSelectedItem(lboSounds,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    lboSounds->DeleteItem(longSelected);
+    
+    DeleteMapData(intSelectedData, &SoundsList, &SoundsListAltID,
+                  &SoundsListPID, &SoundsListType, &SoundsListAudioType,
+                  &SoundsListAudioEncType, &SoundsListTokens, &SoundsListMediatype,
+                  &SoundsListPref);
+    
+}
+
+void frmContactEditor::PlaySoundDetach()
+{
+    
+    if (!AudioStreamPlayback.openFromMemory(base64dec.c_str(), base64declen)){
+        
+        // Can't load file. We must flee...
+        // Also show an error message too.
+        
+        wxMessageBox(_("This file is in an audio format that is unsupported or is not an audio file."), _("Error opening audio file"), wxICON_ERROR);
+        
+        return;
+        
+    }
+    
+    btnStop->Enable();
+    
+    //AudioStreamPlayback.setbuffer(AudioBuffer);
+    AudioStreamPlayback.play();
+    
+    /*timespec n1, n2;
+     
+     n1.tv_sec = 0;
+     n1.tv_nsec = 100000000L;*/
+    
+    //while (TimeA != TimeB){
+    while (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
+        
+        // We poll this every 100ms in order to conserve CPU usage.
+        
+        SleepFor(100000000);
+        
+    }
+    
+    btnStop->Disable();
+    
+}
+
+void frmContactEditor::PlaySound( wxCommandEvent& event )
+{
+    
+    //sf::Music *AudioPlayback = new sf::Music;
+    //AudioStream *AudioStreamPlayback = new AudioStream;
+    //sf::SoundBuffer *AudioBuffer = new sf::SoundBuffer;
+    
+    //sf::Sound *AudioPlayback = new sf::Sound;
+    
+    //delete(AudioPlayback);
+    
+    //delete(AudioPlayback);
+    //delete(AudioStreamPlayback);
+    //delete(AudioBuffer);
+    
+    //AudioPlayback = NULL;
+    //AudioStreamPlayback = NULL;
+    //AudioBuffer = NULL;
+    
+    //return;
+    
+    long longSelected = -1;
+    int intSelectedData = 0;
+    
+    // Check if sound is still being played and if it is, stop it.
+    
+    if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
+        
+        AudioStreamPlayback.stop();
+        
+    }
+    
+    if (!GetSelectedItem(lboSounds,
+                         &longSelected,
+                         &intSelectedData)){
+        return;
+    }
+    
+    std::map<int, std::string>::iterator initier;
+    
+    initier = SoundsList.find(intSelectedData);
+    
+    base64dec = base64_decode(initier->second);
+    base64declen = base64dec.size();
+    
+    std::thread AudioPlaybackThread(&frmContactEditor::PlaySoundDetach, this);
+    AudioPlaybackThread.detach();
+    
+    return;
+    
+}
+
+void frmContactEditor::StopSound( wxCommandEvent& event )
+{
+    
+    if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
+        
+        AudioStreamPlayback.stop();
+        
+    }
+    
+    btnStop->Disable();
+    
+    return;
+    
+}
+
index 3d2cc28..ca769cb 100644 (file)
@@ -11,8 +11,6 @@
 #include <wx/fs_mem.h>
 #include <wx/datetime.h>
 
-#include <SFML/Audio.hpp>
-
 #include "frmContactEditor.h"
 #include "frmContactEditorNickname.h"
 #include "frmContactEditorAddress.h"
@@ -27,7 +25,6 @@
 #include "frmContactEditorRoles.h"
 #include "frmContactEditorGeoposition.h"
 #include "frmContactEditorGroups.h"
-
 #include "frmContactEditorOrganisations.h"
 #include "frmContactEditorNotes.h"
 #include "frmContactEditorCategory.h"
 #include "../common/uuid.h"
 #include "../common/dirs.h"
 
-#define CE_NICKNAME wxT("Nickname")
-#define CE_ADDRESS wxT("Address")
-#define CE_EMAIL wxT("Email")
-#define CE_IM wxT("IM")
-#define CE_TELEPHONE wxT("Telephone")
-#define CE_LANG wxT("Languages")
-#define CE_TZ wxT("Timezone")
-#define CE_RELATED wxT("Related")
-#define CE_WEBSITE wxT("Websites")
-#define CE_TITLE wxT("Titles")
-#define CE_GEOPOSITION wxT("Geoposition")
-#define CE_ROLE wxT("Roles")
-#define CE_ORG wxT("Organisations")
-#define CE_NOTE wxT("Notes")
-#define CE_CATEGORIES wxT("Categories")
-#define CE_GROUPS wxT("Groups")
-#define CE_PICTURES wxT("Pictures")
-#define CE_SOUNDS wxT("Sounds")
-#define CE_CALENDAR wxT("Calendar")
-#define CE_KEY wxT("Key")
-#define CE_TOKEN wxT("Token")
-
 // TODO: Investigate problems with SFML & PulseAudio - CPU usage problems when
 // not being used.
 
@@ -104,6022 +79,10 @@ frmContactEditorADT( parent )
     btnStop->SetBitmapLabel(stopiconbmp);
     btnStop->Disable();
     FMTimer.SetupPointers(this);
-    //wxIcon contacticon;
-    //contacticon.CopyFromBitmap(contacticonbmp);
-    
-    nbkContact->SetSelection(0);
-    
-}
-
-void frmContactEditor::AddGeneralNickname( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
-    frameCENickname->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralNicknamesList);
-    frameCENickname->SetupPointers(&GeneralNicknamesList,
-                                   &GeneralNicknamesListAltID,
-                                   &GeneralNicknamesListPID,
-                                   &GeneralNicknamesListType,
-                                   &GeneralNicknamesListLanguage,
-                                   &GeneralNicknamesListTokens,
-                                   &GeneralNicknamesListPref,
-                                   lboNicknames,
-                                   (intValueSeek));
-    frameCENickname->ShowModal();
-    delete frameCENickname;
-    frameCENickname = NULL;
-}
-
-void frmContactEditor::ModifyGeneralNickname( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboNicknames,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
-    frameCENickname->SetupPointers(&GeneralNicknamesList,
-                                   &GeneralNicknamesListAltID,
-                                   &GeneralNicknamesListPID,
-                                   &GeneralNicknamesListType,
-                                   &GeneralNicknamesListLanguage,
-                                   &GeneralNicknamesListTokens,
-                                   &GeneralNicknamesListPref,
-                                   lboNicknames,
-                                   intSelectedData);
-    frameCENickname->SetEditorMode(TRUE, CE_GENERAL);
-    frameCENickname->ShowModal();
-    delete frameCENickname;
-    frameCENickname = NULL;
-    
-}
-
-void frmContactEditor::DeleteGeneralNickname( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboNicknames,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboNicknames->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData,
-                  &GeneralNicknamesList,
-                  &GeneralNicknamesListLanguage,
-                  &GeneralNicknamesListAltID,
-                  &GeneralNicknamesListPID,
-                  &GeneralNicknamesListTokens,
-                  &GeneralNicknamesListType,
-                  &GeneralNicknamesListPref);
-    
-}
-
-void frmContactEditor::AddGeneralAddress( wxCommandEvent& event )
-{
-    
-    int intResult = 0;
-    
-    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
-    frameCEAddress->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralAddressList);
-    frameCEAddress->SetupPointers(&GeneralAddressList,
-                                  &GeneralAddressListTown,
-                                  &GeneralAddressListCounty,
-                                  &GeneralAddressListPostCode,
-                                  &GeneralAddressListCountry,
-                                  &GeneralAddressListLabel,
-                                  &GeneralAddressListLang,
-                                  &GeneralAddressListAltID,
-                                  &GeneralAddressListPID,
-                                  &GeneralAddressListTokens,
-                                  &GeneralAddressListGeo,
-                                  &GeneralAddressListTimezone,
-                                  &GeneralAddressListType,
-                                  &GeneralAddressListMediatype,
-                                  &GeneralAddressListPref,
-                                  lboAddresses,
-                                  (intValueSeek));
-    frameCEAddress->ShowModal();
-    delete frameCEAddress;
-    frameCEAddress = NULL;
-}
-
-void frmContactEditor::ModifyGeneralAddress( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    if (longSelected == -1){
-        return;
-    }
-    
-    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
-    frameCEAddress->SetupPointers(&GeneralAddressList,
-                                  &GeneralAddressListTown,
-                                  &GeneralAddressListCounty,
-                                  &GeneralAddressListPostCode,
-                                  &GeneralAddressListCountry,
-                                  &GeneralAddressListLabel,
-                                  &GeneralAddressListLang,
-                                  &GeneralAddressListAltID,
-                                  &GeneralAddressListPID,
-                                  &GeneralAddressListTokens,
-                                  &GeneralAddressListGeo,
-                                  &GeneralAddressListTimezone,
-                                  &GeneralAddressListType,
-                                  &GeneralAddressListMediatype,
-                                  &GeneralAddressListPref,
-                                  lboAddresses,
-                                  intSelectedData);
-    frameCEAddress->SetEditorMode(TRUE, CE_GENERAL);
-    frameCEAddress->ShowModal();
-    delete frameCEAddress;
-    frameCEAddress = NULL;
-    
-}
-
-void frmContactEditor::DeleteGeneralAddress( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboAddresses->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralAddressList,
-                  &GeneralAddressListTown, &GeneralAddressListCounty,
-                  &GeneralAddressListPostCode, &GeneralAddressListCountry,
-                  &GeneralAddressList, &GeneralAddressListLabel,
-                  &GeneralAddressListLang, &GeneralAddressListAltID,
-                  &GeneralAddressListPID, &GeneralAddressListTokens,
-                  &GeneralAddressListGeo, &GeneralAddressListTimezone,
-                  &GeneralAddressListType, &GeneralAddressListMediatype,
-                  &GeneralAddressListPref);
-    
-}
-
-void frmContactEditor::AddGeneralEmail( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
-    frameCEEmail->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralAddressList);
-    frameCEEmail->SetupPointers(&GeneralEmailList,
-                                &GeneralEmailListAltID,
-                                &GeneralEmailListPID,
-                                &GeneralEmailListType,
-                                &GeneralEmailListTokens,
-                                &GeneralEmailListPref,
-                                lboEmails,
-                                (intValueSeek));
-    frameCEEmail->ShowModal();
-    delete frameCEEmail;
-    frameCEEmail = NULL;
-}
-
-void frmContactEditor::ModifyGeneralEmail( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboEmails,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
-    frameCEEmail->SetupPointers(&GeneralEmailList,
-                                &GeneralEmailListAltID,
-                                &GeneralEmailListPID,
-                                &GeneralEmailListType,
-                                &GeneralEmailListTokens,
-                                &GeneralEmailListPref,
-                                lboEmails,
-                                intSelectedData);
-    frameCEEmail->SetEditorMode(TRUE, CE_GENERAL);
-    frameCEEmail->ShowModal();
-    delete frameCEEmail;
-    frameCEEmail = NULL;
-}
-
-void frmContactEditor::DeleteGeneralEmail( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboEmails,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboEmails->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralEmailList,
-                  &GeneralEmailListAltID, &GeneralEmailListPID,
-                  &GeneralEmailListType, &GeneralEmailListTokens,
-                  &GeneralEmailListPref);
-    
-}
-
-void frmContactEditor::AddGeneralIM( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
-    frameCEIM->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralIMList);
-    frameCEIM->SetupPointers(&GeneralIMList,
-                             &GeneralIMListAltID,
-                             &GeneralIMListPID,
-                             &GeneralIMListType,
-                             &GeneralIMListTokens,
-                             &GeneralIMListMediatype,
-                             &GeneralIMListPref,
-                             lboIM,
-                             (intValueSeek));
-    frameCEIM->ShowModal();
-    delete frameCEIM;
-    frameCEIM = NULL;
-}
-
-void frmContactEditor::ModifyGeneralIM( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboIM,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
-    frameCEIM->SetupPointers(&GeneralIMList,
-                             &GeneralIMListAltID,
-                             &GeneralIMListPID,
-                             &GeneralIMListType,
-                             &GeneralIMListTokens,
-                             &GeneralIMListMediatype,
-                             &GeneralIMListPref,
-                             lboIM,
-                             intSelectedData);
-    frameCEIM->SetEditorMode(TRUE, CE_GENERAL);
-    frameCEIM->ShowModal();
-    delete frameCEIM;
-    frameCEIM = NULL;
-}
-
-void frmContactEditor::DeleteGeneralIM( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboIM,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboIM->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralIMList,
-                  &GeneralIMListAltID, &GeneralIMListPID,
-                  &GeneralIMListType, &GeneralIMListTokens,
-                  &GeneralIMListMediatype, &GeneralIMListPref);
-    
-}
-
-void frmContactEditor::AddGeneralTelephone( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
-    frameCETel->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralTelephoneList);
-    frameCETel->SetupPointers(&GeneralTelephoneList,
-                              &GeneralTelephoneListAltID,
-                              &GeneralTelephoneListPID,
-                              &GeneralTelephoneListType,
-                              &GeneralTelephoneListTokens,
-                              &GeneralTelephoneListPref,
-                              lboTelephone,
-                              (intValueSeek));
-    frameCETel->ShowModal();
-    delete frameCETel;
-    frameCETel = NULL;
-}
-
-void frmContactEditor::ModifyGeneralTelephone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboTelephone,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
-    frameCETel->SetupPointers(&GeneralTelephoneList,
-                              &GeneralTelephoneListAltID,
-                              &GeneralTelephoneListPID,
-                              &GeneralTelephoneListType,
-                              &GeneralTelephoneListTokens,
-                              &GeneralTelephoneListPref,
-                              lboTelephone,
-                              intSelectedData);
-    frameCETel->SetEditorMode(TRUE, CE_GENERAL);
-    frameCETel->ShowModal();
-    delete frameCETel;
-    frameCETel = NULL;
-}
-
-void frmContactEditor::DeleteGeneralTelephone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboTelephone,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboTelephone->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralTelephoneList,
-                  &GeneralTelephoneListAltID, &GeneralTelephoneListPID,
-                  &GeneralTelephoneListType, &GeneralTelephoneListTokens,
-                  &GeneralTelephoneListPref);
-    
-}
-
-void frmContactEditor::AddGeneralLanguages( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
-    frameCELang->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralLanguageList);
-    frameCELang->SetupPointers(&GeneralLanguageList,
-                               &GeneralLanguageListAltID,
-                               &GeneralLanguageListPID,
-                               &GeneralLanguageListType,
-                               &GeneralLanguageListTokens,
-                               &GeneralLanguageListPref,
-                               lboLanguages,
-                               (intValueSeek));
-    frameCELang->ShowModal();
-    delete frameCELang;
-    frameCELang = NULL;
-}
-
-void frmContactEditor::ModifyGeneralLanguages( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboLanguages,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
-    frameCELang->SetupPointers(&GeneralLanguageList,
-                               &GeneralLanguageListAltID,
-                               &GeneralLanguageListPID,
-                               &GeneralLanguageListType,
-                               &GeneralLanguageListTokens,
-                               &GeneralLanguageListPref,
-                               lboLanguages,
-                               intSelectedData);
-    frameCELang->SetEditorMode(TRUE, CE_GENERAL);
-    frameCELang->ShowModal();
-    delete frameCELang;
-    frameCELang = NULL;
-}
-
-void frmContactEditor::DeleteGeneralLanguage( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboLanguages,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboLanguages->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralLanguageList,
-                  &GeneralLanguageListAltID, &GeneralLanguageListPID,
-                  &GeneralLanguageListType, &GeneralLanguageListTokens,
-                  &GeneralLanguageListPref);
-    
-}
-
-void frmContactEditor::AddGeneralTimezone( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
-    frameCETZ->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralTZList);
-    frameCETZ->SetupPointers(&GeneralTZList,
-                             &GeneralTZListAltID,
-                             &GeneralTZListPID,
-                             &GeneralTZListType,
-                             &GeneralTZListTokens,
-                             &GeneralTZListMediatype,
-                             &GeneralTZListPref,
-                             lboTimezones,
-                             (intValueSeek));
-    frameCETZ->ShowModal();
-    delete frameCETZ;
-    frameCETZ = NULL;
-}
-
-void frmContactEditor::ModifyGeneralTimezone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboTimezones,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
-    frameCETZ->SetupPointers(&GeneralTZList,
-                             &GeneralTZListAltID,
-                             &GeneralTZListPID,
-                             &GeneralTZListType,
-                             &GeneralTZListTokens,
-                             &GeneralTZListMediatype,
-                             &GeneralTZListPref,
-                             lboTimezones,
-                             intSelectedData);
-    frameCETZ->SetEditorMode(TRUE, CE_GENERAL);
-    frameCETZ->ShowModal();
-    delete frameCETZ;
-    frameCETZ = NULL;
-}
-
-void frmContactEditor::DeleteGeneralTimezone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboTimezones,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboTimezones->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralTZList,
-                  &GeneralTZListAltID, &GeneralTZListPID,
-                  &GeneralTZListType, &GeneralTZListTokens,
-                  &GeneralTZListMediatype, &GeneralTZListPref);
-    
-}
-
-void frmContactEditor::AddGeneralGeoposition( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
-    frameCEGeo->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralGeographyList);
-    frameCEGeo->SetupPointers(&GeneralGeographyList,
-                              &GeneralGeographyListAltID,
-                              &GeneralGeographyListPID,
-                              &GeneralGeographyListType,
-                              &GeneralGeographyListTokens,
-                              &GeneralGeographyListMediatype,
-                              &GeneralGeographyListPref,
-                              lboGeoposition,
-                              (intValueSeek));
-    frameCEGeo->ShowModal();
-    delete frameCEGeo;
-    frameCEGeo = NULL;
-}
-
-void frmContactEditor::ModifyGeneralGeoposition( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboGeoposition,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
-    frameCEGeo->SetupPointers(&GeneralGeographyList,
-                              &GeneralGeographyListAltID,
-                              &GeneralGeographyListPID,
-                              &GeneralGeographyListType,
-                              &GeneralGeographyListTokens,
-                              &GeneralGeographyListMediatype,
-                              &GeneralGeographyListPref,
-                              lboGeoposition,
-                              intSelectedData);
-    frameCEGeo->SetEditorMode(TRUE, CE_GENERAL);
-    frameCEGeo->ShowModal();
-    delete frameCEGeo;
-    frameCEGeo = NULL;
-}
-
-void frmContactEditor::DeleteGeneralGeoposition( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboGeoposition,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboGeoposition->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralGeographyList,
-                  &GeneralGeographyListAltID, &GeneralGeographyListPID,
-                  &GeneralGeographyListType, &GeneralGeographyListTokens,
-                  &GeneralGeographyListMediatype, &GeneralGeographyListPref);
-    
-}
-
-void frmContactEditor::AddGeneralRelated( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorRelated *frameCERel = new frmContactEditorRelated ( this );
-    frameCERel->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralRelatedList);
-    frameCERel->SetupPointers(&GeneralRelatedList,
-                              &GeneralRelatedListRelType,
-                              &GeneralRelatedListAltID,
-                              &GeneralRelatedListPID,
-                              &GeneralRelatedListType,
-                              &GeneralRelatedListTokens,
-                              &GeneralRelatedListPref,
-                              lboRelated,
-                              (intValueSeek));
-    frameCERel->ShowModal();
-    delete frameCERel;
-    frameCERel = NULL;
-}
-
-void frmContactEditor::ModifyGeneralRelated( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboRelated,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorRelated *frameCERel = new frmContactEditorRelated ( this );
-    frameCERel->SetupPointers(&GeneralRelatedList,
-                              &GeneralRelatedListRelType,
-                              &GeneralRelatedListAltID,
-                              &GeneralRelatedListPID,
-                              &GeneralRelatedListType,
-                              &GeneralRelatedListTokens,
-                              &GeneralRelatedListPref,
-                              lboRelated,
-                              intSelectedData);
-    frameCERel->SetEditorMode(TRUE, CE_GENERAL);
-    frameCERel->ShowModal();
-    delete frameCERel;
-    frameCERel = NULL;
-}
-
-void frmContactEditor::DeleteGeneralRelated( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboRelated,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboRelated->DeleteItem(longSelected);
-    
-    GeneralRelatedList.erase(intSelectedData);
-    GeneralRelatedListRelType.erase(intSelectedData);
-    GeneralRelatedListAltID.erase(intSelectedData);
-    GeneralRelatedListPID.erase(intSelectedData);
-    GeneralRelatedListType.erase(intSelectedData);
-    GeneralRelatedListTokens.erase(intSelectedData);
-    GeneralRelatedListPref.erase(intSelectedData);
-}
-
-void frmContactEditor::AddGeneralWebsite( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
-    frameCEWeb->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralWebsiteList);
-    frameCEWeb->SetupPointers(&GeneralWebsiteList,
-                              &GeneralWebsiteListAltID,
-                              &GeneralWebsiteListPID,
-                              &GeneralWebsiteListType,
-                              &GeneralWebsiteListTokens,
-                              &GeneralWebsiteListMediatype,
-                              &GeneralWebsiteListPref,
-                              lboWebsites,
-                              (intValueSeek));
-    frameCEWeb->ShowModal();
-    delete frameCEWeb;
-    frameCEWeb = NULL;
-}
-
-void frmContactEditor::ModifyGeneralWebsite( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboWebsites,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
-    frameCEWeb->SetupPointers(&GeneralWebsiteList,
-                              &GeneralWebsiteListAltID,
-                              &GeneralWebsiteListPID,
-                              &GeneralWebsiteListType,
-                              &GeneralWebsiteListTokens,
-                              &GeneralWebsiteListMediatype,
-                              &GeneralWebsiteListPref,
-                              lboWebsites,
-                              intSelectedData);
-    frameCEWeb->SetEditorMode(TRUE, CE_GENERAL);
-    frameCEWeb->ShowModal();
-    delete frameCEWeb;
-    frameCEWeb = NULL;
-}
-
-void frmContactEditor::DeleteGeneralWebsite( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboWebsites,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboWebsites->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralWebsiteList,
-                  &GeneralWebsiteListAltID, &GeneralWebsiteListPID,
-                  &GeneralWebsiteListType, &GeneralWebsiteListTokens,
-                  &GeneralWebsiteListMediatype, &GeneralWebsiteListPref);
-    
-}
-
-void frmContactEditor::AddGeneralTitle( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
-    frameCETitle->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralTitleList);
-    frameCETitle->SetupPointers(&GeneralTitleList,
-                                &GeneralTitleListLanguage,
-                                &GeneralTitleListAltID,
-                                &GeneralTitleListPID,
-                                &GeneralTitleListType,
-                                &GeneralTitleListTokens,
-                                &GeneralTitleListPref,
-                                lboTitles,
-                                (intValueSeek));
-    frameCETitle->ShowModal();
-    delete frameCETitle;
-    frameCETitle = NULL;
-}
-
-void frmContactEditor::ModifyGeneralTitle( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboTitles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
-    frameCETitle->SetupPointers(&GeneralTitleList,
-                                &GeneralTitleListLanguage,
-                                &GeneralTitleListAltID,
-                                &GeneralTitleListPID,
-                                &GeneralTitleListType,
-                                &GeneralTitleListTokens,
-                                &GeneralTitleListPref,
-                                lboTitles,
-                                intSelectedData);
-    frameCETitle->SetEditorMode(TRUE, CE_GENERAL);
-    frameCETitle->ShowModal();
-    delete frameCETitle;
-    frameCETitle = NULL;
-}
-
-void frmContactEditor::DeleteGeneralTitle( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboTitles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboTitles->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralTitleList,
-                  &GeneralTitleListLanguage, &GeneralTitleListAltID,
-                  &GeneralTitleListPID, &GeneralTitleListType,
-                  &GeneralTitleListTokens, &GeneralTitleListPref);
-    
-}
-
-void frmContactEditor::AddGeneralRole( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
-    frameCERole->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralRoleList);
-    frameCERole->SetupPointers(&GeneralRoleList,
-                               &GeneralRoleListLanguage,
-                               &GeneralRoleListAltID,
-                               &GeneralRoleListPID,
-                               &GeneralRoleListType,
-                               &GeneralRoleListTokens,
-                               &GeneralRoleListPref,
-                               lboRoles,
-                               (intValueSeek));
-    frameCERole->ShowModal();
-    delete frameCERole;
-    frameCERole = NULL;
-}
-
-void frmContactEditor::ModifyGeneralRole( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboRoles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
-    frameCERole->SetupPointers(&GeneralRoleList,
-                               &GeneralRoleListLanguage,
-                               &GeneralRoleListAltID,
-                               &GeneralRoleListPID,
-                               &GeneralRoleListType,
-                               &GeneralRoleListTokens,
-                               &GeneralRoleListPref,
-                               lboRoles,
-                               intSelectedData);
-    frameCERole->SetEditorMode(TRUE, CE_GENERAL);
-    frameCERole->ShowModal();
-    delete frameCERole;
-    frameCERole = NULL;
-}
-
-void frmContactEditor::DeleteGeneralRole( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboRoles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboRoles->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralRoleList,
-                  &GeneralRoleListLanguage, &GeneralRoleListAltID,
-                  &GeneralRoleListPID, &GeneralRoleListType,
-                  &GeneralRoleListTokens, &GeneralRoleListPref);
-    
-}
-
-void frmContactEditor::AddGeneralOrganisation( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
-    frameCEOrg->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralOrganisationsList);
-    frameCEOrg->SetupPointers(&GeneralOrganisationsList,
-                              &GeneralOrganisationsListLanguage,
-                              &GeneralOrganisationsListSortAs,
-                              &GeneralOrganisationsListAltID,
-                              &GeneralOrganisationsListPID,
-                              &GeneralOrganisationsListType,
-                              &GeneralOrganisationsListTokens,
-                              &GeneralOrganisationsListPref,
-                              lboOrganisations,
-                              (intValueSeek));
-    frameCEOrg->ShowModal();
-    delete frameCEOrg;
-    frameCEOrg = NULL;
-}
-
-void frmContactEditor::ModifyGeneralOrganisation( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboOrganisations,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
-    frameCEOrg->SetupPointers(&GeneralOrganisationsList,
-                              &GeneralOrganisationsListLanguage,
-                              &GeneralOrganisationsListSortAs,
-                              &GeneralOrganisationsListAltID,
-                              &GeneralOrganisationsListPID,
-                              &GeneralOrganisationsListType,
-                              &GeneralOrganisationsListTokens,
-                              &GeneralOrganisationsListPref,
-                              lboOrganisations,
-                              intSelectedData);
-    frameCEOrg->SetEditorMode(TRUE, CE_GENERAL);
-    frameCEOrg->ShowModal();
-    delete frameCEOrg;
-    frameCEOrg = NULL;
-}
-
-void frmContactEditor::DeleteGeneralOrganisation( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboOrganisations,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboOrganisations->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralOrganisationsList,
-                  &GeneralOrganisationsListLanguage, &GeneralOrganisationsListSortAs,
-                  &GeneralOrganisationsListAltID, &GeneralOrganisationsListPID,
-                  &GeneralOrganisationsListType, &GeneralOrganisationsListTokens,
-                  &GeneralOrganisationsListPref);
-    
-}
-
-void frmContactEditor::AddGeneralNote( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
-    frameCENote->SetEditorMode(FALSE, CE_GENERAL);
-    intResult = GetLastInt(&GeneralNoteList);
-    frameCENote->SetupPointers(&GeneralNoteList,
-                               &GeneralNoteListLanguage,
-                               &GeneralNoteListAltID,
-                               &GeneralNoteListPID,
-                               &GeneralNoteListType,
-                               &GeneralNoteListTokens,
-                               &GeneralNoteListPref,
-                               lboNotes,
-                               (intValueSeek));
-    frameCENote->ShowModal();
-    delete frameCENote;
-    frameCENote = NULL;
-}
-
-void frmContactEditor::ModifyGeneralNote( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboNotes,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
-    frameCENote->SetupPointers(&GeneralNoteList,
-                               &GeneralNoteListLanguage,
-                               &GeneralNoteListAltID,
-                               &GeneralNoteListPID,
-                               &GeneralNoteListType,
-                               &GeneralNoteListTokens,
-                               &GeneralNoteListPref,
-                               lboNotes,
-                               intSelectedData);
-    frameCENote->SetEditorMode(TRUE, CE_GENERAL);
-    frameCENote->ShowModal();
-    delete frameCENote;
-    frameCENote = NULL;
-}
-
-void frmContactEditor::DeleteGeneralNote( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboNotes,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboNotes->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GeneralNoteList,
-                  &GeneralNoteListLanguage, &GeneralNoteListAltID,
-                  &GeneralNoteListPID, &GeneralNoteListType,
-                  &GeneralNoteListTokens, &GeneralNoteListPref);
-    
-}
-
-void frmContactEditor::AddHomeNickname( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
-    frameCENickname->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeNicknamesList);
-    frameCENickname->SetupPointers(&HomeNicknamesList,
-                                   &HomeNicknamesListAltID,
-                                   &HomeNicknamesListPID,
-                                   &HomeNicknamesListType,
-                                   &HomeNicknamesListLanguage,
-                                   &HomeNicknamesListTokens,
-                                   &HomeNicknamesListPref,
-                                   lboHomeNicknames,
-                                   (intValueSeek));
-    frameCENickname->ShowModal();
-    delete frameCENickname;
-    frameCENickname = NULL;
-}
-
-void frmContactEditor::ModifyHomeNickname( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeNicknames,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
-    frameCENickname->SetupPointers(&HomeNicknamesList,
-                                   &HomeNicknamesListAltID,
-                                   &HomeNicknamesListPID,
-                                   &HomeNicknamesListType,
-                                   &HomeNicknamesListLanguage,
-                                   &HomeNicknamesListTokens,
-                                   &HomeNicknamesListPref,
-                                   lboHomeNicknames,
-                                   intSelectedData);
-    frameCENickname->SetEditorMode(TRUE, CE_HOME);
-    frameCENickname->ShowModal();
-    delete frameCENickname;
-    frameCENickname = NULL;
-}
-
-void frmContactEditor::DeleteHomeNickname( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeNicknames,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeNicknames->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData,
-                  &HomeNicknamesList,
-                  &HomeNicknamesListLanguage,
-                  &HomeNicknamesListAltID,
-                  &HomeNicknamesListPID,
-                  &HomeNicknamesListTokens,
-                  &HomeNicknamesListType,
-                  &HomeNicknamesListPref);
-    
-}
-
-void frmContactEditor::AddHomeAddress( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
-    frameCEAddress->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeAddressList);
-    frameCEAddress->SetupPointers(&HomeAddressList,
-                                  &HomeAddressListTown,
-                                  &HomeAddressListCounty,
-                                  &HomeAddressListPostCode,
-                                  &HomeAddressListCountry,
-                                  &HomeAddressListLabel,
-                                  &HomeAddressListLang,
-                                  &HomeAddressListAltID,
-                                  &HomeAddressListPID,
-                                  &HomeAddressListTokens,
-                                  &HomeAddressListGeo,
-                                  &HomeAddressListTimezone,
-                                  &HomeAddressListType,
-                                  &HomeAddressListMediatype,
-                                  &HomeAddressListPref,
-                                  lboHomeAddresses,
-                                  (intValueSeek));
-    frameCEAddress->ShowModal();
-    delete frameCEAddress;
-    frameCEAddress = NULL;
-}
-
-void frmContactEditor::ModifyHomeAddress( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
-    frameCEAddress->SetupPointers(&HomeAddressList,
-                                  &HomeAddressListTown,
-                                  &HomeAddressListCounty,
-                                  &HomeAddressListPostCode,
-                                  &HomeAddressListCountry,
-                                  &HomeAddressListLabel,
-                                  &HomeAddressListLang,
-                                  &HomeAddressListAltID,
-                                  &HomeAddressListPID,
-                                  &HomeAddressListTokens,
-                                  &HomeAddressListGeo,
-                                  &HomeAddressListTimezone,
-                                  &HomeAddressListType,
-                                  &HomeAddressListMediatype,
-                                  &HomeAddressListPref,
-                                  lboHomeAddresses,
-                                  intSelectedData);
-    frameCEAddress->SetEditorMode(TRUE, CE_HOME);
-    frameCEAddress->ShowModal();
-    delete frameCEAddress;
-    frameCEAddress = NULL;
-}
-
-void frmContactEditor::DeleteHomeAddress( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeAddresses->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeAddressList,
-                  &HomeAddressListTown, &HomeAddressListCounty,
-                  &HomeAddressListPostCode, &HomeAddressListCountry,
-                  &HomeAddressList, &HomeAddressListLabel,
-                  &HomeAddressListLang, &HomeAddressListAltID,
-                  &HomeAddressListPID, &HomeAddressListTokens,
-                  &HomeAddressListGeo, &HomeAddressListTimezone,
-                  &HomeAddressListType, &HomeAddressListMediatype,
-                  &HomeAddressListPref);
-    
-}
-
-void frmContactEditor::AddHomeEmail( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
-    frameCEEmail->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeAddressList);
-    frameCEEmail->SetupPointers(&HomeEmailList,
-                                &HomeEmailListAltID,
-                                &HomeEmailListPID,
-                                &HomeEmailListType,
-                                &HomeEmailListTokens,
-                                &HomeEmailListPref,
-                                lboHomeEmails,
-                                (intValueSeek));
-    frameCEEmail->ShowModal();
-    delete frameCEEmail;
-    frameCEEmail = NULL;
-}
-
-void frmContactEditor::ModifyHomeEmail( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeEmails,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
-    frameCEEmail->SetupPointers(&HomeEmailList,
-                                &HomeEmailListAltID,
-                                &HomeEmailListPID,
-                                &HomeEmailListType,
-                                &HomeEmailListTokens,
-                                &HomeEmailListPref,
-                                lboHomeEmails,
-                                intSelectedData);
-    frameCEEmail->SetEditorMode(TRUE, CE_HOME);
-    frameCEEmail->ShowModal();
-    delete frameCEEmail;
-    frameCEEmail = NULL;
-}
-
-
-void frmContactEditor::DeleteHomeEmail( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeEmails,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeEmails->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeEmailList,
-                  &HomeEmailListAltID, &HomeEmailListPID,
-                  &HomeEmailListType, &HomeEmailListTokens,
-                  &HomeEmailListPref);
-}
-
-
-void frmContactEditor::AddHomeIM( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
-    frameCEIM->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeIMList);
-    frameCEIM->SetupPointers(&HomeIMList,
-                             &HomeIMListAltID,
-                             &HomeIMListPID,
-                             &HomeIMListType,
-                             &HomeIMListTokens,
-                             &HomeIMListMediatype,
-                             &HomeIMListPref,
-                             lboHomeIM,
-                             (intValueSeek));
-    frameCEIM->ShowModal();
-    delete frameCEIM;
-    frameCEIM = NULL;
-}
-
-void frmContactEditor::ModifyHomeIM( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeIM,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
-    frameCEIM->SetupPointers(&HomeIMList,
-                             &HomeIMListAltID,
-                             &HomeIMListPID,
-                             &HomeIMListType,
-                             &HomeIMListTokens,
-                             &HomeIMListMediatype,
-                             &HomeIMListPref,
-                             lboHomeIM,
-                             intSelectedData);
-    frameCEIM->SetEditorMode(TRUE, CE_HOME);
-    frameCEIM->ShowModal();
-    delete frameCEIM;
-    frameCEIM = NULL;
-}
-
-void frmContactEditor::DeleteHomeIM( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeIM,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeIM->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeIMList,
-                  &HomeIMListAltID, &HomeIMListPID,
-                  &HomeIMListType, &HomeIMListTokens,
-                  &HomeIMListMediatype, &HomeIMListPref);
-    
-}
-
-void frmContactEditor::AddHomeTelephone( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
-    frameCETel->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeTelephoneList);
-    frameCETel->SetupPointers(&HomeTelephoneList,
-                              &HomeTelephoneListAltID,
-                              &HomeTelephoneListPID,
-                              &HomeTelephoneListType,
-                              &HomeTelephoneListTokens,
-                              &HomeTelephoneListPref,
-                              lboHomeTelephone,
-                              (intValueSeek));
-    frameCETel->ShowModal();
-    delete frameCETel;
-    frameCETel = NULL;
-}
-
-void frmContactEditor::ModifyHomeTelephone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeTelephone,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
-    frameCETel->SetupPointers(&HomeTelephoneList,
-                              &HomeTelephoneListAltID,
-                              &HomeTelephoneListPID,
-                              &HomeTelephoneListType,
-                              &HomeTelephoneListTokens,
-                              &HomeTelephoneListPref,
-                              lboHomeTelephone,
-                              intSelectedData);
-    frameCETel->SetEditorMode(TRUE, CE_HOME);
-    frameCETel->ShowModal();
-    delete frameCETel;
-    frameCETel = NULL;
-}
-
-void frmContactEditor::DeleteHomeTelephone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeTelephone,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeTelephone->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeTelephoneList,
-                  &HomeTelephoneListAltID, &HomeTelephoneListPID,
-                  &HomeTelephoneListType, &HomeTelephoneListTokens,
-                  &HomeTelephoneListPref);
-    
-}
-
-void frmContactEditor::AddHomeLanguage( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
-    frameCELang->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeLanguageList);
-    frameCELang->SetupPointers(&HomeLanguageList,
-                               &HomeLanguageListAltID,
-                               &HomeLanguageListPID,
-                               &HomeLanguageListType,
-                               &HomeLanguageListTokens,
-                               &HomeLanguageListPref,
-                               lboHomeLanguages,
-                               (intValueSeek));
-    frameCELang->ShowModal();
-    delete frameCELang;
-    frameCELang = NULL;
-}
-
-void frmContactEditor::ModifyHomeLanguage( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeLanguages,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
-    frameCELang->SetupPointers(&HomeLanguageList,
-                               &HomeLanguageListAltID,
-                               &HomeLanguageListPID,
-                               &HomeLanguageListType,
-                               &HomeLanguageListTokens,
-                               &HomeLanguageListPref,
-                               lboHomeLanguages,
-                               intSelectedData);
-    frameCELang->SetEditorMode(TRUE, CE_HOME);
-    frameCELang->ShowModal();
-    delete frameCELang;
-    frameCELang = NULL;
-}
-
-void frmContactEditor::DeleteHomeLanguage( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeLanguages,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeLanguages->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeLanguageList,
-                  &HomeLanguageListAltID, &HomeLanguageListPID,
-                  &HomeLanguageListType, &HomeLanguageListTokens,
-                  &HomeLanguageListPref);
-    
-}
-
-void frmContactEditor::AddHomeTimezone( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
-    frameCETZ->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeTZList);
-    frameCETZ->SetupPointers(&HomeTZList,
-                             &HomeTZListAltID,
-                             &HomeTZListPID,
-                             &HomeTZListType,
-                             &HomeTZListTokens,
-                             &HomeTZListMediatype,
-                             &HomeTZListPref,
-                             lboHomeTimezones,
-                             (intValueSeek));
-    frameCETZ->ShowModal();
-    delete frameCETZ;
-    frameCETZ = NULL;
-}
-
-void frmContactEditor::ModifyHomeTimezone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeTimezones,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
-    frameCETZ->SetupPointers(&HomeTZList,
-                             &HomeTZListAltID,
-                             &HomeTZListPID,
-                             &HomeTZListType,
-                             &HomeTZListTokens,
-                             &HomeTZListMediatype,
-                             &HomeTZListPref,
-                             lboHomeTimezones,
-                             intSelectedData);
-    frameCETZ->SetEditorMode(TRUE, CE_HOME);
-    frameCETZ->ShowModal();
-    delete frameCETZ;
-    frameCETZ = NULL;
-}
-
-void frmContactEditor::DeleteHomeTimezone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeTimezones,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeTimezones->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeTZList,
-                  &HomeTZListAltID, &HomeTZListPID,
-                  &HomeTZListType, &HomeTZListTokens,
-                  &HomeTZListMediatype, &HomeTZListPref);
-    
-}
-
-void frmContactEditor::AddHomeGeoposition( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
-    frameCEGeo->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeGeographyList);
-    frameCEGeo->SetupPointers(&HomeGeographyList,
-                              &HomeGeographyListAltID,
-                              &HomeGeographyListPID,
-                              &HomeGeographyListType,
-                              &HomeGeographyListTokens,
-                              &HomeGeographyListMediatype,
-                              &HomeGeographyListPref,
-                              lboHomeGeoposition,
-                              (intValueSeek));
-    frameCEGeo->ShowModal();
-    delete frameCEGeo;
-    frameCEGeo = NULL;
-}
-
-void frmContactEditor::ModifyHomeGeoposition( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeGeoposition,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
-    frameCEGeo->SetupPointers(&HomeGeographyList,
-                              &HomeGeographyListAltID,
-                              &HomeGeographyListPID,
-                              &HomeGeographyListType,
-                              &HomeGeographyListTokens,
-                              &HomeGeographyListMediatype,
-                              &HomeGeographyListPref,
-                              lboHomeGeoposition,
-                              intSelectedData);
-    frameCEGeo->SetEditorMode(TRUE, CE_HOME);
-    frameCEGeo->ShowModal();
-    delete frameCEGeo;
-    frameCEGeo = NULL;
-}
-
-void frmContactEditor::DeleteHomeGeoposition( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeGeoposition,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeGeoposition->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeGeographyList,
-                  &HomeGeographyListAltID, &HomeGeographyListPID,
-                  &HomeGeographyListType, &HomeGeographyListTokens,
-                  &HomeGeographyListMediatype, &HomeGeographyListPref);
-    
-}
-
-void frmContactEditor::AddHomeWebsite( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
-    frameCEWeb->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeWebsiteList);
-    frameCEWeb->SetupPointers(&HomeWebsiteList,
-                              &HomeWebsiteListAltID,
-                              &HomeWebsiteListPID,
-                              &HomeWebsiteListType,
-                              &HomeWebsiteListTokens,
-                              &HomeWebsiteListMediatype,
-                              &HomeWebsiteListPref,
-                              lboHomeWebsites,
-                              (intValueSeek));
-    frameCEWeb->ShowModal();
-    delete frameCEWeb;
-    frameCEWeb = NULL;
-}
-
-void frmContactEditor::ModifyHomeWebsite( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeWebsites,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
-    frameCEWeb->SetupPointers(&HomeWebsiteList,
-                              &HomeWebsiteListAltID,
-                              &HomeWebsiteListPID,
-                              &HomeWebsiteListType,
-                              &HomeWebsiteListTokens,
-                              &HomeWebsiteListMediatype,
-                              &HomeWebsiteListPref,
-                              lboHomeWebsites,
-                              intSelectedData);
-    frameCEWeb->SetEditorMode(TRUE, CE_HOME);
-    frameCEWeb->ShowModal();
-    delete frameCEWeb;
-    frameCEWeb = NULL;
-}
-
-void frmContactEditor::DeleteHomeWebsite( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeWebsites,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeWebsites->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeWebsiteList,
-                  &HomeWebsiteListAltID, &HomeWebsiteListPID,
-                  &HomeWebsiteListType, &HomeWebsiteListTokens,
-                  &HomeWebsiteListMediatype, &HomeWebsiteListPref);
-    
-}
-
-void frmContactEditor::AddHomeTitle( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
-    frameCETitle->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeTitleList);
-    frameCETitle->SetupPointers(&HomeTitleList,
-                                &HomeTitleListLanguage,
-                                &HomeTitleListAltID,
-                                &HomeTitleListPID,
-                                &HomeTitleListType,
-                                &HomeTitleListTokens,
-                                &HomeTitleListPref,
-                                lboHomeTitles,
-                                (intValueSeek));
-    frameCETitle->ShowModal();
-    delete frameCETitle;
-    frameCETitle = NULL;
-}
-
-void frmContactEditor::ModifyHomeTitle( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeTitles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
-    frameCETitle->SetupPointers(&HomeTitleList,
-                                &HomeTitleListLanguage,
-                                &HomeTitleListAltID,
-                                &HomeTitleListPID,
-                                &HomeTitleListType,
-                                &HomeTitleListTokens,
-                                &HomeTitleListPref,
-                                lboHomeTitles,
-                                intSelectedData);
-    frameCETitle->SetEditorMode(TRUE, CE_HOME);
-    frameCETitle->ShowModal();
-    delete frameCETitle;
-    frameCETitle = NULL;
-}
-
-void frmContactEditor::DeleteHomeTitle( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeTitles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeTitles->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeTitleList,
-                  &HomeTitleListLanguage, &HomeTitleListAltID,
-                  &HomeTitleListPID, &HomeTitleListType,
-                  &HomeTitleListTokens, &HomeTitleListPref);
-    
-}
-
-void frmContactEditor::AddHomeRole( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
-    frameCERole->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeRoleList);
-    frameCERole->SetupPointers(&HomeRoleList,
-                               &HomeRoleListLanguage,
-                               &HomeRoleListAltID,
-                               &HomeRoleListPID,
-                               &HomeRoleListType,
-                               &HomeRoleListTokens,
-                               &HomeRoleListPref,
-                               lboHomeRoles,
-                               (intValueSeek));
-    frameCERole->ShowModal();
-    delete frameCERole;
-    frameCERole = NULL;
-}
-
-void frmContactEditor::ModifyHomeRole( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeRoles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
-    frameCERole->SetupPointers(&HomeRoleList,
-                               &HomeRoleListLanguage,
-                               &HomeRoleListAltID,
-                               &HomeRoleListPID,
-                               &HomeRoleListType,
-                               &HomeRoleListTokens,
-                               &HomeRoleListPref,
-                               lboHomeRoles,
-                               intSelectedData);
-    frameCERole->SetEditorMode(TRUE, CE_HOME);
-    frameCERole->ShowModal();
-    delete frameCERole;
-    frameCERole = NULL;
-}
-
-void frmContactEditor::DeleteHomeRole( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeRoles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeRoles->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeRoleList,
-                  &HomeRoleListLanguage, &HomeRoleListAltID,
-                  &HomeRoleListPID, &HomeRoleListType,
-                  &HomeRoleListTokens, &HomeRoleListPref);
-    
-}
-
-void frmContactEditor::AddHomeOrganisation( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
-    frameCEOrg->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeOrganisationsList);
-    frameCEOrg->SetupPointers(&HomeOrganisationsList,
-                              &HomeOrganisationsListLanguage,
-                              &HomeOrganisationsListSortAs,
-                              &HomeOrganisationsListAltID,
-                              &HomeOrganisationsListPID,
-                              &HomeOrganisationsListType,
-                              &HomeOrganisationsListTokens,
-                              &HomeOrganisationsListPref,
-                              lboHomeOrganisations,
-                              (intValueSeek));
-    frameCEOrg->ShowModal();
-    delete frameCEOrg;
-    frameCEOrg = NULL;
-}
-
-void frmContactEditor::ModifyHomeOrganisation( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeOrganisations,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
-    frameCEOrg->SetupPointers(&HomeOrganisationsList,
-                              &HomeOrganisationsListLanguage,
-                              &HomeOrganisationsListSortAs,
-                              &HomeOrganisationsListAltID,
-                              &HomeOrganisationsListPID,
-                              &HomeOrganisationsListType,
-                              &HomeOrganisationsListTokens,
-                              &HomeOrganisationsListPref,
-                              lboHomeOrganisations,
-                              intSelectedData);
-    frameCEOrg->SetEditorMode(TRUE, CE_HOME);
-    frameCEOrg->ShowModal();
-    delete frameCEOrg;
-    frameCEOrg = NULL;
-}
-
-void frmContactEditor::DeleteHomeOrganisation( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeOrganisations,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboHomeOrganisations->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeOrganisationsList,
-                  &HomeOrganisationsListLanguage, &HomeOrganisationsListSortAs,
-                  &HomeOrganisationsListAltID, &HomeOrganisationsListPID,
-                  &HomeOrganisationsListType, &HomeOrganisationsListTokens,
-                  &HomeOrganisationsListPref);
-    
-}
-
-void frmContactEditor::AddHomeNote( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
-    frameCENote->SetEditorMode(FALSE, CE_HOME);
-    intResult = GetLastInt(&HomeNoteList);
-    frameCENote->SetupPointers(&HomeNoteList,
-                               &HomeNoteListLanguage,
-                               &HomeNoteListAltID,
-                               &HomeNoteListPID,
-                               &HomeNoteListType,
-                               &HomeNoteListTokens,
-                               &HomeNoteListPref,
-                               lboHomeNotes,
-                               (intValueSeek));
-    frameCENote->ShowModal();
-    delete frameCENote;
-    frameCENote = NULL;
-}
-
-void frmContactEditor::ModifyHomeNote( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeNotes,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
-    frameCENote->SetupPointers(&HomeNoteList,
-                               &HomeNoteListLanguage,
-                               &HomeNoteListAltID,
-                               &HomeNoteListPID,
-                               &HomeNoteListType,
-                               &HomeNoteListTokens,
-                               &HomeNoteListPref,
-                               lboHomeNotes,
-                               intSelectedData);
-    frameCENote->SetEditorMode(TRUE, CE_HOME);
-    frameCENote->ShowModal();
-    delete frameCENote;
-    frameCENote = NULL;
-}
-
-void frmContactEditor::DeleteHomeNote( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboHomeNotes,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboNotes->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &HomeNoteList,
-                  &HomeNoteListLanguage, &HomeNoteListAltID,
-                  &HomeNoteListPID, &HomeNoteListType,
-                  &HomeNoteListTokens, &HomeNoteListPref);
-    
-}
-
-void frmContactEditor::AddBusinessNickname( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
-    frameCENickname->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessNicknamesList);
-    frameCENickname->SetupPointers(&BusinessNicknamesList,
-                                   &BusinessNicknamesListAltID,
-                                   &BusinessNicknamesListPID,
-                                   &BusinessNicknamesListType,
-                                   &BusinessNicknamesListLanguage,
-                                   &BusinessNicknamesListTokens,
-                                   &BusinessNicknamesListPref,
-                                   lboBusinessNicknames,
-                                   (intValueSeek));
-    frameCENickname->ShowModal();
-    delete frameCENickname;
-    frameCENickname = NULL;
-}
-
-void frmContactEditor::ModifyBusinessNickname( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessNicknames,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorNickname *frameCENickname = new frmContactEditorNickname ( this );
-    frameCENickname->SetupPointers(&BusinessNicknamesList,
-                                   &BusinessNicknamesListAltID,
-                                   &BusinessNicknamesListPID,
-                                   &BusinessNicknamesListType,
-                                   &BusinessNicknamesListLanguage,
-                                   &BusinessNicknamesListTokens,
-                                   &BusinessNicknamesListPref,
-                                   lboBusinessNicknames,
-                                   intSelectedData);
-    frameCENickname->SetEditorMode(TRUE, CE_WORK);
-    frameCENickname->ShowModal();
-    delete frameCENickname;
-    frameCENickname = NULL;
-}
-
-void frmContactEditor::DeleteBusinessNickname( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessNicknames,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessNicknames->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData,
-                  &BusinessNicknamesList,
-                  &BusinessNicknamesListLanguage,
-                  &BusinessNicknamesListAltID,
-                  &BusinessNicknamesListPID,
-                  &BusinessNicknamesListTokens,
-                  &BusinessNicknamesListType,
-                  &BusinessNicknamesListPref);
-}
-
-void frmContactEditor::AddBusinessAddress( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
-    frameCEAddress->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessAddressList);
-    frameCEAddress->SetupPointers(&BusinessAddressList,
-                                  &BusinessAddressListTown,
-                                  &BusinessAddressListCounty,
-                                  &BusinessAddressListPostCode,
-                                  &BusinessAddressListCountry,
-                                  &BusinessAddressListLabel,
-                                  &BusinessAddressListLang,
-                                  &BusinessAddressListAltID,
-                                  &BusinessAddressListPID,
-                                  &BusinessAddressListTokens,
-                                  &BusinessAddressListGeo,
-                                  &BusinessAddressListTimezone,
-                                  &BusinessAddressListType,
-                                  &BusinessAddressListMediatype,
-                                  &BusinessAddressListPref,
-                                  lboBusinessAddresses,
-                                  (intValueSeek));
-    frameCEAddress->ShowModal();
-    delete frameCEAddress;
-    frameCEAddress = NULL;
-}
-
-void frmContactEditor::ModifyBusinessAddress( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
-    frameCEAddress->SetupPointers(&BusinessAddressList,
-                                  &BusinessAddressListTown,
-                                  &BusinessAddressListCounty,
-                                  &BusinessAddressListPostCode,
-                                  &BusinessAddressListCountry,
-                                  &BusinessAddressListLabel,
-                                  &BusinessAddressListLang,
-                                  &BusinessAddressListAltID,
-                                  &BusinessAddressListPID,
-                                  &BusinessAddressListTokens,
-                                  &BusinessAddressListGeo,
-                                  &BusinessAddressListTimezone,
-                                  &BusinessAddressListType,
-                                  &BusinessAddressListMediatype,
-                                  &BusinessAddressListPref,
-                                  lboBusinessAddresses,
-                                  intSelectedData);
-    frameCEAddress->SetEditorMode(TRUE, CE_WORK);
-    frameCEAddress->ShowModal();
-    delete frameCEAddress;
-    frameCEAddress = NULL;
-}
-
-void frmContactEditor::DeleteBusinessAddress( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessAddresses->DeleteItem(longSelected);
-    DeleteMapData(intSelectedData, &BusinessAddressList,
-                  &BusinessAddressListTown, &BusinessAddressListCounty,
-                  &BusinessAddressListPostCode, &BusinessAddressListCountry,
-                  &BusinessAddressList, &BusinessAddressListLabel,
-                  &BusinessAddressListLang, &BusinessAddressListAltID,
-                  &BusinessAddressListPID, &BusinessAddressListTokens,
-                  &BusinessAddressListGeo, &BusinessAddressListTimezone,
-                  &BusinessAddressListType, &BusinessAddressListMediatype,
-                  &BusinessAddressListPref);
-    
-}
-
-void frmContactEditor::AddBusinessEmail( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
-    frameCEEmail->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessAddressList);
-    frameCEEmail->SetupPointers(&BusinessEmailList,
-                                &BusinessEmailListAltID,
-                                &BusinessEmailListPID,
-                                &BusinessEmailListType,
-                                &BusinessEmailListTokens,
-                                &BusinessEmailListPref,
-                                lboBusinessEmail,
-                                (intValueSeek));
-    frameCEEmail->ShowModal();
-    delete frameCEEmail;
-    frameCEEmail = NULL;
-}
-
-void frmContactEditor::ModifyBusinessEmail( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessEmail,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorEmail *frameCEEmail = new frmContactEditorEmail ( this );
-    frameCEEmail->SetupPointers(&BusinessEmailList,
-                                &BusinessEmailListAltID,
-                                &BusinessEmailListPID,
-                                &BusinessEmailListType,
-                                &BusinessEmailListTokens,
-                                &BusinessEmailListPref,
-                                lboBusinessEmail,
-                                intSelectedData);
-    frameCEEmail->SetEditorMode(TRUE, CE_WORK);
-    frameCEEmail->ShowModal();
-    delete frameCEEmail;
-    frameCEEmail = NULL;
-}
-
-void frmContactEditor::DeleteBusinessEmail( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessEmail,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessEmail->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessEmailList,
-                  &BusinessEmailListAltID, &BusinessEmailListPID,
-                  &BusinessEmailListType, &BusinessEmailListTokens,
-                  &BusinessEmailListPref);
-    
-}
-
-void frmContactEditor::AddBusinessIM( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
-    frameCEIM->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessIMList);
-    frameCEIM->SetupPointers(&BusinessIMList,
-                             &BusinessIMListAltID,
-                             &BusinessIMListPID,
-                             &BusinessIMListType,
-                             &BusinessIMListTokens,
-                             &BusinessIMListMediatype,
-                             &BusinessIMListPref,
-                             lboBusinessIM,
-                             (intValueSeek));
-    frameCEIM->ShowModal();
-    delete frameCEIM;
-    frameCEIM = NULL;
-}
-
-void frmContactEditor::ModifyBusinessIM( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessIM,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorIM *frameCEIM = new frmContactEditorIM ( this );
-    frameCEIM->SetupPointers(&BusinessIMList,
-                             &BusinessIMListAltID,
-                             &BusinessIMListPID,
-                             &BusinessIMListType,
-                             &BusinessIMListTokens,
-                             &BusinessIMListMediatype,
-                             &BusinessIMListPref,
-                             lboBusinessIM,
-                             intSelectedData);
-    frameCEIM->SetEditorMode(TRUE, CE_WORK);
-    frameCEIM->ShowModal();
-    delete frameCEIM;
-    frameCEIM = NULL;
-}
-
-void frmContactEditor::DeleteBusinessIM( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessIM,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessIM->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessIMList,
-                  &BusinessIMListAltID, &BusinessIMListPID,
-                  &BusinessIMListType, &BusinessIMListTokens,
-                  &BusinessIMListMediatype, &BusinessIMListPref);
-    
-}
-
-void frmContactEditor::AddBusinessTelephone( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
-    frameCETel->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessTelephoneList);
-    frameCETel->SetupPointers(&BusinessTelephoneList,
-                              &BusinessTelephoneListAltID,
-                              &BusinessTelephoneListPID,
-                              &BusinessTelephoneListType,
-                              &BusinessTelephoneListTokens,
-                              &BusinessTelephoneListPref,
-                              lboBusinessTelephone,
-                              (intValueSeek));
-    frameCETel->ShowModal();
-    delete frameCETel;
-    frameCETel = NULL;
-}
-
-void frmContactEditor::ModifyBusinessTelephone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessTelephone,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTelephone *frameCETel = new frmContactEditorTelephone ( this );
-    frameCETel->SetupPointers(&BusinessTelephoneList,
-                              &BusinessTelephoneListAltID,
-                              &BusinessTelephoneListPID,
-                              &BusinessTelephoneListType,
-                              &BusinessTelephoneListTokens,
-                              &BusinessTelephoneListPref,
-                              lboBusinessTelephone,
-                              intSelectedData);
-    frameCETel->SetEditorMode(TRUE, CE_WORK);
-    frameCETel->ShowModal();
-    delete frameCETel;
-    frameCETel = NULL;
-}
-
-void frmContactEditor::DeleteBusinessTelephone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessTelephone,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessTelephone->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessTelephoneList,
-                  &BusinessTelephoneListAltID, &BusinessTelephoneListPID,
-                  &BusinessTelephoneListType, &BusinessTelephoneListTokens,
-                  &BusinessTelephoneListPref);
-    
-}
-
-void frmContactEditor::AddBusinessLanguage( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
-    frameCELang->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessLanguageList);
-    frameCELang->SetupPointers(&BusinessLanguageList,
-                               &BusinessLanguageListAltID,
-                               &BusinessLanguageListPID,
-                               &BusinessLanguageListType,
-                               &BusinessLanguageListTokens,
-                               &BusinessLanguageListPref,
-                               lboBusinessLanguages,
-                               (intValueSeek));
-    frameCELang->ShowModal();
-    delete frameCELang;
-    frameCELang = NULL;
-}
-
-void frmContactEditor::ModifyBusinessLanguage( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessLanguages,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorLanguages *frameCELang = new frmContactEditorLanguages ( this );
-    frameCELang->SetupPointers(&BusinessLanguageList,
-                               &BusinessLanguageListAltID,
-                               &BusinessLanguageListPID,
-                               &BusinessLanguageListType,
-                               &BusinessLanguageListTokens,
-                               &BusinessLanguageListPref,
-                               lboBusinessLanguages,
-                               intSelectedData);
-    frameCELang->SetEditorMode(TRUE, CE_WORK);
-    frameCELang->ShowModal();
-    delete frameCELang;
-    frameCELang = NULL;
-}
-
-void frmContactEditor::DeleteBusinessLanguage( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessLanguages,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessLanguages->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessLanguageList,
-                  &BusinessLanguageListAltID, &BusinessLanguageListPID,
-                  &BusinessLanguageListType, &BusinessLanguageListTokens,
-                  &BusinessLanguageListPref);
-    
-}
-
-void frmContactEditor::AddBusinessTimezone( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
-    frameCETZ->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessTZList);
-    frameCETZ->SetupPointers(&BusinessTZList,
-                             &BusinessTZListAltID,
-                             &BusinessTZListPID,
-                             &BusinessTZListType,
-                             &BusinessTZListTokens,
-                             &BusinessTZListMediatype,
-                             &BusinessTZListPref,
-                             lboBusinessTimezones,
-                             (intValueSeek));
-    frameCETZ->ShowModal();
-    delete frameCETZ;
-    frameCETZ = NULL;
-}
-
-void frmContactEditor::ModifyBusinessTimezone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessTimezones,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTimezones *frameCETZ = new frmContactEditorTimezones ( this );
-    frameCETZ->SetupPointers(&BusinessTZList,
-                             &BusinessTZListAltID,
-                             &BusinessTZListPID,
-                             &BusinessTZListType,
-                             &BusinessTZListTokens,
-                             &BusinessTZListMediatype,
-                             &BusinessTZListPref,
-                             lboBusinessTimezones,
-                             intSelectedData);
-    frameCETZ->SetEditorMode(TRUE, CE_WORK);
-    frameCETZ->ShowModal();
-    delete frameCETZ;
-    frameCETZ = NULL;
-}
-
-void frmContactEditor::DeleteBusinessTimezone( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessTimezones,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessTimezones->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessTZList,
-                  &BusinessTZListAltID, &BusinessTZListPID,
-                  &BusinessTZListType, &BusinessTZListTokens,
-                  &BusinessTZListMediatype, &BusinessTZListPref);
-    
-}
-
-void frmContactEditor::AddBusinessGeoposition( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
-    frameCEGeo->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessGeographyList);
-    frameCEGeo->SetupPointers(&BusinessGeographyList,
-                              &BusinessGeographyListAltID,
-                              &BusinessGeographyListPID,
-                              &BusinessGeographyListType,
-                              &BusinessGeographyListTokens,
-                              &BusinessGeographyListMediatype,
-                              &BusinessGeographyListPref,
-                              lboBusinessGeoposition,
-                              (intValueSeek));
-    frameCEGeo->ShowModal();
-    delete frameCEGeo;
-    frameCEGeo = NULL;
-}
-
-void frmContactEditor::ModifyBusinessGeoposition( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessGeoposition,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorGeoposition *frameCEGeo = new frmContactEditorGeoposition ( this );
-    frameCEGeo->SetupPointers(&BusinessGeographyList,
-                              &BusinessGeographyListAltID,
-                              &BusinessGeographyListPID,
-                              &BusinessGeographyListType,
-                              &BusinessGeographyListTokens,
-                              &BusinessGeographyListMediatype,
-                              &BusinessGeographyListPref,
-                              lboBusinessGeoposition,
-                              intSelectedData);
-    frameCEGeo->SetEditorMode(TRUE, CE_WORK);
-    frameCEGeo->ShowModal();
-    delete frameCEGeo;
-    frameCEGeo = NULL;
-}
-
-void frmContactEditor::DeleteBusinessGeoposition( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessGeoposition,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessGeoposition->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessGeographyList,
-                  &BusinessGeographyListAltID, &BusinessGeographyListPID,
-                  &BusinessGeographyListType, &BusinessGeographyListTokens,
-                  &BusinessGeographyListMediatype, &BusinessGeographyListPref);
-    
-}
-
-void frmContactEditor::AddBusinessWebsite( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
-    frameCEWeb->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessWebsiteList);
-    frameCEWeb->SetupPointers(&BusinessWebsiteList,
-                              &BusinessWebsiteListAltID,
-                              &BusinessWebsiteListPID,
-                              &BusinessWebsiteListType,
-                              &BusinessWebsiteListTokens,
-                              &BusinessWebsiteListMediatype,
-                              &BusinessWebsiteListPref,
-                              lboBusinessWebsites,
-                              (intValueSeek));
-    frameCEWeb->ShowModal();
-    delete frameCEWeb;
-    frameCEWeb = NULL;
-}
-
-void frmContactEditor::ModifyBusinessWebsite( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessWebsites,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorWebsites *frameCEWeb = new frmContactEditorWebsites ( this );
-    frameCEWeb->SetupPointers(&BusinessWebsiteList,
-                              &BusinessWebsiteListAltID,
-                              &BusinessWebsiteListPID,
-                              &BusinessWebsiteListType,
-                              &BusinessWebsiteListTokens,
-                              &BusinessWebsiteListMediatype,
-                              &BusinessWebsiteListPref,
-                              lboBusinessWebsites,
-                              intSelectedData);
-    frameCEWeb->SetEditorMode(TRUE, CE_WORK);
-    frameCEWeb->ShowModal();
-    delete frameCEWeb;
-    frameCEWeb = NULL;
-}
-
-void frmContactEditor::DeleteBusinessWebsite( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessWebsites,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessWebsites->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessWebsiteList,
-                  &BusinessWebsiteListAltID, &BusinessWebsiteListPID,
-                  &BusinessWebsiteListType, &BusinessWebsiteListTokens,
-                  &BusinessWebsiteListMediatype, &BusinessWebsiteListPref);
-    
-}
-
-void frmContactEditor::AddBusinessTitle( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
-    frameCETitle->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessTitleList);
-    frameCETitle->SetupPointers(&BusinessTitleList,
-                                &BusinessTitleListLanguage,
-                                &BusinessTitleListAltID,
-                                &BusinessTitleListPID,
-                                &BusinessTitleListType,
-                                &BusinessTitleListTokens,
-                                &BusinessTitleListPref,
-                                lboBusinessTitles,
-                                (intValueSeek));
-    frameCETitle->ShowModal();
-    delete frameCETitle;
-    frameCETitle = NULL;
-}
-
-void frmContactEditor::ModifyBusinessTitle( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessTitles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorTitles *frameCETitle = new frmContactEditorTitles ( this );
-    frameCETitle->SetupPointers(&BusinessTitleList,
-                                &BusinessTitleListLanguage,
-                                &BusinessTitleListAltID,
-                                &BusinessTitleListPID,
-                                &BusinessTitleListType,
-                                &BusinessTitleListTokens,
-                                &BusinessTitleListPref,
-                                lboBusinessTitles,
-                                intSelectedData);
-    frameCETitle->SetEditorMode(TRUE, CE_WORK);
-    frameCETitle->ShowModal();
-    delete frameCETitle;
-    frameCETitle = NULL;
-}
-
-void frmContactEditor::DeleteBusinessTitle( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessTitles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboTitles->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessTitleList,
-                  &BusinessTitleListLanguage, &BusinessTitleListAltID,
-                  &BusinessTitleListPID, &BusinessTitleListType,
-                  &BusinessTitleListTokens, &BusinessTitleListPref);
-    
-}
-
-void frmContactEditor::AddBusinessRole( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
-    frameCERole->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessRoleList);
-    frameCERole->SetupPointers(&BusinessRoleList,
-                               &BusinessRoleListLanguage,
-                               &BusinessRoleListAltID,
-                               &BusinessRoleListPID,
-                               &BusinessRoleListType,
-                               &BusinessRoleListTokens,
-                               &BusinessRoleListPref,
-                               lboBusinessRoles,
-                               (intValueSeek));
-    frameCERole->ShowModal();
-    delete frameCERole;
-    frameCERole = NULL;
-}
-
-void frmContactEditor::ModifyBusinessRole( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessRoles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorRoles *frameCERole = new frmContactEditorRoles ( this );
-    frameCERole->SetupPointers(&BusinessRoleList,
-                               &BusinessRoleListLanguage,
-                               &BusinessRoleListAltID,
-                               &BusinessRoleListPID,
-                               &BusinessRoleListType,
-                               &BusinessRoleListTokens,
-                               &BusinessRoleListPref,
-                               lboBusinessRoles,
-                               intSelectedData);
-    frameCERole->SetEditorMode(TRUE, CE_WORK);
-    frameCERole->ShowModal();
-    delete frameCERole;
-    frameCERole = NULL;
-}
-
-void frmContactEditor::DeleteBusinessRole( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessRoles,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessRoles->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessRoleList,
-                  &BusinessRoleListLanguage, &BusinessRoleListAltID,
-                  &BusinessRoleListPID, &BusinessRoleListType,
-                  &BusinessRoleListTokens, &BusinessRoleListPref);
-    
-}
-
-void frmContactEditor::AddBusinessOrganisation( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
-    frameCEOrg->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&GeneralOrganisationsList);
-    frameCEOrg->SetupPointers(&GeneralOrganisationsList,
-                              &BusinessOrganisationsListLanguage,
-                              &BusinessOrganisationsListSortAs,
-                              &BusinessOrganisationsListAltID,
-                              &BusinessOrganisationsListPID,
-                              &BusinessOrganisationsListType,
-                              &BusinessOrganisationsListTokens,
-                              &BusinessOrganisationsListPref,
-                              lboBusinessOrganisations,
-                              (intValueSeek));
-    frameCEOrg->ShowModal();
-    delete frameCEOrg;
-    frameCEOrg = NULL;
-}
-
-void frmContactEditor::ModifyBusinessOrganisation( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessOrganisations,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorOrganisations *frameCEOrg = new frmContactEditorOrganisations ( this );
-    frameCEOrg->SetupPointers(&BusinessOrganisationsList,
-                              &BusinessOrganisationsListLanguage,
-                              &BusinessOrganisationsListSortAs,
-                              &BusinessOrganisationsListAltID,
-                              &BusinessOrganisationsListPID,
-                              &BusinessOrganisationsListType,
-                              &BusinessOrganisationsListTokens,
-                              &BusinessOrganisationsListPref,
-                              lboBusinessOrganisations,
-                              intSelectedData);
-    frameCEOrg->SetEditorMode(TRUE, CE_WORK);
-    frameCEOrg->ShowModal();
-    delete frameCEOrg;
-    frameCEOrg = NULL;
-}
-
-void frmContactEditor::DeleteBusinessOrganisation( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessOrganisations,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessOrganisations->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessOrganisationsList,
-                  &BusinessOrganisationsListLanguage, &BusinessOrganisationsListSortAs,
-                  &BusinessOrganisationsListAltID, &BusinessOrganisationsListPID,
-                  &BusinessOrganisationsListType, &BusinessOrganisationsListTokens,
-                  &BusinessOrganisationsListPref);
-    
-}
-
-void frmContactEditor::AddBusinessNote( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
-    frameCENote->SetEditorMode(FALSE, CE_WORK);
-    intResult = GetLastInt(&BusinessNoteList);
-    frameCENote->SetupPointers(&BusinessNoteList,
-                               &BusinessNoteListLanguage,
-                               &BusinessNoteListAltID,
-                               &BusinessNoteListPID,
-                               &BusinessNoteListType,
-                               &BusinessNoteListTokens,
-                               &BusinessNoteListPref,
-                               lboBusinessNotes,
-                               (intValueSeek));
-    frameCENote->ShowModal();
-    delete frameCENote;
-    frameCENote = NULL;
-}
-
-void frmContactEditor::ModifyBusinessNote( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessNotes,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorNotes *frameCENote = new frmContactEditorNotes ( this );
-    frameCENote->SetupPointers(&BusinessNoteList,
-                               &BusinessNoteListLanguage,
-                               &BusinessNoteListAltID,
-                               &BusinessNoteListPID,
-                               &BusinessNoteListType,
-                               &BusinessNoteListTokens,
-                               &BusinessNoteListPref,
-                               lboBusinessNotes,
-                               intSelectedData);
-    frameCENote->SetEditorMode(TRUE, CE_WORK);
-    frameCENote->ShowModal();
-    delete frameCENote;
-    frameCENote = NULL;
-}
-
-void frmContactEditor::DeleteBusinessNote( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboBusinessNotes,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboBusinessNotes->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &BusinessNoteList,
-                  &BusinessNoteListLanguage, &BusinessNoteListAltID,
-                  &BusinessNoteListPID, &BusinessNoteListType,
-                  &BusinessNoteListTokens, &BusinessNoteListPref);
-    
-}
-
-void frmContactEditor::AddCategory( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
-    frameCECategory->SetEditorMode(FALSE);
-    intResult = GetLastInt(&CategoriesList);
-    frameCECategory->SetupPointers(&CategoriesList,
-                                   &CategoriesListAltID,
-                                   &CategoriesListPID,
-                                   &CategoriesListType,
-                                   &CategoriesListTokens,
-                                   &CategoriesListPref,
-                                   lboCategories,
-                                   (intValueSeek));
-    frameCECategory->ShowModal();
-    delete frameCECategory;
-    frameCECategory = NULL;
-}
-
-void frmContactEditor::ModifyCategory( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboCategories,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
-    frameCECategory->SetupPointers(&CategoriesList,
-                                   &CategoriesListAltID,
-                                   &CategoriesListPID,
-                                   &CategoriesListType,
-                                   &CategoriesListTokens,
-                                   &CategoriesListPref,
-                                   lboCategories,
-                                   intSelectedData);
-    frameCECategory->SetEditorMode(TRUE);
-    frameCECategory->ShowModal();
-    delete frameCECategory;
-    frameCECategory = NULL;
-}
-
-void frmContactEditor::DeleteCategory( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboCategories,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboCategories->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &CategoriesList,
-                  &CategoriesListAltID, &CategoriesListPID,
-                  &CategoriesListType, &CategoriesListTokens,
-                  &CategoriesListPref);
-    
-}
-
-void frmContactEditor::AddGroup( wxCommandEvent& event )
-{
-    
-    int intResult = 0;
-    
-    XABViewMode XVMData = MainPtr->GetViewMode();
-    
-    frmContactEditorGroup *frameCEGroup = new frmContactEditorGroup ( this );
-    frameCEGroup->SetEditorMode(FALSE, XVMData);
-    intResult = GetLastInt(&GroupsList);
-    frameCEGroup->SetupPointers(&GroupsList,
-                                lboGroups,
-                                wxSContactAccount,
-                                intValueSeek);
-    frameCEGroup->ShowModal();
-    delete frameCEGroup;
-    frameCEGroup = NULL;
-    
-}
-
-void frmContactEditor::ModifyGroup( wxCommandEvent& event )
-{
-    
-    return;
-    
-}
-
-void frmContactEditor::DeleteGroup( wxCommandEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboGroups,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboGroups->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &GroupsList);
-    
-}
-
-void frmContactEditor::AddPicture( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this );
-    frameCEPicture->SetEditorMode(FALSE);
-    intResult = GetLastInt(&PicturesList);
-    frameCEPicture->SetupPointers(&PicturesList,
-                                  &PicturesListAltID,
-                                  &PicturesListPID,
-                                  &PicturesListType,
-                                  &PicturesListPicEncType,
-                                  &PicturesListPictureType,
-                                  &PicturesListTokens,
-                                  &PicturesListMediatype,
-                                  &PicturesListPref,
-                                  lboPictures,
-                                  (intValueSeek));
-    frameCEPicture->ShowModal();
-    delete frameCEPicture;
-    frameCEPicture = NULL;
-}
-
-void frmContactEditor::ModifyPicture( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboPictures,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this );
-    frameCEPicture->SetupPointers(&PicturesList,
-                                  &PicturesListAltID,
-                                  &PicturesListPID,
-                                  &PicturesListType,
-                                  &PicturesListPicEncType,
-                                  &PicturesListPictureType,
-                                  &PicturesListTokens,
-                                  &PicturesListMediatype,
-                                  &PicturesListPref,
-                                  lboPictures,
-                                  intSelectedData);
-    frameCEPicture->SetEditorMode(TRUE);
-    frameCEPicture->ShowModal();
-    delete frameCEPicture;
-    frameCEPicture = NULL;
-    
-}
-
-void frmContactEditor::DeletePicture( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboPictures,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboPictures->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData,
-                  &PicturesList, &PicturesListAltID, &PicturesListPID, &PicturesListType,
-                  &PicturesListPicEncType, &PicturesListPictureType, &PicturesListTokens,
-                  &PicturesListMediatype, &PicturesListPref);
-    
-    wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
-    wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
-    PictureImage = (wxBitmap)misc_emptyimage_png;
-    
-    imgPicture->SetBitmap(PictureImage);
-}
-
-void frmContactEditor::LoadPicture( wxListEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboPictures,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    std::string base64dec;
-    
-    std::map<int,std::string>::iterator initier;
-    std::map<int,wxString>::iterator pictypeiter;
-    
-    initier = PicturesList.find(intSelectedData);
-    pictypeiter = PicturesListPictureType.find(intSelectedData);
-    
-    base64dec = base64_decode(initier->second);
-    
-    wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
-    wxImage photo;
-    //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
-    
-    if (pictypeiter->second == wxT("image/jpeg")){
-        
-        if (!photo.LoadFile(istream, wxBITMAP_TYPE_JPEG)){
-        
-            return;
-        
-        }
-        
-    } else if (pictypeiter->second == wxT("image/png")){
-        
-        if (!photo.LoadFile(istream, wxBITMAP_TYPE_PNG)){
-            
-            return;
-            
-        }
-        
-    } else if (pictypeiter->second == wxT("image/gif")){
-        
-        if (!photo.LoadFile(istream, wxBITMAP_TYPE_GIF)){
-            
-            return;
-            
-        }
-        
-    } else {
-    
-        return;
-    
-    }
-    
-    PictureImage = (wxBitmap)photo;
-    imgPicture->SetBitmap(PictureImage);
-    
-}
-
-void frmContactEditor::LoadLogo( wxListEvent& event )
-{
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboLogos,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    std::string base64dec;
-    
-    std::map<int,std::string>::iterator initier;
-    
-    initier = LogosList.find(intSelectedData);
-    
-    base64dec = base64_decode(initier->second);
-    
-    
-    wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
-    wxImage photo;
-    //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
-    
-    if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
-        
-        return;
-        
-    }
-    
-    
-    LogoImage = (wxBitmap)photo;
-    imgLogo->SetBitmap(LogoImage);
-    
-}
-
-void frmContactEditor::AddLogo( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
-    frameCELogo->SetEditorMode(FALSE);
-    intResult = GetLastInt(&LogosList);
-    frameCELogo->SetupPointers(&LogosList,
-                               &LogosListAltID,
-                               &LogosListPID,
-                               &LogosListType,
-                               &LogosListPicEncType,
-                               &LogosListPictureType,
-                               &LogosListTokens,
-                               &LogosListMediatype,
-                               &LogosListPref,
-                               lboLogos,
-                               (intValueSeek));
-    frameCELogo->ShowModal();
-    delete frameCELogo;
-    frameCELogo = NULL;
-}
-
-void frmContactEditor::ModifyLogo( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboLogos,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
-    frameCELogo->SetupPointers(&LogosList,
-                               &LogosListAltID,
-                               &LogosListPID,
-                               &LogosListType,
-                               &LogosListPicEncType,
-                               &LogosListPictureType,
-                               &LogosListTokens,
-                               &LogosListMediatype,
-                               &LogosListPref,
-                               lboLogos,
-                               intSelectedData);
-    frameCELogo->SetEditorMode(TRUE);
-    frameCELogo->ShowModal();
-    delete frameCELogo;
-    frameCELogo = NULL;
-}
-
-void frmContactEditor::DeleteLogo( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboLogos,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboLogos->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData,
-                  &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
-                  &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
-                  &LogosListMediatype, &LogosListPref);
-    
-    wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
-    wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
-    LogoImage = (wxBitmap)misc_emptyimage_png;
-    
-    imgLogo->SetBitmap(LogoImage);
-}
-
-void frmContactEditor::AddSound( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
-    frameCESound->SetEditorMode(FALSE);
-    intResult = GetLastInt(&SoundsList);
-    frameCESound->SetupPointers(&SoundsList,
-                                &SoundsListAltID,
-                                &SoundsListPID,
-                                &SoundsListType,
-                                &SoundsListAudioType,
-                                &SoundsListAudioEncType,
-                                &SoundsListTokens,
-                                &SoundsListMediatype,
-                                &SoundsListPref,
-                                lboSounds,
-                                (intValueSeek));
-    frameCESound->ShowModal();
-    delete frameCESound;
-    frameCESound = NULL;
-}
-
-void frmContactEditor::ModifySound( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboSounds,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorSound *frameCESound = new frmContactEditorSound ( this );
-    frameCESound->SetupPointers(&SoundsList,
-                                &SoundsListAltID,
-                                &SoundsListPID,
-                                &SoundsListType,
-                                &SoundsListAudioType,
-                                &SoundsListAudioEncType,
-                                &SoundsListTokens,
-                                &SoundsListMediatype,
-                                &SoundsListPref,
-                                lboSounds,
-                                intSelectedData);
-    frameCESound->SetEditorMode(TRUE);
-    frameCESound->ShowModal();
-    delete frameCESound;
-    frameCESound = NULL;
-}
-
-void frmContactEditor::DeleteSound( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboSounds,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboSounds->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &SoundsList, &SoundsListAltID,
-                  &SoundsListPID, &SoundsListType, &SoundsListAudioType,
-                  &SoundsListAudioEncType, &SoundsListTokens, &SoundsListMediatype,
-                  &SoundsListPref);
-    
-}
-
-void frmContactEditor::PlaySoundDetach()
-{
-    
-    if (!AudioStreamPlayback.openFromMemory(base64dec.c_str(), base64declen)){
-        
-        // Can't load file. We must flee...
-        // Also show an error message too.
-        
-        wxMessageBox(_("This file is in an audio format that is unsupported or is not an audio file."), _("Error opening audio file"), wxICON_ERROR);
-        
-        return;
-        
-    }
-    
-    btnStop->Enable();
-    
-    //AudioStreamPlayback.setbuffer(AudioBuffer);
-    AudioStreamPlayback.play();
-    
-    /*timespec n1, n2;
-     
-     n1.tv_sec = 0;
-     n1.tv_nsec = 100000000L;*/
-    
-    //while (TimeA != TimeB){
-    while (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
-        
-        // We poll this every 100ms in order to conserve CPU usage.
-        
-        SleepFor(100000000);
-        
-    }
-    
-    btnStop->Disable();
-    
-}
-
-void frmContactEditor::PlaySound( wxCommandEvent& event )
-{
-    
-    //sf::Music *AudioPlayback = new sf::Music;
-    //AudioStream *AudioStreamPlayback = new AudioStream;
-    //sf::SoundBuffer *AudioBuffer = new sf::SoundBuffer;
-    
-    //sf::Sound *AudioPlayback = new sf::Sound;
-    
-    //delete(AudioPlayback);
-    
-    //delete(AudioPlayback);
-    //delete(AudioStreamPlayback);
-    //delete(AudioBuffer);
-    
-    //AudioPlayback = NULL;
-    //AudioStreamPlayback = NULL;
-    //AudioBuffer = NULL;
-    
-    //return;
-    
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    // Check if sound is still being played and if it is, stop it.
-    
-    if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
-        
-        AudioStreamPlayback.stop();
-        
-    }
-    
-    if (!GetSelectedItem(lboSounds,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    std::map<int, std::string>::iterator initier;
-    
-    initier = SoundsList.find(intSelectedData);
-    
-    base64dec = base64_decode(initier->second);
-    base64declen = base64dec.size();
-    
-    std::thread AudioPlaybackThread(&frmContactEditor::PlaySoundDetach, this);
-    AudioPlaybackThread.detach();
-    
-    return;
-    
-}
-
-void frmContactEditor::StopSound( wxCommandEvent& event )
-{
-    
-    if (AudioStreamPlayback.getStatus() == sf::SoundSource::Playing){
-        
-        AudioStreamPlayback.stop();
-        
-    }
-    
-    btnStop->Disable();
-    
-    return;
-    
-}
-
-void frmContactEditor::AddCalendarAddress( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
-    frameCECalAdr->SetEditorMode(FALSE);
-    intResult = GetLastInt(&CalendarList);
-    frameCECalAdr->SetupPointers(&CalendarList,
-                                 &CalendarListAltID,
-                                 &CalendarListPID,
-                                 &CalendarListType,
-                                 &CalendarListTokens,
-                                 &CalendarListPref,
-                                 lboCalendarAddresses,
-                                 (intValueSeek));
-    frameCECalAdr->ShowModal();
-    delete frameCECalAdr;
-    frameCECalAdr = NULL;
-}
-
-void frmContactEditor::ModifyCalendarAddress( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboCalendarAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
-    frameCECalAdr->SetupPointers(&CalendarList,
-                                 &CalendarListAltID,
-                                 &CalendarListPID,
-                                 &CalendarListType,
-                                 &CalendarListTokens,
-                                 &CalendarListPref,
-                                 lboCalendarAddresses,
-                                 intSelectedData);
-    frameCECalAdr->SetEditorMode(TRUE);
-    frameCECalAdr->ShowModal();
-    delete frameCECalAdr;
-    frameCECalAdr = NULL;
-}
-
-void frmContactEditor::DeleteCalendarAddress( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboCalendarAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboCalendarAddresses->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &CalendarList, &CalendarListAltID,
-                  &CalendarListPID, &CalendarListType, &CalendarListTokens,
-                  &CalendarListPref);
-    
-}
-
-void frmContactEditor::AddCalendarRequest( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
-    frameCECalAdr->SetEditorMode(FALSE);
-    intResult = GetLastInt(&CalendarRequestList);
-    frameCECalAdr->SetupPointers(&CalendarRequestList,
-                                 &CalendarRequestListAltID,
-                                 &CalendarRequestListPID,
-                                 &CalendarRequestListType,
-                                 &CalendarRequestListTokens,
-                                 &CalendarRequestListPref,
-                                 lboCalendarRequestAddress,
-                                 (intValueSeek));
-    frameCECalAdr->ShowModal();
-    delete frameCECalAdr;
-    frameCECalAdr = NULL;
-}
-
-void frmContactEditor::ModifyCalendarRequest( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboCalendarRequestAddress,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
-    frameCECalAdr->SetupPointers(&CalendarList,
-                                 &CalendarRequestListAltID,
-                                 &CalendarRequestListPID,
-                                 &CalendarRequestListType,
-                                 &CalendarRequestListTokens,
-                                 &CalendarRequestListPref,
-                                 lboCalendarRequestAddress,
-                                 intSelectedData);
-    frameCECalAdr->SetEditorMode(TRUE);
-    frameCECalAdr->ShowModal();
-    delete frameCECalAdr;
-    frameCECalAdr = NULL;
-}
-
-void frmContactEditor::DeleteCalendarRequest( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboCalendarRequestAddress,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboCalendarRequestAddress->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &CalendarRequestList,
-                  &CalendarRequestListAltID, &CalendarRequestListPID,
-                  &CalendarRequestListType, &CalendarRequestListTokens,
-                  &CalendarRequestListPref);
-}
-
-void frmContactEditor::AddFreeBusy( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
-    frameCECalAdr->SetEditorMode(FALSE);
-    intResult = GetLastInt(&FreeBusyList);
-    frameCECalAdr->SetupPointers(&FreeBusyList,
-                                 &FreeBusyListAltID,
-                                 &FreeBusyListPID,
-                                 &FreeBusyListType,
-                                 &FreeBusyListTokens,
-                                 &FreeBusyListPref,
-                                 lboFreeBusyAddresses,
-                                 (intValueSeek));
-    frameCECalAdr->ShowModal();
-    delete frameCECalAdr;
-    frameCECalAdr = NULL;
-}
-
-void frmContactEditor::ModifyFreeBusy( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboFreeBusyAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorCalAdr *frameCECalAdr = new frmContactEditorCalAdr ( this );
-    frameCECalAdr->SetupPointers(&FreeBusyList,
-                                 &FreeBusyListAltID,
-                                 &FreeBusyListPID,
-                                 &FreeBusyListType,
-                                 &FreeBusyListTokens,
-                                 &FreeBusyListPref,
-                                 lboFreeBusyAddresses,
-                                 intSelectedData);
-    frameCECalAdr->SetEditorMode(TRUE);
-    frameCECalAdr->ShowModal();
-    delete frameCECalAdr;
-    frameCECalAdr = NULL;
-}
-
-void frmContactEditor::DeleteFreeBusy( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboFreeBusyAddresses,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboFreeBusyAddresses->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &FreeBusyList, &FreeBusyListAltID,
-                  &FreeBusyListPID, &FreeBusyListType, &FreeBusyListTokens,
-                  &FreeBusyListPref);
-    
-}
-
-void frmContactEditor::AddKey( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this );
-    frameCEKey->SetEditorMode(FALSE);
-    intResult = GetLastInt(&KeyList);
-    frameCEKey->SetupPointers(&KeyList,
-                              &KeyListAltID,
-                              &KeyListPID,
-                              &KeyListKeyType,
-                              &KeyListDataType,
-                              &KeyListType,
-                              &KeyListTokens,
-                              &KeyListPref,
-                              lboKeys,
-                              (intValueSeek));
-    frameCEKey->ShowModal();
-    delete frameCEKey;
-    frameCEKey = NULL;
-}
-
-void frmContactEditor::ModifyKey( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboKeys,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorKey *frameCEKey = new frmContactEditorKey ( this );
-    frameCEKey->SetupPointers(&KeyList,
-                              &KeyListAltID,
-                              &KeyListPID,
-                              &KeyListKeyType,
-                              &KeyListDataType,
-                              &KeyListType,
-                              &KeyListTokens,
-                              &KeyListPref,
-                              lboKeys,
-                              intSelectedData);
-    frameCEKey->SetEditorMode(TRUE);
-    frameCEKey->ShowModal();
-    delete frameCEKey;
-    frameCEKey = NULL;
-}
-
-void frmContactEditor::DeleteKey( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboKeys,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboKeys->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &KeyList, &KeyListAltID,
-                  &KeyListPID, &KeyListKeyType, &KeyListDataType, &KeyListType,
-                  &KeyListTokens, &KeyListPref);
-    
-}
-
-void frmContactEditor::AddVendorNamespace( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorVendor *frameCEVen = new frmContactEditorVendor ( this );
-    frameCEVen->SetEditorMode(FALSE);
-    intResult = GetLastInt(&VendorList);
-    frameCEVen->SetupPointers(&VendorList,
-                              &VendorListPEN,
-                              &VendorListElement,
-                              lboVendorNamespace,
-                              (intValueSeek));
-    frameCEVen->ShowModal();
-    delete frameCEVen;
-    frameCEVen = NULL;
-}
-
-void frmContactEditor::ModifyVendorNamespace( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboVendorNamespace,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorVendor *frameCEVen = new frmContactEditorVendor ( this );
-    frameCEVen->SetupPointers(&VendorList,
-                              &VendorListPEN,
-                              &VendorListElement,
-                              lboVendorNamespace,
-                              intSelectedData);
-    frameCEVen->SetEditorMode(TRUE);
-    frameCEVen->ShowModal();
-    delete frameCEVen;
-    frameCEVen = NULL;
-}
-
-void frmContactEditor::DeleteVendorNamespace( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboVendorNamespace,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboVendorNamespace->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &VendorList, &VendorListPEN,
-                  &VendorListElement);
-    
-}
-
-void frmContactEditor::AddXToken( wxCommandEvent& event )
-{
-    int intResult = 0;
-    
-    frmContactEditorXToken *frameCEXT = new frmContactEditorXToken ( this );
-    frameCEXT->SetEditorMode(FALSE);
-    intResult = GetLastInt(&XTokenList);
-    frameCEXT->SetupPointers(&XTokenList,
-                             &XTokenListTokens,
-                             lboXToken,
-                             (intValueSeek));
-    frameCEXT->ShowModal();
-    delete frameCEXT;
-    frameCEXT = NULL;
-}
-
-void frmContactEditor::ModifyXToken( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboXToken,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    frmContactEditorXToken *frameCEXT = new frmContactEditorXToken ( this );
-    frameCEXT->SetupPointers(&XTokenList,
-                             &XTokenListTokens,
-                             lboXToken,
-                             intSelectedData);
-    frameCEXT->SetEditorMode(TRUE);
-    frameCEXT->ShowModal();
-    delete frameCEXT;
-    frameCEXT = NULL;
-}
-
-void frmContactEditor::DeleteXToken( wxCommandEvent& event )
-{
-    long longSelected = -1;
-    int intSelectedData = 0;
-    
-    if (!GetSelectedItem(lboXToken,
-                         &longSelected,
-                         &intSelectedData)){
-        return;
-    }
-    
-    lboXToken->DeleteItem(longSelected);
-    
-    DeleteMapData(intSelectedData, &XTokenList, &XTokenListTokens);
-    
-}
-
-void frmContactEditor::SaveContact( wxCommandEvent& event )
-{
-    
-    // Check if Display As combo box has a value in it.
-    // Do not go any further if there is no value.
-    
-    wxString cmbDisplayAsValue = cmbDisplayAs->GetValue();
-    
-    if (cmbDisplayAsValue.IsEmpty()){
-        
-        wxMessageBox(_("Display As value cannot be left blank."), _("Display As value empty"), wxICON_ERROR);
-        return;
-        
-    }
-    
-    // Save the updated contact data.
-    
-    vCard ContactData;
-    wxString FilenameFinal;
-    bool ReplaceContact = FALSE;
-    
-    if (cmbType->GetCurrentSelection() == 1 ||
-        cmbType->GetCurrentSelection() == 3 ||
-        cmbType->GetCurrentSelection() == 4){
-        
-        if (IsGroup == TRUE){
-            
-            // Mark contact for replacing.
-            
-            ReplaceContact = TRUE;
-            
-        }
-        
-    } else if (cmbType->GetCurrentSelection() == 2){
-        
-        if (IsGroup == TRUE){
-            
-            // Mark contact for replacing.
-            
-            ReplaceContact = TRUE;
-            
-        }
-        
-    }
-    
-    if (ReplaceContact == TRUE){
-        
-        wxString wxDelSplitFilename;
-        wxString wxDelFinalFilename;
-        wxString wxSDelDataURL;
-        wxStringTokenizer wSTDelFilename(wxSContactFilename, wxT("/"));
-        while(wSTDelFilename.HasMoreTokens()){
-            
-            wxDelSplitFilename = wSTDelFilename.GetNextToken();
-            
-        }
-        
-        wxSDelDataURL = wxDelSplitFilename;
-        
-        // Delete the contact from the server as it will be useless in certain
-        // address book clients.
-        
-        ActMgrPtr->AddTask(2, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDelDataURL, wxDelSplitFilename, wxSContactFilename, wxT(""));
-        
-        // Clear the filename so the trigger to recreate the UID is done.
-        
-        wxSContactFilename.Clear();
-        EditMode = FALSE;
-        
-    }
-    
-    if (wxSContactFilename.IsEmpty()){
-        
-        // Generate a random UUID.
-        
-        UIDToken = GenerateUUID();
-        UIDToken = UIDToken.MakeUpper();
-        
-        // Setup the filename.
-        
-        FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
-        
-#if defined(__HAIKU__)
-        
-        //preffilename = wxT("noo");
-        
-#elif defined(__WIN32__)
-        
-        FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
-        FilenameFinal.Append(UIDToken);
-        FilenameFinal.Append(wxT(".vcf"));
-        wxSContactFilename = FilenameFinal;
-        
-#else
-        
-        FilenameFinal = GetAccountDir(wxSContactAccount, FALSE);
-        FilenameFinal.Append(UIDToken);
-        FilenameFinal.Append(wxT(".vcf"));
-        wxSContactFilename = FilenameFinal;
-        
-#endif
-        
-    } else {
-        
-        if (UIDToken.IsEmpty()){
-            
-            // UID Token is empty. (Shouldn't be).
-            // Generate a new UID Token.
-            
-            /*boost::uuids::uuid ContactUUID = boost::uuids::random_generator()();
-             std::string sstContactUUID = boost::uuids::to_string(ContactUUID);
-             wxString strContactUUID(sstContactUUID.c_str(), wxConvUTF8);
-             UIDToken = strContactUUID;*/
-            UIDToken = GenerateUUID();
-            UIDToken = UIDToken.MakeUpper();
-            
-        }
-        FilenameFinal = wxSContactFilename;
-        
-    }
-    
-    // Setup the data and write it into the account folder.
-    
-    // Begin preperations to write the contact to a file.
-    
-    bool boolValue = FALSE;
-    bool boolValue2 = FALSE;
-    bool FNFirst = TRUE;
-    bool NNGeneralFirst = TRUE;
-    bool NNHomeFirst = TRUE;
-    bool NNWorkFirst = TRUE;
-    int intFNCount = 0;
-    std::map<int,int>::iterator intiter;
-    std::map<int,wxString>::iterator striter;
-    
-    ContactData.Add(wxT("BEGIN"), wxT("VCARD"), FALSE);
-    ContactData.Add(wxT("VERSION"), wxT("4.0"), FALSE);
-    
-    // Setup the version string.
-    
-    strValue.Append(wxT("-//Xestia//Address Book Version "));
-    strValue.Append(wxT(XSDAB_VERSION));
-    strValue.Append(wxT("//KW"));
-    
-    ContactData.Add(wxT("PRODID"), strValue, FALSE);
-    
-    // Setup the name.
-    
-    strValue.Clear();
-    
-    // Setup the name field.
-    
-    strValue = txtSurname->GetValue() + wxT(";") +
-    txtForename->GetValue() + wxT(";") +
-    txtOtherNames->GetValue() + wxT(";") +
-    txtTitle->GetValue() + wxT(";") +
-    txtSuffix->GetValue();
-    
-    strValue2 = ContactData.Convert(cmbDisplayAs->GetValue(), FALSE);
-    strValue2.Trim();
-    
-    if (NameTokens.IsEmpty()){
-        ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\""), strValue, FALSE);
-    } else {
-        ContactData.Add(wxT("N;SORT-AS=\"") + strValue2 + wxT("\";") + NameTokens, strValue, FALSE);
-    }
-    
-    if (cmbType->GetCurrentSelection() == 1){
-        
-        ContactData.AddRaw(wxT("KIND"), wxT("individual"));
-        
-    } else if (cmbType->GetCurrentSelection() == 2){
-        
-        ContactData.AddRaw(wxT("KIND"), wxT("group"));
-        
-        // Go through each of the members and write them out.
-        
-        for (std::map<int, wxString>::iterator itemiter = GroupsList.begin();
-             itemiter != GroupsList.end(); ++itemiter){
-            
-            ContactData.Add(wxT("MEMBER:urn:uuid"), itemiter->second, FALSE);
-            
-        }
-        
-    } else if (cmbType->GetCurrentSelection() == 3){
-        
-        ContactData.AddRaw(wxT("KIND"), wxT("org"));
-        
-    } else if (cmbType->GetCurrentSelection() == 4){
-        
-        ContactData.AddRaw(wxT("KIND"), wxT("location"));
-        
-    }
-    
-    
-    // Setup the nicknames (General, Home & Business).
-    
-    strValue.Clear();
-    strValue2.Clear();
-    strValue3.Clear();
-    
-    boolValue = FALSE;
-    boolValue2 = FALSE;
-    intValue2 = 0;
-    intValue  = 0;
-    
-    // Setup the gender.
-    
-    if (cmbGender->GetCurrentSelection() != 0){
-        
-        switch(cmbGender->GetCurrentSelection()){
-                
-            case 1:
-                
-                strValue = wxT("M");
-                break;
-                
-            case 2:
-                
-                strValue = wxT("F");
-                break;
-                
-            case 3:
-                
-                strValue = wxT("O");
-                break;
-                
-            case 4:
-                
-                strValue = wxT("N");
-                break;
-                
-            case 5:
-                
-                strValue = wxT("U");
-                break;
-                
-        }
-        
-    }
-    
-    if (!txtGenderDescription->IsEmpty()){
-        
-        strValue2 = txtGenderDescription->GetValue();
-        
-    }
-    
-    if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
-        
-        EscapeString(&strValue2, FALSE);
-        
-        if (!GenderTokens.IsEmpty()){
-            
-            if (!strValue2.IsEmpty()){
-                
-                ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue + wxT(";") + strValue2);
-                
-            } else {
-                
-                ContactData.AddRaw(wxT("GENDER;") + GenderTokens, strValue);
-                
-            }
-            
-        } else {
-            
-            if (!strValue2.IsEmpty()){
-                
-                ContactData.AddRaw(wxT("GENDER"), strValue + wxT(";") + strValue2);
-                
-            } else {
-                
-                ContactData.AddRaw(wxT("GENDER"), strValue);
-                
-            }
-            
-        }
-        
-    }
-    
-    strValue.Clear();
-    strValue2.Clear();
-    strValue3.Clear();
-    
-    boolValue = FALSE;
-    boolValue2 = FALSE;
-    intValue2 = 0;
-    intValue  = 0;
-    
-    // Process Label.
-    
-    strValue3 = BirthdayAltID;
-    
-    if (!strValue3.IsEmpty()){
-        
-        strValue3.Trim();
-        strValue3.Trim();
-        boolValue2 = TRUE;
-        strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
-        
-        boolValue = TRUE;
-        
-    }
-    
-    //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
-    //strValue2 =
-    
-    // Process Language.
-    
-    strValue3 = BirthdayCalScale;
-    
-    if (!strValue3.IsEmpty()){
-        
-        strValue3.Trim();
-        strValue3.Trim();
-        
-        if (boolValue2 == TRUE){
-            
-            strValue2.Append(wxT(";"));
-            
-        } else {
-            
-            boolValue2 = TRUE;
-            
-        }
-        
-        strValue2.Append(wxT("CALSCALE=") + strValue3);
-        
-        boolValue = TRUE;
-        
-    }
-    
-    // Process Tokens.
-    
-    strValue2 = BirthdayTokens;
-    
-    // Get the birthday and write it.
-    
-    ResetSaveProcessData();
-    
-    if (!txtBirthday->IsEmpty()){
-        
-        strValue = txtBirthday->GetValue();
-        
-        if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
-            
-            if (!strValue2.IsEmpty()){
-                
-                EscapeString(&strValue2, FALSE);
-                EscapeString(&strValue, FALSE);
-                
-                ContactData.AddRaw(wxT("BDAY;VALUE=text;") + strValue2 + wxT(";"), strValue);
-                
-            } else {
-                
-                EscapeString(&strValue, FALSE);
-                
-                ContactData.AddRaw(wxT("BDAY;VALUE=text"), strValue);
-                
-            }
-            
-        }
-        
-    } else {
-        
-        // Deal with date.
-        
-        // Get Day, Month & Year.
-        
-        wxDateTime BirthdayDate;
-        wxDateTime::Month BirthdayMonth;
-        int BirthdayDay;
-        int BirthdayYear;
-        wxString DataBeforeT;
-        wxString DataAfterT;
-        wxString FinalBirthdayString;
-        bool ProcessDataAfterT = FALSE;
-        
-        BirthdayDate = dapBirthday->GetValue();
-        
-        if (BirthdayDate.IsValid()){
-            
-            BirthdayDay = BirthdayDate.GetDay();
-            BirthdayMonth = BirthdayDate.GetMonth();
-            BirthdayYear = BirthdayDate.GetYear();
-            
-            // Look for T and replace data before this.
-            
-            wxStringTokenizer wSTDate(Birthday, wxT("T"));
-            
-            while (wSTDate.HasMoreTokens()){
-                
-                if (ProcessDataAfterT == FALSE){
-                    
-                    DataBeforeT = wSTDate.GetNextToken();
-                    ProcessDataAfterT = TRUE;
-                    
-                } else {
-                    
-                    DataAfterT = wSTDate.GetNextToken();
-                    break;
-                    
-                }
-                
-            }
-            
-            // If there is not T then replace altogether.
-            
-            wxString FinalBirthdayDay;
-            wxString FinalBirthdayMonth;
-            wxString FinalBirthdayYear;
-            
-            if (BirthdayDay < 10){
-                
-                FinalBirthdayDay = wxT("0") + wxString::Format(wxT("%i"), BirthdayDay);
-                
-            } else {
-                
-                FinalBirthdayDay = wxString::Format(wxT("%i"), BirthdayDay);
-                
-            }
-            
-            if (((int)BirthdayMonth + 1) < 10){
-                
-                FinalBirthdayMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
-                
-            } else {
-                
-                FinalBirthdayMonth = wxString::Format(wxT("%i"), ((int)BirthdayMonth + 1));
-                
-            }
-            
-            if (BirthdayYear == 0){
-                
-                FinalBirthdayYear = wxT("--");
-                
-            } else {
-                
-                FinalBirthdayYear = wxString::Format(wxT("%i"), BirthdayYear);
-                
-            }
-            
-            if (!DataAfterT.IsEmpty()){
-                
-                FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay + wxT("T") + DataAfterT;
-                
-            } else {
-                
-                FinalBirthdayString = FinalBirthdayYear + FinalBirthdayMonth + FinalBirthdayDay;
-                
-            }
-            
-            if (!FinalBirthdayString.IsEmpty() || !strValue2.IsEmpty()){
-                
-                if (!strValue2.IsEmpty()){
-                    
-                    EscapeString(&strValue2, FALSE);
-                    EscapeString(&strValue, FALSE);
-                    
-                    ContactData.AddRaw(wxT("BDAY") + strValue2 + wxT(";"), FinalBirthdayString);
-                    
-                } else {
-                    
-                    EscapeString(&strValue, FALSE);
-                    
-                    ContactData.AddRaw(wxT("BDAY"), FinalBirthdayString);
-                    
-                }
-                
-            }
-            
-        }
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    // Process Label.
-    
-    strValue3 = AnniversaryAltID;
-    
-    if (!strValue3.IsEmpty()){
-        
-        strValue3.Trim();
-        strValue3.Trim();
-        boolValue2 = TRUE;
-        strValue2.Append(wxT("ALTID=\"") + strValue3 + wxT("\""));
-        
-        boolValue = TRUE;
-        
-    }
-    
-    //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
-    //strValue2 =
-    
-    // Process Language.
-    
-    strValue3 = AnniversaryCalScale;
-    
-    if (!strValue3.IsEmpty()){
-        
-        strValue3.Trim();
-        strValue3.Trim();
-        
-        if (boolValue2 == TRUE){
-            
-            strValue2.Append(wxT(";"));
-            
-        } else {
-            
-            boolValue2 = TRUE;
-            
-        }
-        
-        strValue2.Append(wxT("CALSCALE=") + strValue3);
-        
-        boolValue = TRUE;
-        
-    }
-    
-    // Process Tokens.
-    
-    strValue2 = AnniversaryTokens;
-    
-    // Deal with ANNIVERSARY.
-    
-    if (!txtAnniversary->IsEmpty()){
-        
-        strValue = txtAnniversary->GetValue();
-        
-        if (!strValue.IsEmpty() || !strValue2.IsEmpty()){
-            
-            if (!strValue2.IsEmpty()){
-                
-                EscapeString(&strValue2, FALSE);
-                EscapeString(&strValue, FALSE);
-                
-                ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text;") + strValue2 + wxT(";"), strValue);
-                
-            } else {
-                
-                EscapeString(&strValue, FALSE);
-                
-                ContactData.AddRaw(wxT("ANNIVERSARY;VALUE=text"), strValue);
-                
-            }
-            
-        }
-        
-    } else {
-        
-        // Look for T and replace data before this.
-        
-        // Get Day, Month & Year.
-        
-        wxDateTime AnniversaryDate;
-        wxDateTime::Month AnniversaryMonth;
-        int AnniversaryDay;
-        int AnniversaryYear;
-        wxString DataBeforeT;
-        wxString DataAfterT;
-        wxString FinalAnniversaryString;
-        bool ProcessDataAfterT = FALSE;
-        
-        AnniversaryDate = dapAnniversary->GetValue();
-        
-        if (AnniversaryDate.IsValid()){
-            
-            AnniversaryDay = AnniversaryDate.GetDay();
-            AnniversaryMonth = AnniversaryDate.GetMonth();
-            AnniversaryYear = AnniversaryDate.GetYear();
-            
-            // Look for T and replace data before this.
-            
-            wxStringTokenizer wSTDate(Anniversary, wxT("T"));
-            
-            while (wSTDate.HasMoreTokens()){
-                
-                if (ProcessDataAfterT == FALSE){
-                    
-                    DataBeforeT = wSTDate.GetNextToken();
-                    ProcessDataAfterT = TRUE;
-                    
-                } else {
-                    
-                    DataAfterT = wSTDate.GetNextToken();
-                    break;
-                    
-                }
-                
-            }
-            
-            // If there is not T then replace altogether.
-            
-            wxString FinalAnniversaryDay;
-            wxString FinalAnniversaryMonth;
-            wxString FinalAnniversaryYear;
-            
-            if (AnniversaryDay < 10){
-                
-                FinalAnniversaryDay = wxT("0") + wxString::Format(wxT("%i"), AnniversaryDay);
-                
-            } else {
-                
-                FinalAnniversaryDay = wxString::Format(wxT("%i"), AnniversaryDay);
-                
-            }
-            
-            if (((int)AnniversaryMonth + 1) < 10){
-                
-                FinalAnniversaryMonth = wxT("0") + wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
-                
-            } else {
-                
-                FinalAnniversaryMonth = wxString::Format(wxT("%i"), ((int)AnniversaryMonth + 1));
-                
-            }
-            
-            if (AnniversaryYear == 0){
-                
-                FinalAnniversaryYear = wxT("--");
-                
-            } else {
-                
-                FinalAnniversaryYear = wxString::Format(wxT("%i"), AnniversaryYear);
-                
-            }
-            
-            if (!DataAfterT.IsEmpty()){
-                
-                FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay + wxT("T") + DataAfterT;
-                
-            } else {
-                
-                FinalAnniversaryString = FinalAnniversaryYear + FinalAnniversaryMonth + FinalAnniversaryDay;
-                
-            }
-            
-            if (!FinalAnniversaryString.IsEmpty() || !strValue2.IsEmpty()){
-                
-                if (!strValue2.IsEmpty()){
-                    
-                    EscapeString(&strValue2, FALSE);
-                    EscapeString(&strValue, FALSE);
-                    
-                    ContactData.AddRaw(wxT("ANNIVERSARY") + strValue2 + wxT(";"), FinalAnniversaryString);
-                    
-                } else {
-                    
-                    EscapeString(&strValue, FALSE);
-                    
-                    ContactData.AddRaw(wxT("ANNIVERSARY"), FinalAnniversaryString);
-                    
-                }
-                
-            }
-            
-        }
-        
-    }
-    
-    // Setup the addresses (General, Home, Business).
-    
-    //intValue = GeneralAddressList.size();
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralAddressList.begin();
-         iter != GeneralAddressList.end(); ++iter){
-        
-        int intSeekValue = iter->first;
-        
-        wxString strAddressString;
-        wxString strAddressFinalValue;
-        std::map<int, wxString>::iterator iterValue;
-        
-        strAddressString.Append(wxT(";;"));
-        
-        // Get Address
-        
-        iterValue = GeneralAddressList.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        strAddressFinalValue.Clear();
-        
-        // Get Town
-        
-        iterValue = GeneralAddressListTown.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        strAddressFinalValue.Clear();
-        
-        // Get County
-        
-        iterValue = GeneralAddressListCounty.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        strAddressFinalValue.Clear();
-        
-        // Get Post Code
-        
-        iterValue = GeneralAddressListPostCode.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        strAddressFinalValue.Clear();
-        
-        // Get Country
-        
-        iterValue = GeneralAddressListCountry.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        strAddressString.Append(strAddressFinalValue);
-        strAddressFinalValue.Clear();
-        
-        ProcessSaveData(wxT("ADR"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressString, &ContactData,
-                        wxT("LABEL"), &GeneralAddressListLabel,
-                        wxT("LANGUAGE"), &GeneralAddressListLang,
-                        wxT("ALTID"), &GeneralAddressListAltID,
-                        wxT("PID"), &GeneralAddressListPID,
-                        wxT("GEO"), &GeneralAddressListGeo,
-                        wxT("TZ"), &GeneralAddressListTimezone,
-                        wxT("MEDIATYPE"), &GeneralAddressListMediatype,
-                        wxT("PREF"), &GeneralAddressListPref,
-                        wxT(""), &GeneralAddressListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeAddressList.begin();
-         iter != HomeAddressList.end(); ++iter){
-        
-        int intSeekValue = iter->first;
-        
-        wxString strAddressString;
-        wxString strAddressFinalValue;
-        std::map<int, wxString>::iterator iterValue;
-        
-        strAddressString.Append(wxT(";;"));
-        
-        // Get Address
-        
-        iterValue = HomeAddressList.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get Town
-        
-        iterValue = HomeAddressListTown.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get County
-        
-        iterValue = HomeAddressListCounty.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get Post Code
-        
-        iterValue = HomeAddressListPostCode.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get Country
-        
-        iterValue = HomeAddressListCountry.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue);
-        
-        ProcessSaveData(wxT("ADR;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressString, &ContactData,
-                        wxT("LABEL"), &HomeAddressListLabel,
-                        wxT("LANGUAGE"), &HomeAddressListLang,
-                        wxT("ALTID"), &HomeAddressListAltID,
-                        wxT("PID"), &HomeAddressListPID,
-                        wxT("GEO"), &HomeAddressListGeo,
-                        wxT("TZ"), &HomeAddressListTimezone,
-                        wxT("MEDIATYPE"), &HomeAddressListMediatype,
-                        wxT("PREF"), &HomeAddressListPref,
-                        wxT(""), &HomeAddressListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessAddressList.begin();
-         iter != BusinessAddressList.end(); ++iter){
-        
-        int intSeekValue = iter->first;
-        
-        wxString strAddressString;
-        wxString strAddressFinalValue;
-        std::map<int, wxString>::iterator iterValue;
-        
-        strAddressString.Append(wxT(";;"));
-        
-        // Get Address
-        
-        iterValue = BusinessAddressList.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get Town
-        
-        iterValue = BusinessAddressListTown.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get County
-        
-        iterValue = BusinessAddressListCounty.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get Post Code
-        
-        iterValue = BusinessAddressListPostCode.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue + wxT(";"));
-        
-        // Get Country
-        
-        iterValue = BusinessAddressListCountry.find(intSeekValue);
-        strAddressFinalValue = iterValue->second;
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressString.Append(strAddressFinalValue);
-        
-        ProcessSaveData(wxT("ADR;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressString, &ContactData,
-                        wxT("LABEL"), &BusinessAddressListLabel,
-                        wxT("LANGUAGE"), &BusinessAddressListLang,
-                        wxT("ALTID"), &BusinessAddressListAltID,
-                        wxT("PID"), &BusinessAddressListPID,
-                        wxT("GEO"), &BusinessAddressListGeo,
-                        wxT("TZ"), &BusinessAddressListTimezone,
-                        wxT("MEDIATYPE"), &BusinessAddressListMediatype,
-                        wxT("PREF"), &BusinessAddressListPref,
-                        wxT(""), &BusinessAddressListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    // Sort out nicknames (if any).
-    
-    for (std::map<int,wxString>::iterator iter = GeneralNicknamesList.begin();
-         iter != GeneralNicknamesList.end(); ++iter){
-        
-        intValue2 = iter->first;
-        
-        // Process Alternative ID.
-        
-        ProcessSaveData(wxT("NICKNAME"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralNicknamesList, &ContactData,
-                        wxT("LANGUAGE"), &GeneralNicknamesListLanguage,
-                        wxT("ALTID"), &GeneralNicknamesListAltID,
-                        wxT("PID"), &GeneralNicknamesListPID,
-                        wxT("PREF"), &GeneralNicknamesListPref,
-                        wxT(""), &GeneralNicknamesListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeNicknamesList.begin();
-         iter != HomeNicknamesList.end(); ++iter){
-        
-        ProcessSaveData(wxT("NICKNAME;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeNicknamesList, &ContactData,
-                        wxT("LANGUAGE"), &HomeNicknamesListLanguage,
-                        wxT("ALTID"), &HomeNicknamesListAltID,
-                        wxT("PID"), &HomeNicknamesListPID,
-                        wxT("PREF"), &HomeNicknamesListPref,
-                        wxT(""), &HomeNicknamesListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessNicknamesList.begin();
-         iter != BusinessNicknamesList.end(); ++iter){
-        
-        ProcessSaveData(wxT("NICKNAME;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessNicknamesList, &ContactData,
-                        wxT("LANGUAGE"), &BusinessNicknamesListLanguage,
-                        wxT("ALTID"), &BusinessNicknamesListAltID,
-                        wxT("PID"), &BusinessNicknamesListPID,
-                        wxT("PREF"), &BusinessNicknamesListPref,
-                        wxT(""), &BusinessNicknamesListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    // Sort out email (general, home and business).
-    
-    for (std::map<int,wxString>::iterator iter = GeneralEmailList.begin();
-         iter != GeneralEmailList.end(); ++iter){
-        
-        //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
-        //strValue2 =
-        
-        wxString strAddressFinalValue;
-        std::map<int, wxString>::iterator iterValue;
-        
-        ProcessSaveData(wxT("EMAIL"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralEmailList, &ContactData,
-                        wxT("ALTID"), &GeneralEmailListAltID,
-                        wxT("PID"), &GeneralEmailListPID,
-                        wxT("PREF"), &GeneralEmailListPref,
-                        wxT(""), &GeneralEmailListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeEmailList.begin();
-         iter != HomeEmailList.end(); ++iter){
-        
-        //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
-        //strValue2 =
-        
-        ProcessSaveData(wxT("EMAIL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeEmailList, &ContactData,
-                        wxT("ALTID"), &HomeEmailListAltID,
-                        wxT("PID"), &HomeEmailListPID,
-                        wxT("PREF"), &HomeEmailListPref,
-                        wxT(""), &HomeEmailListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessEmailList.begin();
-         iter != BusinessEmailList.end(); ++iter){
-        
-        //strValue3 = ContactData.Convert(GeneralAddressList, FALSE);
-        //strValue2 =
-        
-        ProcessSaveData(wxT("EMAIL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessEmailList, &ContactData,
-                        wxT("ALTID"), &BusinessEmailListAltID,
-                        wxT("PID"), &BusinessEmailListPID,
-                        wxT("PREF"), &BusinessEmailListPref,
-                        wxT(""), &BusinessEmailListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralIMList.begin();
-         iter != GeneralIMList.end(); ++iter){
-        
-        intValue2 = iter->first;
-        
-        // Process Alternative ID.
-        
-        ProcessSaveData(wxT("IMPP"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralIMList, &ContactData,
-                        wxT("ALTID"), &GeneralIMListAltID,
-                        wxT("PID"), &GeneralIMListPID,
-                        wxT("MEDIATYPE"), &GeneralIMListMediatype,
-                        wxT("PREF"), &GeneralIMListPref,
-                        wxT(""), &GeneralIMListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeIMList.begin();
-         iter != HomeIMList.end(); ++iter){
-        
-        ProcessSaveData(wxT("IMPP;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeIMList, &ContactData,
-                        wxT("ALTID"), &HomeIMListAltID,
-                        wxT("PID"), &HomeIMListPID,
-                        wxT("MEDIATYPE"), &HomeIMListMediatype,
-                        wxT("PREF"), &HomeIMListPref,
-                        wxT(""), &HomeIMListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessIMList.begin();
-         iter != BusinessIMList.end(); ++iter){
-        
-        ProcessSaveData(wxT("IMPP;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessIMList, &ContactData,
-                        wxT("ALTID"), &BusinessIMListAltID,
-                        wxT("PID"), &BusinessIMListPID,
-                        wxT("MEDIATYPE"), &BusinessIMListMediatype,
-                        wxT("PREF"), &BusinessIMListPref,
-                        wxT(""), &BusinessIMListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralTelephoneList.begin();
-         iter != GeneralTelephoneList.end(); ++iter){
-        
-        wxString strAddressFinalValue = iter->second;
-        
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressFinalValue.insert(0, wxT("tel:"));
-        
-        ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressFinalValue, &ContactData,
-                        wxT("ALTID"), &GeneralTelephoneListAltID,
-                        wxT("PID"), &GeneralTelephoneListPID,
-                        wxT("TYPE"), &GeneralTelephoneListType,
-                        wxT("PREF"), &GeneralTelephoneListPref,
-                        wxT(""), &GeneralTelephoneListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeTelephoneList.begin();
-         iter != HomeTelephoneList.end(); ++iter){
-        
-        wxString strAddressFinalValue = iter->second;
-        
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressFinalValue.insert(0, wxT("tel:"));
-        
-        ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressFinalValue, &ContactData,
-                        wxT("ALTID"), &HomeTelephoneListAltID,
-                        wxT("PID"), &HomeTelephoneListPID,
-                        wxT("TYPE"), &HomeTelephoneListType,
-                        wxT("PREF"), &HomeTelephoneListPref,
-                        wxT(""), &HomeTelephoneListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessTelephoneList.begin();
-         iter != BusinessTelephoneList.end(); ++iter){
-        
-        wxString strAddressFinalValue = iter->second;
-        
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressFinalValue.insert(0, wxT("tel:"));
-        
-        ProcessSaveData(wxT("TEL"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressFinalValue, &ContactData,
-                        wxT("ALTID"), &BusinessTelephoneListAltID,
-                        wxT("PID"), &BusinessTelephoneListPID,
-                        wxT("TYPE"), &BusinessTelephoneListType,
-                        wxT("PREF"), &BusinessTelephoneListPref,
-                        wxT(""), &BusinessTelephoneListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralLanguageList.begin();
-         iter != GeneralLanguageList.end(); ++iter){
-        
-        intValue2 = iter->first;
-        
-        ProcessSaveData(wxT("LANG"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralLanguageList, &ContactData,
-                        wxT("ALTID"), &GeneralLanguageListAltID,
-                        wxT("PID"), &GeneralLanguageListPID,
-                        wxT("PREF"), &GeneralLanguageListPref,
-                        wxT(""), &GeneralLanguageListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeLanguageList.begin();
-         iter != HomeLanguageList.end(); ++iter){
-        
-        ProcessSaveData(wxT("LANG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeLanguageList, &ContactData,
-                        wxT("ALTID"), &HomeLanguageListAltID,
-                        wxT("PID"), &HomeLanguageListPID,
-                        wxT("PREF"), &HomeLanguageListPref,
-                        wxT(""), &HomeLanguageListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessLanguageList.begin();
-         iter != BusinessLanguageList.end(); ++iter){
-        
-        ProcessSaveData(wxT("LANG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessLanguageList, &ContactData,
-                        wxT("ALTID"), &BusinessLanguageListAltID,
-                        wxT("PID"), &BusinessLanguageListPID,
-                        wxT("PREF"), &BusinessLanguageListPref,
-                        wxT(""), &BusinessLanguageListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralTZList.begin();
-         iter != GeneralTZList.end(); ++iter){
-        
-        ProcessSaveData(wxT("TZ"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralTZList, &ContactData,
-                        wxT("ALTID"), &GeneralTZListAltID,
-                        wxT("PID"), &GeneralTZListPID,
-                        wxT("MEDIATYPE"), &GeneralTZListMediatype,
-                        wxT("PREF"), &GeneralTZListPref,
-                        wxT(""), &GeneralTZListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeTZList.begin();
-         iter != HomeTZList.end(); ++iter){
-        
-        ProcessSaveData(wxT("TZ;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeTZList, &ContactData,
-                        wxT("ALTID"), &HomeTZListAltID,
-                        wxT("PID"), &HomeTZListPID,
-                        wxT("MEDIATYPE"), &HomeTZListMediatype,
-                        wxT("PREF"), &HomeTZListPref,
-                        wxT(""), &HomeTZListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessTZList.begin();
-         iter != BusinessTZList.end(); ++iter){
-        
-        ProcessSaveData(wxT("TZ;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessTZList, &ContactData,
-                        wxT("ALTID"), &BusinessTZListAltID,
-                        wxT("PID"), &BusinessTZListPID,
-                        wxT("MEDIATYPE"), &BusinessTZListMediatype,
-                        wxT("PREF"), &BusinessTZListPref,
-                        wxT(""), &BusinessTZListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralGeographyList.begin();
-         iter != GeneralGeographyList.end(); ++iter){
-        
-        wxString strAddressFinalValue = iter->second;
-        
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressFinalValue.insert(0, wxT("geo:"));
-        
-        ProcessSaveData(wxT("GEO"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &strAddressFinalValue, &ContactData,
-                        wxT("ALTID"), &GeneralGeographyListAltID,
-                        wxT("PID"), &GeneralGeographyListPID,
-                        wxT("MEDIATYPE"), &GeneralGeographyListMediatype,
-                        wxT("PREF"), &GeneralGeographyListPref,
-                        wxT(""), &GeneralGeographyListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeGeographyList.begin();
-         iter != HomeGeographyList.end(); ++iter){
-        
-        wxString strAddressFinalValue = iter->second;
-        
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressFinalValue.insert(0, wxT("geo:"));
-        
-        ProcessSaveData(wxT("GEO;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeGeographyList, &ContactData,
-                        wxT("ALTID"), &HomeGeographyListAltID,
-                        wxT("PID"), &HomeGeographyListPID,
-                        wxT("MEDIATYPE"), &HomeGeographyListMediatype,
-                        wxT("PREF"), &HomeGeographyListPref,
-                        wxT(""), &HomeGeographyListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessGeographyList.begin();
-         iter != BusinessGeographyList.end(); ++iter){
-        
-        wxString strAddressFinalValue = iter->second;
-        
-        ProcessCaptureStrings(&strAddressFinalValue);
-        
-        strAddressFinalValue.insert(0, wxT("geo:"));
-        
-        ProcessSaveData(wxT("GEO;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessGeographyList, &ContactData,
-                        wxT("ALTID"), &BusinessGeographyListAltID,
-                        wxT("PID"), &BusinessGeographyListPID,
-                        wxT("MEDIATYPE"), &BusinessGeographyListMediatype,
-                        wxT("PREF"), &BusinessGeographyListPref,
-                        wxT(""), &BusinessGeographyListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralRelatedList.begin();
-         iter != GeneralRelatedList.end(); ++iter){
-        
-        ProcessSaveData(wxT("RELATED"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralRelatedList, &ContactData,
-                        wxT("ALTID"), &GeneralRelatedListAltID,
-                        wxT("PID"), &GeneralRelatedListPID,
-                        wxT("LANGUAGE"), &GeneralRelatedListLanguage,
-                        wxT("TYPE"), &GeneralRelatedListRelType,
-                        wxT("PREF"), &GeneralRelatedListPref,
-                        wxT(""), &GeneralRelatedListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralWebsiteList.begin();
-         iter != GeneralWebsiteList.end(); ++iter){
-        
-        ProcessSaveData(wxT("URL"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralWebsiteList, &ContactData,
-                        wxT("ALTID"), &GeneralWebsiteListAltID,
-                        wxT("PID"), &GeneralWebsiteListPID,
-                        wxT("MEDIATYPE"), &GeneralWebsiteListMediatype,
-                        wxT("PREF"), &GeneralWebsiteListPref,
-                        wxT(""), &GeneralWebsiteListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeWebsiteList.begin();
-         iter != HomeWebsiteList.end(); ++iter){
-        
-        ProcessSaveData(wxT("URL;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeWebsiteList, &ContactData,
-                        wxT("ALTID"), &HomeWebsiteListAltID,
-                        wxT("PID"), &HomeWebsiteListPID,
-                        wxT("MEDIATYPE"), &HomeWebsiteListMediatype,
-                        wxT("PREF"), &HomeWebsiteListPref,
-                        wxT(""), &HomeWebsiteListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessWebsiteList.begin();
-         iter != BusinessWebsiteList.end(); ++iter){
-        
-        ProcessSaveData(wxT("URL;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessWebsiteList, &ContactData,
-                        wxT("ALTID"), &BusinessWebsiteListAltID,
-                        wxT("PID"), &BusinessWebsiteListPID,
-                        wxT("MEDIATYPE"), &BusinessWebsiteListMediatype,
-                        wxT("PREF"), &BusinessWebsiteListPref,
-                        wxT(""), &BusinessWebsiteListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralTitleList.begin();
-         iter != GeneralTitleList.end(); ++iter){
-        
-        ProcessSaveData(wxT("TITLE"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralTitleList, &ContactData,
-                        wxT("ALTID"), &GeneralTitleListAltID,
-                        wxT("PID"), &GeneralTitleListPID,
-                        wxT("LANGUAGE"), &GeneralTitleListLanguage,
-                        wxT("PREF"), &GeneralTitleListPref,
-                        wxT(""), &GeneralTitleListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeTitleList.begin();
-         iter != HomeTitleList.end(); ++iter){
-        
-        ProcessSaveData(wxT("TITLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeTitleList, &ContactData,
-                        wxT("ALTID"), &HomeTitleListAltID,
-                        wxT("PID"), &HomeTitleListPID,
-                        wxT("LANGUAGE"), &HomeTitleListLanguage,
-                        wxT("PREF"), &HomeTitleListPref,
-                        wxT(""), &HomeTitleListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessTitleList.begin();
-         iter != BusinessTitleList.end(); ++iter){
-        
-        ProcessSaveData(wxT("TITLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessTitleList, &ContactData,
-                        wxT("ALTID"), &BusinessTitleListAltID,
-                        wxT("PID"), &BusinessTitleListPID,
-                        wxT("LANGUAGE"), &BusinessTitleListLanguage,
-                        wxT("PREF"), &BusinessTitleListPref,
-                        wxT(""), &BusinessTitleListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralRoleList.begin();
-         iter != GeneralRoleList.end(); ++iter){
-        
-        ProcessSaveData(wxT("ROLE"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralRoleList, &ContactData,
-                        wxT("ALTID"), &GeneralRoleListAltID,
-                        wxT("PID"), &GeneralRoleListPID,
-                        wxT("LANGUAGE"), &GeneralRoleListLanguage,
-                        wxT("PREF"), &GeneralRoleListPref,
-                        wxT(""), &GeneralRoleListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeRoleList.begin();
-         iter != HomeRoleList.end(); ++iter){
-        
-        ProcessSaveData(wxT("ROLE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeRoleList, &ContactData,
-                        wxT("ALTID"), &HomeRoleListAltID,
-                        wxT("PID"), &HomeRoleListPID,
-                        wxT("LANGUAGE"), &HomeRoleListLanguage,
-                        wxT("PREF"), &HomeRoleListPref,
-                        wxT(""), &HomeRoleListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessRoleList.begin();
-         iter != BusinessRoleList.end(); ++iter){
-        
-        ProcessSaveData(wxT("ROLE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessRoleList, &ContactData,
-                        wxT("ALTID"), &BusinessRoleListAltID,
-                        wxT("PID"), &BusinessRoleListPID,
-                        wxT("LANGUAGE"), &BusinessRoleListLanguage,
-                        wxT("PREF"), &BusinessRoleListPref,
-                        wxT(""), &BusinessRoleListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralOrganisationsList.begin();
-         iter != GeneralOrganisationsList.end(); ++iter){
-        
-        ProcessSaveData(wxT("ORG"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralOrganisationsList, &ContactData,
-                        wxT("ALTID"), &GeneralOrganisationsListAltID,
-                        wxT("PID"), &GeneralOrganisationsListPID,
-                        wxT("LANGUAGE"), &GeneralOrganisationsListLanguage,
-                        wxT("SORT-AS"), &GeneralOrganisationsListSortAs,
-                        wxT("PREF"), &GeneralOrganisationsListPref,
-                        wxT(""), &GeneralOrganisationsListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeOrganisationsList.begin();
-         iter != HomeOrganisationsList.end(); ++iter){
-        
-        ProcessSaveData(wxT("ORG;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeOrganisationsList, &ContactData,
-                        wxT("ALTID"), &HomeOrganisationsListAltID,
-                        wxT("PID"), &HomeOrganisationsListPID,
-                        wxT("LANGUAGE"), &HomeOrganisationsListLanguage,
-                        wxT("SORT-AS"), &HomeOrganisationsListSortAs,
-                        wxT("PREF"), &HomeOrganisationsListPref,
-                        wxT(""), &HomeOrganisationsListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessOrganisationsList.begin();
-         iter != BusinessOrganisationsList.end(); ++iter){
-        
-        ProcessSaveData(wxT("ORG;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessOrganisationsList, &ContactData,
-                        wxT("ALTID"), &BusinessOrganisationsListAltID,
-                        wxT("PID"), &BusinessOrganisationsListPID,
-                        wxT("LANGUAGE"), &BusinessOrganisationsListLanguage,
-                        wxT("SORT-AS"), &BusinessOrganisationsListSortAs,
-                        wxT("PREF"), &BusinessOrganisationsListPref,
-                        wxT(""), &BusinessOrganisationsListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = GeneralNoteList.begin();
-         iter != GeneralNoteList.end(); ++iter){
-        
-        ProcessSaveData(wxT("NOTE"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &GeneralNoteList, &ContactData,
-                        wxT("ALTID"), &GeneralNoteListAltID,
-                        wxT("PID"), &GeneralNoteListPID,
-                        wxT("LANGUAGE"), &GeneralNoteListLanguage,
-                        wxT("PREF"), &GeneralNoteListPref,
-                        wxT(""), &GeneralNoteListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = HomeNoteList.begin();
-         iter != HomeNoteList.end(); ++iter){
-        
-        ProcessSaveData(wxT("NOTE;TYPE=home"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &HomeNoteList, &ContactData,
-                        wxT("ALTID"), &HomeNoteListAltID,
-                        wxT("PID"), &HomeNoteListPID,
-                        wxT("LANGUAGE"), &HomeNoteListLanguage,
-                        wxT("PREF"), &HomeNoteListPref,
-                        wxT(""), &HomeNoteListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = BusinessNoteList.begin();
-         iter != BusinessNoteList.end(); ++iter){
-        
-        ProcessSaveData(wxT("NOTE;TYPE=work"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &BusinessNoteList, &ContactData,
-                        wxT("ALTID"), &BusinessNoteListAltID,
-                        wxT("PID"), &BusinessNoteListPID,
-                        wxT("LANGUAGE"), &BusinessNoteListLanguage,
-                        wxT("PREF"), &BusinessNoteListPref,
-                        wxT(""), &BusinessNoteListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = CategoriesList.begin();
-         iter != CategoriesList.end(); ++iter){
-        
-        ProcessSaveData(wxT("CATEGORIES"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &CategoriesList, &ContactData,
-                        wxT("ALTID"), &CategoriesListAltID,
-                        wxT("PID"), &CategoriesListPID,
-                        wxT("TYPE"), &CategoriesListType,
-                        wxT("PREF"), &CategoriesListPref,
-                        wxT(""), &CategoriesListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    // Pictures.
-    
-    for (std::map<int, std::string>::iterator iter = PicturesList.begin();
-         iter != PicturesList.end(); ++iter){
-        
-        int intValueIndex = iter->first;
-        
-        std::map<int, std::string>::iterator stdstriter;
-        std::map<int, wxString>::iterator enciter;
-        
-        striter = PicturesListPictureType.find(intValueIndex);
-        enciter = PicturesListPicEncType.find(intValueIndex);
-        
-        ProcessSaveData(wxT("PHOTO"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &PicturesList, &striter,
-                        &enciter, &ContactData,
-                        wxT("ALTID"), &PicturesListAltID,
-                        wxT("PID"), &PicturesListPID,
-                        wxT("TYPE"), &PicturesListType,
-                        wxT("PREF"), &PicturesListPref,
-                        wxT(""), &PicturesListTokens);
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    // Logos.
-    
-    for (std::map<int, std::string>::iterator iter = LogosList.begin();
-         iter != LogosList.end(); ++iter){
-        
-        int intValueIndex = iter->first;
-        
-        std::map<int, std::string>::iterator stdstriter;
-        std::map<int, wxString>::iterator enciter;
-        
-        striter = LogosListPictureType.find(intValueIndex);
-        enciter = LogosListPicEncType.find(intValueIndex);
-        
-        ProcessSaveData(wxT("LOGO"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &LogosList, &striter,
-                        &enciter, &ContactData,
-                        wxT("ALTID"), &LogosListAltID,
-                        wxT("PID"), &LogosListPID,
-                        wxT("TYPE"), &LogosListType,
-                        wxT("PREF"), &LogosListPref,
-                        wxT(""), &LogosListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    // Sounds.
-    
-    for (std::map<int, std::string>::iterator iter = SoundsList.begin();
-         iter != SoundsList.end(); ++iter){
-        
-        int intValueIndex = iter->first;
-        
-        std::map<int, std::string>::iterator stdstriter;
-        std::map<int, wxString>::iterator enciter;
-        
-        striter = SoundsListAudioType.find(intValueIndex);
-        enciter = SoundsListAudioEncType.find(intValueIndex);
-        
-        ProcessSaveData(wxT("SOUND"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &SoundsList, &striter,
-                        &enciter, &ContactData,
-                        wxT("ALTID"), &SoundsListAltID,
-                        wxT("PID"), &SoundsListPID,
-                        wxT("TYPE"), &SoundsListType,
-                        wxT("PREF"), &SoundsListPref,
-                        wxT(""), &SoundsListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = CalendarList.begin();
-         iter != CalendarList.end(); ++iter){
-        
-        ProcessSaveData(wxT("CALURI"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &CalendarList, &ContactData,
-                        wxT("ALTID"), &CalendarListAltID,
-                        wxT("PID"), &CalendarListPID,
-                        wxT("MEDIATYPE"), &CalendarListMediatype,
-                        wxT("TYPE"), &CalendarListType,
-                        wxT("PREF"), &CalendarListPref,
-                        wxT(""), &CalendarListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = CalendarRequestList.begin();
-         iter != CalendarRequestList.end(); ++iter){
-        
-        ProcessSaveData(wxT("CALADRURI"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &CalendarRequestList, &ContactData,
-                        wxT("ALTID"), &CalendarRequestListAltID,
-                        wxT("PID"), &CalendarRequestListPID,
-                        wxT("MEDIATYPE"), &CalendarRequestListMediatype,
-                        wxT("TYPE"), &CalendarRequestListType,
-                        wxT("PREF"), &CalendarRequestListPref,
-                        wxT(""), &CalendarRequestListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    for (std::map<int,wxString>::iterator iter = FreeBusyList.begin();
-         iter != FreeBusyList.end(); ++iter){
-        
-        ProcessSaveData(wxT("FBURL"), &strValue2, &boolValue2, &boolValue,
-                        &iter, &FreeBusyList, &ContactData,
-                        wxT("ALTID"), &FreeBusyListAltID,
-                        wxT("PID"), &FreeBusyListPID,
-                        wxT("MEDIATYPE"), &FreeBusyListMediatype,
-                        wxT("TYPE"), &FreeBusyListType,
-                        wxT("PREF"), &FreeBusyListPref,
-                        wxT(""), &FreeBusyListTokens );
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    for (std::map<int, wxString>::iterator iter = KeyList.begin();
-         iter != KeyList.end(); ++iter){
-        
-        intValue2 = iter->first;
-        
-        // Process Alternative ID.
-        
-        striter = KeyListAltID.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("ALTID=") + strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }
-        
-        // Process PID.
-        
-        striter = KeyListPID.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("PID=") + strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }
-        
-        // Process Type.
-        
-        striter = KeyListType.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("TYPE=") + strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }
-        
-        intiter = KeyListPref.find(intValue2);
-        
-        if (intiter->first == intValue2){
-            
-            intValue3 = intiter->second;
-            
-            if (intValue3){
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(wxT("PREF=") + wxString::Format(wxT("%i"), intValue3));
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }      
-        
-        // Process Tokens.
-        
-        striter = KeyListTokens.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-            if (!strValue3.IsEmpty()){
-                
-                strValue3.Trim();
-                strValue3.Trim();
-                
-                if (boolValue2 == TRUE){
-                    
-                    strValue2.Append(wxT(";"));
-                    
-                } else {
-                    
-                    boolValue2 = TRUE;
-                    
-                }
-                
-                strValue2.Append(strValue3);
-                
-                boolValue = TRUE;
-                
-            }
-            
-        }      
-        
-        // Get the key information.
-        
-        std::map<int, wxString>::iterator enciter;
-        
-        striter = KeyListDataType.find(intValue2);     
-        //enciter = KeyListAudioEncType.find(intValue2);
-        
-        wxString strValueData;
-        
-        strValueData = iter->second;   
-        //strValueData.insert(0, wxT("data:") + striter->second + wxT(";") + enciter->second + wxT(","));
-        strValueData.insert(0, wxT("data:") + striter->second + wxT(";base64,"));      
-        
-        
-        // Add to the vCard.
-        
-        if (boolValue == TRUE){
-            
-            ContactData.AddRaw(wxT("KEY;") + strValue2, strValueData);
-            
-        } else {
-            
-            ContactData.Add(wxT("KEY"), strValueData, TRUE);
-            
-        }
-        
-        ResetSaveProcessData();   
-        
-    }
-    
-    // Vendor specific items.
-    
-    ResetSaveProcessData();   
-    
-    for (std::map<int,wxString>::iterator iter = VendorList.begin();
-         iter != VendorList.end(); ++iter){
-        
-        intValue2 = iter->first;       
-        
-        // Get the IANA PEN number.
-        
-        striter = VendorListPEN.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue2 = striter->second;
-            
-        }
-        
-        // Get the element name.
-        
-        striter = VendorListElement.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue3 = striter->second;
-            
-        }
-        
-        // Get the address.
-        
-        striter = VendorList.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue = striter->second;
-            
-        }
-        
-        // Add to the vCard.
-        
-        if (boolValue == TRUE){
-            
-            ContactData.AddRaw(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue);
-            
-        } else {
-            
-            ContactData.Add(wxT("VND-") + strValue2 + wxT("-") + strValue3, strValue, FALSE);
-            
-        }
-        
-        ResetSaveProcessData();
-        
-    }              
-    
-    ResetSaveProcessData();  
-    
-    // X-Tokens.
-    
-    for (std::map<int,wxString>::iterator iter = XTokenList.begin();
-         iter != XTokenList.end(); ++iter){
-        
-        intValue2 = iter->first;       
-        
-        // Get the element name.
-        
-        striter = XTokenListTokens.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue2 = striter->second;
-            
-        }      
-        
-        // Get the address.
-        
-        striter = XTokenList.find(intValue2);
-        
-        if (striter->first == intValue2){
-            
-            strValue = striter->second;
-            
-        }
-        
-        // Add to the vCard.
-        
-        if (boolValue == TRUE){
-            
-            ContactData.AddRaw(wxT("X-") + strValue2, strValue);
-            
-        } else {
-            
-            ContactData.Add(wxT("X-") + strValue2, strValue, FALSE);
-            
-        }
-        
-        ResetSaveProcessData();
-        
-    }
-    
-    ResetSaveProcessData();
-    
-    if (FullNamesList.size() == 0){
-        
-        wxString FullName = cmbDisplayAs->GetValue();
-        FullNamesList.insert(std::make_pair(0, FullName));
-        FullNamesListAltID.insert(std::make_pair(0, wxT("")));
-        FullNamesListPID.insert(std::make_pair(0, wxT("")));
-        FullNamesListType.insert(std::make_pair(0, wxT("")));
-        FullNamesListLanguage.insert(std::make_pair(0, wxT("")));
-        FullNamesListPref.insert(std::make_pair(0, 0));
-        FullNamesListTokens.insert(std::make_pair(0, wxT("")));
-        FNFirst = FALSE;
-        
-    }
-    
-    for (std::map<int, wxString>::iterator iter = FullNamesList.begin();
-         iter != FullNamesList.end(); ++iter){
-        
-        if (FNFirst == TRUE){
-            
-            iter->second = cmbDisplayAs->GetValue();
-            FNFirst = FALSE;
-            
-        }
-        
-        std::map<int,wxString>::iterator mapS;
-        
-        mapS = FullNamesListTokens.find(iter->first);
-        
-        ProcessSaveData(wxT("FN"), &strValue2, &boolValue2, &boolValue, 
-                        &iter, &FullNamesList, &ContactData,
-                        wxT("ALTID"), &FullNamesListAltID,
-                        wxT("PID"), &FullNamesListPID,
-                        wxT("TYPE"), &FullNamesListType,
-                        wxT("LANGUAGE"), &FullNamesListLanguage,
-                        wxT("PREF"), &FullNamesListPref,
-                        wxT(""), &FullNamesListTokens );
-        
-        // Get the address.
-        
-        ResetSaveProcessData();    
-        
-    }
-    
-    //ContactData.Add(wxT("FN"), cmbDisplayAs->GetValue(), FALSE);
-    
-    // Insert revision (REV) date.
-    
-    // Get today's date and time.
-    
-    wxDateTime DateTimeNow = wxDateTime::Now();
-    
-    wxString DateRev;
-    
-    // Set year, month and date.
-    
-    int intYear = DateTimeNow.GetYear();
-    int intMonth = DateTimeNow.GetMonth();
-    int intDay = DateTimeNow.GetDay();
-    
-    DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intYear));
-    
-    if (intMonth < 10){
-        
-        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMonth));
-        
-    } else {
-        
-        DateRev.Append(wxString::Format(wxT("%i"), intMonth));
-        
-    }
-    
-    if (intDay < 10){
-        
-        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intDay));
-        
-    } else {
-        
-        DateRev.Append(wxString::Format(wxT("%i"), intDay));
-        
-    }
-    
-    //DateRev.Append(wx);
-    //DateRev.Append(wx);
-    //DateRev.Append(wx);
-    DateRev.Append(wxT("T"));
-    
-    // Set hour, minute and second.
-    
-    int intHour = DateTimeNow.GetHour();
-    int intMinute = DateTimeNow.GetMinute();
-    int intSecond = DateTimeNow.GetSecond();
-    
-    if (intHour < 10){
-        
-        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intHour));
-        
-    } else {
-        
-        DateRev.Append(wxString::Format(wxT("%i"), intHour));    
-        
-    }
-    
-    if (intMinute < 10){
-        
-        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intMinute));
-        
-    } else {
-        
-        DateRev.Append(wxString::Format(wxT("%i"), intMinute));
-        
-    }
-    
-    if (intSecond < 10){
-        
-        DateRev.Append(wxT("0") + wxString::Format(wxT("%i"), intSecond));
-        
-    } else {
-        
-        DateRev.Append(wxString::Format(wxT("%i"), intSecond));
-        
-    }
-    
-    //   DateRev.Append(wx);
-    //   DateRev.Append(wx);
-    //   DateRev.Append(wxString DateTimeNow->);
-    DateRev.Append(wxT("Z"));    
-    
-    ContactData.Add(wxT("UID"), UIDToken, FALSE);
-    
-    // End the vCard File.
-    
-    ContactData.Add(wxT("END"), wxT("VCARD"), FALSE);
-    
-    FMTimer.Stop();
-    ContactData.WriteFile(FilenameFinal);
-    
-    vCard34Conv ConvFileFun;
-    
-    wxString wxSData;
-    
-    ConvFileFun.ConvertToV3(FilenameFinal, &wxSData);
-    
-    wxString AccountDirPrefix;
-    wxString AccountDir;
-    wxString PrefDir;
-    
-#if defined(__HAIKU__)
-    
-    //preffilename = wxT("noo");
-
-#elif defined(__APPLE__)
-    
-    PrefDir = GetUserPrefDir();
-    
-    wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
-    
-#elif defined(__WIN32__)
-    
-    PrefDir = GetUserPrefDir();
-    
-    wxStringTokenizer wSTFilename(wxSContactFilename, wxT("\\"));
-    
-#else
-    
-    PrefDir = GetUserPrefDir();
-    
-    wxStringTokenizer wSTFilename(wxSContactFilename, wxT("/"));
-    
-#endif
-    
-    XABPreferences PrefData(PrefDir);
-    
-    wxString AccountType;
-    
-    for (int i = 0; i < PrefData.accounts.GetCount(); i++){
-        
-        AccountDir = PrefData.accounts.GetAccountDirectory(i) + wxT(".carddav");
-        
-        if (AccountDir == wxSContactAccount){
-            
-            AccountDirPrefix = PrefData.accounts.GetAccountDirPrefix(i);
-            AccountDirPrefix.Trim();
-            AccountType = PrefData.accounts.GetAccountType(i);
-            break;
-            
-        }
-        
-    }
-    
-    wxString wxSplitFilename;
-    wxString wxSDataURL;
-    
-    while(wSTFilename.HasMoreTokens()){
-        
-        wxSplitFilename = wSTFilename.GetNextToken();
-        
-    }
-    
-    wxSDataURL = wxSplitFilename;
-    //wxSDataURL.Append(wxSplitFilename);
-    
-    // Find out if the filename exists in the table.
-    
-    if (AccountType == wxT("CardDAV") || AccountType == wxT("carddav")){
-        
-        wxString ETagResult;
-        wxString ETagOriginal;
-        
-        ETagDB *ETagDBPtr = NULL;
-        
-        ETagDBPtr = ETagTmrPtr->GetPointer(wxSContactAccount);
-        
-        wxString wxSETag = ETagDBPtr->GetETag(wxSplitFilename);
-        wxString wxSETagOrig = ETagDBPtr->GetETagOriginal(wxSplitFilename);
-        
-        if (wxSETagOrig.IsEmpty()){
-            
-            // Generate the ETag.
-            
-            wxSETagOrig = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
-            
-        }
-        
-        if (wxSETag.IsEmpty()){
-            
-            // Update empty ETag.
-            
-            wxSETag = wxSETagOrig;
-            ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag, wxSETagOrig);
-            
-        }
-        else {
-            
-            // Don't change original ETag.
-            
-            wxSETag = wxString::Format(wxT("%X%X%X%X"), rand() % 1024, rand() % 1024, rand() % 1024, rand() % 1024);
-            ETagDBPtr->UpdateETag(wxSplitFilename, wxSETag);
-            
-        }
-        
-        if (EditMode == FALSE){
-            
-            ActMgrPtr->AddTask(0, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
-            EditMode = TRUE;
-            FMTimer.SetFilename(FilenameFinal);
-            FMTimer.UpdateTimestamp();
-            FMTimer.Start(10000, FALSE);
-           
-           wxCommandEvent reloadevent(RELOADCONTACTLIST);
-           reloadevent.SetString(wxSContactAccount);
-           wxPostEvent(this->GetParent(), reloadevent);
-            
-        }
-        else {
-            
-            ActMgrPtr->AddTask(1, cmbDisplayAs->GetValue(), wxSContactAccount, wxSDataURL, wxSplitFilename, FilenameFinal, wxSData);
-            FMTimer.UpdateTimestamp();
-            FMTimer.Start(10000, FALSE);
-            
-        }
-        
-    }
-    
-    // Send a notification to update the main window
-    // with the new details.
-    
-    UCNotif *ucd;
-    ucd = new UCNotif;
-    
-    // TODO: Workout nickname settings by priority and
-    // type.
-    
-    ucd->ContactAccount = wxSContactAccount;
-    ucd->ContactFilename = FilenameFinal;
-    ucd->ContactName = cmbDisplayAs->GetValue();
-    ucd->ContactNameArray = ContactData.GetName();
-    
-    for (std::map<int,wxString>::iterator gniter = GeneralNicknamesList.begin();
-         gniter != GeneralNicknamesList.end(); gniter++){
-        
-        ucd->ContactNickname = gniter->second;
-        break;
-        
-    }
-    
-    wxCommandEvent event2(CE_UPDATECONTACTLIST);
-    event2.SetClientData(ucd);
-    wxPostEvent(MainPtr, event2);
-    
-}
-
-void frmContactEditor::SaveCloseContact( wxCommandEvent& event )
-{
+    //wxIcon contacticon;
+    //contacticon.CopyFromBitmap(contacticonbmp);
     
-    // Save the updated contact data and close the form.
+    nbkContact->SetSelection(0);
     
 }
 
@@ -6151,7 +114,6 @@ void frmContactEditor::CloseWindow( wxCloseEvent& event )
     
 }
 
-
 void frmContactEditor::CutText( wxCommandEvent& event )
 {
     // This function left empty for future implementation.
@@ -6174,438 +136,6 @@ void frmContactEditor::SetupContact( wxString AccountName )
     
 }
 
-bool frmContactEditor::ProcessEvent(wxEvent& event)
-{
-    
-    // This section has been taken from the wxWidgets sample code of richtext.cpp
-    // so that simple Cut/Copy/Paste code can be made.
-    
-    // As this code comes from the samples of the wxWidgets library, this is licenced
-    // under the wxWindows Library Licence and is compatable with the LGPL and is
-    // compatable with Xestia Address Book's licence.
-    
-    if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
-    {
-        // Problem: we can get infinite recursion because the events
-        // climb back up to this frame, and repeat.
-        // Assume that command events don't cause another command event
-        // to be called, so we can rely on inCommand not being overwritten
-        
-        static int s_eventType = 0;
-        static wxWindowID s_id = 0;
-        
-        if (s_id != event.GetId() && s_eventType != event.GetEventType())
-        {
-            s_eventType = event.GetEventType();
-            s_id = event.GetId();
-            
-            wxWindow* focusWin = wxFindFocusDescendant(this);
-            if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
-            {
-                //s_command = NULL;
-                s_eventType = 0;
-                s_id = 0;
-                return true;
-            }
-            s_eventType = 0;
-            s_id = 0;
-        }
-        else
-        {
-            return false;
-        }
-    }
-    
-    return wxFrame::ProcessEvent(event);
-}
-
-void frmContactEditor::SetupHeaders()
-{
-    
-    /* Items for the General Tab */
-    
-    SetupColumn(CE_NICKNAME, lboNicknames);
-    SetupColumn(CE_ADDRESS, lboAddresses);
-    SetupColumn(CE_EMAIL, lboEmails);
-    SetupColumn(CE_IM, lboIM);
-    SetupColumn(CE_TELEPHONE, lboTelephone);
-    SetupColumn(CE_LANG, lboLanguages);
-    SetupColumn(CE_TZ, lboTimezones);
-    SetupColumn(CE_GEOPOSITION, lboGeoposition);
-    SetupColumn(CE_RELATED, lboRelated);
-    SetupColumn(CE_WEBSITE, lboWebsites);
-    SetupColumn(CE_TITLE, lboTitles);
-    SetupColumn(CE_ROLE, lboRoles);
-    SetupColumn(CE_ORG, lboOrganisations);
-    SetupColumn(CE_NOTE, lboNotes);
-    
-    /* Items for the Home Tab */
-    
-    SetupColumn(CE_NICKNAME, lboHomeNicknames);
-    SetupColumn(CE_ADDRESS, lboHomeAddresses);
-    SetupColumn(CE_EMAIL, lboHomeEmails);
-    SetupColumn(CE_IM, lboHomeIM);
-    SetupColumn(CE_TELEPHONE, lboHomeTelephone);       
-    SetupColumn(CE_LANG, lboHomeLanguages);
-    SetupColumn(CE_TZ, lboHomeTimezones);
-    SetupColumn(CE_GEOPOSITION, lboHomeGeoposition);
-    SetupColumn(CE_WEBSITE, lboHomeWebsites);
-    SetupColumn(CE_TITLE, lboHomeTitles);
-    SetupColumn(CE_ROLE, lboHomeRoles);
-    SetupColumn(CE_ORG, lboHomeOrganisations);
-    SetupColumn(CE_NOTE, lboHomeNotes);
-    
-    /* Items for the Business Tab */
-    
-    SetupColumn(CE_NICKNAME, lboBusinessNicknames);
-    SetupColumn(CE_ADDRESS, lboBusinessAddresses);
-    SetupColumn(CE_EMAIL, lboBusinessEmail);
-    SetupColumn(CE_IM, lboBusinessIM);
-    SetupColumn(CE_TELEPHONE, lboBusinessTelephone);   
-    SetupColumn(CE_LANG, lboBusinessLanguages);
-    SetupColumn(CE_TZ, lboBusinessTimezones);
-    SetupColumn(CE_GEOPOSITION, lboBusinessGeoposition);
-    SetupColumn(CE_WEBSITE, lboBusinessWebsites);
-    SetupColumn(CE_TITLE, lboBusinessTitles);
-    SetupColumn(CE_ROLE, lboBusinessRoles);
-    SetupColumn(CE_ORG, lboBusinessOrganisations);
-    SetupColumn(CE_NOTE, lboBusinessNotes);    
-    
-    /* Items for the Categories Tab */
-    
-    SetupColumn(CE_CATEGORIES, lboCategories);
-    
-    /* Items for the Groups Tab */
-    
-    SetupColumn(CE_GROUPS, lboGroups);
-    
-    /* Items for the Pictures and Logos Tab */
-    
-    SetupColumn(CE_PICTURES, lboPictures);
-    SetupColumn(CE_PICTURES, lboLogos);        
-    
-    /* Items for the Sounds Tab */
-    
-    SetupColumn(CE_SOUNDS, lboSounds);
-    
-    /* Items for the Calendaring Tab */
-    
-    SetupColumn(CE_CALENDAR, lboCalendarAddresses);
-    SetupColumn(CE_CALENDAR, lboCalendarRequestAddress);
-    SetupColumn(CE_CALENDAR, lboFreeBusyAddresses);    
-    
-    /* Items for the Security Tab */
-    
-    SetupColumn(CE_KEY, lboKeys);
-    
-    /* Items for the Other Tab */
-    
-    SetupColumn(CE_TOKEN, lboVendorNamespace);
-    SetupColumn(CE_TOKEN, lboXToken);
-    
-}
-
-void frmContactEditor::SetupColumn(wxString ColumnType, wxListCtrl *ListCtrl)
-{
-    
-    wxListItem coldata;        
-    
-    if (ColumnType == CE_NICKNAME){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Nickname"));
-        coldata.SetWidth(128);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-    } else if (ColumnType == CE_ADDRESS){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Address"));
-        coldata.SetWidth(128);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Town"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-        coldata.SetId(2);
-        coldata.SetText(_("County"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(2, coldata);
-        
-        coldata.SetId(3);
-        coldata.SetText(_("Post code"));
-        coldata.SetWidth(48);
-        ListCtrl->InsertColumn(3, coldata);
-        
-        coldata.SetId(4);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(4, coldata);            
-        
-    } else if (ColumnType == CE_EMAIL){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Email address"));
-        coldata.SetWidth(304);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_IM){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Address"));
-        coldata.SetWidth(240);
-        ListCtrl->InsertColumn(1, coldata);
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);            
-        
-    } else if (ColumnType == CE_TELEPHONE){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Telephone number"));
-        coldata.SetWidth(128);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);            
-        
-    } else if (ColumnType == CE_LANG){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Language"));
-        coldata.SetWidth(128);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-    } else if (ColumnType == CE_TZ){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Timezone"));
-        coldata.SetWidth(192);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-    } else if (ColumnType == CE_RELATED){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Name/Description"));
-        coldata.SetWidth(192);
-        ListCtrl->InsertColumn(1, coldata);
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);
-        
-    } else if (ColumnType == CE_WEBSITE){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Website"));
-        coldata.SetWidth(288);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_TITLE){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Title"));
-        coldata.SetWidth(288);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_ROLE){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Role"));
-        coldata.SetWidth(288);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_ORG){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Organisation"));
-        coldata.SetWidth(288);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_NOTE){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Notes"));
-        coldata.SetWidth(288);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);    
-        
-    } else if (ColumnType == CE_CATEGORIES){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Category"));
-        coldata.SetWidth(320);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_GROUPS){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Member"));
-        coldata.SetWidth(320);
-        ListCtrl->InsertColumn(0, coldata);
-        
-    } else if (ColumnType == CE_GEOPOSITION){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Geoposition"));
-        coldata.SetWidth(320);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(1, coldata);
-        
-    } else if (ColumnType == CE_PICTURES){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Pictures"));
-        coldata.SetWidth(128);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);
-        
-    } else if (ColumnType == CE_SOUNDS){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Sounds"));
-        coldata.SetWidth(128);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);
-        
-    } else if (ColumnType == CE_CALENDAR){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Calendar Address"));
-        coldata.SetWidth(224);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);
-        
-    } else if (ColumnType == CE_KEY){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Key information"));
-        coldata.SetWidth(224);
-        ListCtrl->InsertColumn(0, coldata);
-        
-        coldata.SetId(1);
-        coldata.SetText(_("Type"));
-        coldata.SetWidth(64);
-        ListCtrl->InsertColumn(1, coldata);            
-        
-        coldata.SetId(2);
-        coldata.SetText(_("Pri."));
-        coldata.SetWidth(32);
-        ListCtrl->InsertColumn(2, coldata);
-        
-    } else if (ColumnType == CE_TOKEN){
-        
-        coldata.SetId(0);
-        coldata.SetText(_("Token"));
-        coldata.SetWidth(320);
-        ListCtrl->InsertColumn(0, coldata);
-        
-    }
-    
-}
-
 int frmContactEditor::GetLastInt(std::map<int, wxString> *MapData){
     
     /*
@@ -7034,636 +564,6 @@ void frmContactEditor::SetupPointers(frmActivityMgr *ActMgr, wxETagProcessTimer
     
 }
 
-void frmContactEditor::ClearContact(){
-    
-    // Clear out the GUI and values.
-    
-    // Clear GUI.
-    
-    txtTitle->Clear();
-    txtForename->Clear();
-    txtSurname->Clear();
-    txtOtherNames->Clear();
-    txtSuffix->Clear();
-    cmbDisplayAs->Clear();
-    cmbDisplayAs->SetValue(wxT(""));
-    wxDateTime EmptyDate;
-    wxBitmap EmptyBitmap;
-    dapAnniversary->SetValue(EmptyDate);
-    dapBirthday->SetValue(EmptyDate);
-    txtBirthday->Clear();
-    txtAnniversary->Clear();
-    cmbGender->Select(0);
-    txtGenderDescription->Clear();
-    
-    lboNicknames->DeleteAllItems();
-    lboHomeNicknames->DeleteAllItems();
-    lboBusinessNicknames->DeleteAllItems();
-    
-    lboAddresses->DeleteAllItems();
-    lboHomeAddresses->DeleteAllItems();
-    lboBusinessAddresses->DeleteAllItems();
-    
-    lboEmails->DeleteAllItems();
-    lboHomeEmails->DeleteAllItems();
-    lboBusinessEmail->DeleteAllItems();
-    
-    lboIM->DeleteAllItems();
-    lboHomeIM->DeleteAllItems();
-    lboBusinessIM->DeleteAllItems();
-    
-    lboTelephone->DeleteAllItems();
-    lboHomeTelephone->DeleteAllItems();
-    lboBusinessTelephone->DeleteAllItems();
-    
-    lboLanguages->DeleteAllItems();
-    lboHomeLanguages->DeleteAllItems();
-    lboBusinessLanguages->DeleteAllItems();
-    
-    lboTimezones->DeleteAllItems();
-    lboHomeTimezones->DeleteAllItems();
-    lboBusinessTimezones->DeleteAllItems();
-    
-    lboGeoposition->DeleteAllItems();
-    lboHomeGeoposition->DeleteAllItems();
-    lboBusinessGeoposition->DeleteAllItems();
-    
-    lboRelated->DeleteAllItems();
-    
-    lboWebsites->DeleteAllItems();
-    lboHomeWebsites->DeleteAllItems();
-    lboBusinessWebsites->DeleteAllItems();
-    
-    lboTitles->DeleteAllItems();
-    lboHomeTitles->DeleteAllItems();
-    lboBusinessTitles->DeleteAllItems();
-    
-    lboRoles->DeleteAllItems();
-    lboHomeRoles->DeleteAllItems();
-    lboBusinessRoles->DeleteAllItems();
-    
-    lboOrganisations->DeleteAllItems();
-    lboHomeOrganisations->DeleteAllItems();
-    lboBusinessOrganisations->DeleteAllItems();
-    
-    lboNotes->DeleteAllItems();
-    lboHomeNotes->DeleteAllItems();
-    lboBusinessNotes->DeleteAllItems();
-    
-    lboCategories->DeleteAllItems();
-    
-    lboGroups->DeleteAllItems();
-    
-    // Clear Picture
-    lboPictures->DeleteAllItems();
-    imgPicture->SetBitmap(EmptyBitmap);
-    
-    // Clear Logo
-    lboLogos->DeleteAllItems();
-    imgLogo->SetBitmap(EmptyBitmap);
-    
-    lboSounds->DeleteAllItems();
-    
-    lboCalendarAddresses->DeleteAllItems();
-    lboCalendarRequestAddress->DeleteAllItems();
-    lboFreeBusyAddresses->DeleteAllItems();
-    
-    lboKeys->DeleteAllItems();
-    
-    lboVendorNamespace->DeleteAllItems();
-    lboXToken->DeleteAllItems();
-    
-    // Clear values out.
-    
-    wxString NameTitle;
-    wxString NameForename;
-    wxString NameSurname;
-    wxString NameOtherNames;
-    wxString NameSuffix;
-    wxString NameNickname;
-    wxString NameDisplayAs;
-    wxString NameLanguage;
-    wxString NameAltID;
-    wxString NameTokens;
-    
-    wxString Birthday;
-    wxString BirthdayAltID;
-    wxString BirthdayCalScale;
-    wxString BirthdayTokens;
-    wxString Anniversary;
-    wxString AnniversaryAltID;
-    wxString AnniversaryCalScale;
-    wxString AnniversaryTokens;
-    
-    wxString Gender;
-    wxString GenderDetails;
-    wxString GenderTokens;
-    
-    wxString UIDToken;
-    
-    /* We don't use these at the moment but we want to keep
-     them for compatability reasons */
-    
-    /*std::map<int, wxString> ExtraFullNames;*/
-    /*std::map<int, wxString> ExtraNicknames;*/
-    
-    FullNamesList.clear();    
-    FullNamesListType.clear();
-    FullNamesListLanguage.clear();
-    FullNamesListAltID.clear();
-    FullNamesListPID.clear();
-    FullNamesListTokens.clear();
-    FullNamesListPref.clear();
-    
-    GeneralNicknamesList.clear();
-    GeneralNicknamesListType.clear();
-    GeneralNicknamesListLanguage.clear();
-    GeneralNicknamesListAltID.clear();
-    GeneralNicknamesListPID.clear();
-    GeneralNicknamesListTokens.clear();        
-    GeneralNicknamesListPref.clear();        
-    
-    GeneralAddressList.clear();
-    GeneralAddressListTown.clear();
-    GeneralAddressListCounty.clear();
-    GeneralAddressListPostCode.clear();
-    GeneralAddressListCountry.clear();
-    GeneralAddressListLabel.clear();
-    GeneralAddressListLang.clear();        
-    GeneralAddressListAltID.clear();
-    GeneralAddressListPID.clear();
-    GeneralAddressListTokens.clear();
-    GeneralAddressListGeo.clear();
-    GeneralAddressListTimezone.clear();        
-    GeneralAddressListType.clear();
-    GeneralAddressListMediatype.clear();
-    GeneralAddressListPref.clear();
-    
-    GeneralEmailList.clear();
-    GeneralEmailListAltID.clear();
-    GeneralEmailListPID.clear();
-    GeneralEmailListType.clear();
-    GeneralEmailListTokens.clear();
-    GeneralEmailListPref.clear();
-    
-    GeneralIMList.clear();
-    GeneralIMListAltID.clear();
-    GeneralIMListPID.clear();
-    GeneralIMListType.clear();
-    GeneralIMListTokens.clear();
-    GeneralIMListMediatype.clear();
-    GeneralIMListPref.clear();
-    
-    GeneralTelephoneList.clear();
-    GeneralTelephoneListAltID.clear();
-    GeneralTelephoneListPID.clear();
-    GeneralTelephoneListType.clear();
-    GeneralTelephoneListTokens.clear();
-    GeneralTelephoneListPref.clear();
-    
-    GeneralLanguageList.clear();
-    GeneralLanguageListAltID.clear();
-    GeneralLanguageListPID.clear();
-    GeneralLanguageListType.clear();
-    GeneralLanguageListTokens.clear();
-    GeneralLanguageListPref.clear();
-    
-    GeneralTZList.clear();
-    GeneralTZListAltID.clear();
-    GeneralTZListPID.clear();
-    GeneralTZListType.clear();
-    GeneralTZListTokens.clear();
-    GeneralTZListMediatype.clear();
-    GeneralTZListPref.clear();
-    
-    GeneralGeographyList.clear();
-    GeneralGeographyListAltID.clear();
-    GeneralGeographyListPID.clear();
-    GeneralGeographyListType.clear();
-    GeneralGeographyListTokens.clear();
-    GeneralGeographyListMediatype.clear();
-    GeneralGeographyListPref.clear();
-    
-    GeneralRelatedList.clear();
-    GeneralRelatedListRelType.clear();
-    GeneralRelatedListLanguage.clear();
-    GeneralRelatedListAltID.clear();
-    GeneralRelatedListPID.clear();
-    GeneralRelatedListType.clear();
-    GeneralRelatedListTokens.clear();
-    GeneralRelatedListPref.clear();
-    
-    GeneralWebsiteList.clear();
-    GeneralWebsiteListAltID.clear();
-    GeneralWebsiteListPID.clear();
-    GeneralWebsiteListType.clear();
-    GeneralWebsiteListTokens.clear();
-    GeneralWebsiteListMediatype.clear();
-    GeneralWebsiteListPref.clear();
-    
-    GeneralTitleList.clear();
-    GeneralTitleListLanguage.clear();        
-    GeneralTitleListAltID.clear();
-    GeneralTitleListPID.clear();
-    GeneralTitleListType.clear();
-    GeneralTitleListTokens.clear();
-    GeneralTitleListPref.clear();
-    
-    GeneralRoleList.clear();
-    GeneralRoleListLanguage.clear();        
-    GeneralRoleListAltID.clear();
-    GeneralRoleListPID.clear();
-    GeneralRoleListType.clear();
-    GeneralRoleListTokens.clear();
-    GeneralRoleListPref.clear();
-    
-    GeneralOrganisationsList.clear();
-    GeneralOrganisationsListLanguage.clear();        
-    GeneralOrganisationsListAltID.clear();
-    GeneralOrganisationsListPID.clear();
-    GeneralOrganisationsListType.clear();
-    GeneralOrganisationsListTokens.clear();
-    GeneralOrganisationsListSortAs.clear();
-    GeneralOrganisationsListPref.clear();
-    
-    GeneralNoteList.clear();
-    GeneralNoteListLanguage.clear();        
-    GeneralNoteListAltID.clear();
-    GeneralNoteListPID.clear();
-    GeneralNoteListType.clear();
-    GeneralNoteListTokens.clear();
-    GeneralNoteListPref.clear();
-    
-    /* Items on Home Tab */        
-    
-    HomeNicknamesList.clear();
-    HomeNicknamesListType.clear();
-    HomeNicknamesListLanguage.clear();
-    HomeNicknamesListAltID.clear();
-    HomeNicknamesListPID.clear();
-    HomeNicknamesListTokens.clear();        
-    HomeNicknamesListPref.clear();        
-    
-    HomeAddressList.clear();
-    HomeAddressListTown.clear();
-    HomeAddressListCounty.clear();
-    HomeAddressListPostCode.clear();
-    HomeAddressListCountry.clear();
-    HomeAddressListLabel.clear();
-    HomeAddressListLang.clear();        
-    HomeAddressListAltID.clear();
-    HomeAddressListPID.clear();
-    HomeAddressListTokens.clear();
-    HomeAddressListGeo.clear();
-    HomeAddressListTimezone.clear();        
-    HomeAddressListType.clear();
-    HomeAddressListMediatype.clear();
-    HomeAddressListPref.clear();
-    
-    HomeEmailList.clear();
-    HomeEmailListAltID.clear();
-    HomeEmailListPID.clear();
-    HomeEmailListType.clear();
-    HomeEmailListTokens.clear();
-    HomeEmailListPref.clear();
-    
-    HomeIMList.clear();
-    HomeIMListAltID.clear();
-    HomeIMListPID.clear();
-    HomeIMListType.clear();
-    HomeIMListTokens.clear();
-    HomeIMListMediatype.clear();
-    HomeIMListPref.clear();
-    
-    HomeTelephoneList.clear();
-    HomeTelephoneListAltID.clear();
-    HomeTelephoneListPID.clear();
-    HomeTelephoneListType.clear();
-    HomeTelephoneListTokens.clear();
-    HomeTelephoneListPref.clear();
-    
-    HomeLanguageList.clear();
-    HomeLanguageListAltID.clear();
-    HomeLanguageListPID.clear();
-    HomeLanguageListType.clear();
-    HomeLanguageListTokens.clear();
-    HomeLanguageListPref.clear();
-    
-    HomeTZList.clear();
-    HomeTZListAltID.clear();
-    HomeTZListPID.clear();
-    HomeTZListType.clear();
-    HomeTZListTokens.clear();
-    HomeTZListMediatype.clear();
-    HomeTZListPref.clear();
-    
-    HomeGeographyList.clear();
-    HomeGeographyListAltID.clear();
-    HomeGeographyListPID.clear();
-    HomeGeographyListType.clear();
-    HomeGeographyListTokens.clear();
-    HomeGeographyListMediatype.clear();
-    HomeGeographyListPref.clear();
-    
-    HomeRelatedList.clear();
-    HomeRelatedListRelType.clear();
-    HomeRelatedListLanguage.clear();
-    HomeRelatedListAltID.clear();
-    HomeRelatedListPID.clear();
-    HomeRelatedListType.clear();
-    HomeRelatedListTokens.clear();
-    HomeRelatedListPref.clear();        
-    
-    HomeWebsiteList.clear();
-    HomeWebsiteListAltID.clear();
-    HomeWebsiteListPID.clear();
-    HomeWebsiteListType.clear();
-    HomeWebsiteListTokens.clear();
-    HomeWebsiteListMediatype.clear();
-    HomeWebsiteListPref.clear();
-    
-    HomeTitleList.clear();
-    HomeTitleListLanguage.clear();
-    HomeTitleListAltID.clear();
-    HomeTitleListPID.clear();
-    HomeTitleListType.clear();
-    HomeTitleListTokens.clear();
-    HomeTitleListPref.clear();
-    
-    HomeRoleList.clear();
-    HomeRoleListLanguage.clear();        
-    HomeRoleListAltID.clear();
-    HomeRoleListPID.clear();
-    HomeRoleListType.clear();
-    HomeRoleListTokens.clear();
-    HomeRoleListPref.clear();
-    
-    HomeOrganisationsList.clear();
-    HomeOrganisationsListLanguage.clear();        
-    HomeOrganisationsListAltID.clear();
-    HomeOrganisationsListPID.clear();
-    HomeOrganisationsListType.clear();
-    HomeOrganisationsListTokens.clear();
-    HomeOrganisationsListSortAs.clear();
-    HomeOrganisationsListPref.clear();
-    
-    HomeNoteList.clear();
-    HomeNoteListLanguage.clear();        
-    HomeNoteListAltID.clear();
-    HomeNoteListPID.clear();
-    HomeNoteListType.clear();
-    HomeNoteListTokens.clear();
-    HomeNoteListPref.clear();        
-    
-    /* Items on the Business tab */
-    
-    BusinessNicknamesList.clear();
-    BusinessNicknamesListType.clear();
-    BusinessNicknamesListLanguage.clear();
-    BusinessNicknamesListAltID.clear();
-    BusinessNicknamesListPID.clear();
-    BusinessNicknamesListTokens.clear();        
-    BusinessNicknamesListPref.clear();        
-    
-    BusinessAddressList.clear();
-    BusinessAddressListTown.clear();
-    BusinessAddressListCounty.clear();
-    BusinessAddressListPostCode.clear();
-    BusinessAddressListCountry.clear();
-    BusinessAddressListLabel.clear();
-    BusinessAddressListLang.clear();        
-    BusinessAddressListAltID.clear();
-    BusinessAddressListPID.clear();
-    BusinessAddressListTokens.clear();
-    BusinessAddressListGeo.clear();
-    BusinessAddressListTimezone.clear();        
-    BusinessAddressListType.clear();
-    BusinessAddressListMediatype.clear();
-    BusinessAddressListPref.clear();
-    
-    BusinessEmailList.clear();
-    BusinessEmailListAltID.clear();
-    BusinessEmailListPID.clear();
-    BusinessEmailListType.clear();
-    BusinessEmailListTokens.clear();
-    BusinessEmailListPref.clear();
-    
-    BusinessIMList.clear();
-    BusinessIMListAltID.clear();
-    BusinessIMListPID.clear();
-    BusinessIMListType.clear();
-    BusinessIMListTokens.clear();
-    BusinessIMListMediatype.clear();
-    BusinessIMListPref.clear();
-    
-    BusinessTelephoneList.clear();
-    BusinessTelephoneListAltID.clear();
-    BusinessTelephoneListPID.clear();
-    BusinessTelephoneListType.clear();
-    BusinessTelephoneListTokens.clear();
-    BusinessTelephoneListPref.clear();
-    
-    BusinessLanguageList.clear();
-    BusinessLanguageListAltID.clear();
-    BusinessLanguageListPID.clear();
-    BusinessLanguageListType.clear();
-    BusinessLanguageListTokens.clear();
-    BusinessLanguageListPref.clear();
-    
-    BusinessTZList.clear();
-    BusinessTZListAltID.clear();
-    BusinessTZListPID.clear();
-    BusinessTZListType.clear();
-    BusinessTZListTokens.clear();
-    BusinessTZListMediatype.clear();
-    BusinessTZListPref.clear();
-    
-    BusinessGeographyList.clear();
-    BusinessGeographyListAltID.clear();
-    BusinessGeographyListPID.clear();
-    BusinessGeographyListType.clear();
-    BusinessGeographyListTokens.clear();
-    BusinessGeographyListMediatype.clear();
-    BusinessGeographyListPref.clear();
-    
-    BusinessRelatedList.clear();
-    BusinessRelatedListRelType.clear();
-    BusinessRelatedListLanguage.clear();
-    BusinessRelatedListAltID.clear();
-    BusinessRelatedListPID.clear();
-    BusinessRelatedListType.clear();
-    BusinessRelatedListTokens.clear();
-    BusinessRelatedListPref.clear();            
-    
-    BusinessWebsiteList.clear();
-    BusinessWebsiteListAltID.clear();
-    BusinessWebsiteListPID.clear();
-    BusinessWebsiteListType.clear();
-    BusinessWebsiteListTokens.clear();
-    BusinessWebsiteListMediatype.clear();
-    BusinessWebsiteListPref.clear();
-    
-    BusinessTitleList.clear();
-    BusinessTitleListLanguage.clear();        
-    BusinessTitleListAltID.clear();
-    BusinessTitleListPID.clear();
-    BusinessTitleListType.clear();
-    BusinessTitleListTokens.clear();
-    BusinessTitleListPref.clear();
-    
-    BusinessRoleList.clear();
-    BusinessRoleListLanguage.clear();        
-    BusinessRoleListAltID.clear();
-    BusinessRoleListPID.clear();
-    BusinessRoleListType.clear();
-    BusinessRoleListTokens.clear();
-    BusinessRoleListPref.clear();
-    
-    BusinessOrganisationsList.clear();
-    BusinessOrganisationsListLanguage.clear();        
-    BusinessOrganisationsListAltID.clear();
-    BusinessOrganisationsListPID.clear();
-    BusinessOrganisationsListType.clear();
-    BusinessOrganisationsListTokens.clear();
-    BusinessOrganisationsListSortAs.clear();        
-    BusinessOrganisationsListPref.clear();
-    
-    BusinessNoteList.clear();
-    BusinessNoteListLanguage.clear();        
-    BusinessNoteListAltID.clear();
-    BusinessNoteListPID.clear();
-    BusinessNoteListType.clear();
-    BusinessNoteListTokens.clear();
-    BusinessNoteListPref.clear();        
-    
-    /* Items on the Categories tab */
-    
-    CategoriesList.clear();
-    CategoriesListAltID.clear();
-    CategoriesListPID.clear();
-    CategoriesListType.clear();
-    CategoriesListTokens.clear();
-    CategoriesListPref.clear();    
-    
-    /* Items on the Groups tab */
-    
-    GroupsList.clear();
-    GroupsListAltID.clear();
-    GroupsListPID.clear();
-    GroupsListType.clear();
-    GroupsListTokens.clear();
-    GroupsListPref.clear();
-    
-    /* Items on the Pictures tab */
-    
-    PicturesList.clear();
-    PicturesListAltID.clear();
-    PicturesListPID.clear();
-    PicturesListType.clear();
-    PicturesListPicEncType.clear();
-    PicturesListPictureType.clear();
-    PicturesListTokens.clear();
-    PicturesListMediatype.clear();        
-    PicturesListPref.clear();
-    
-    /* Items on the Logos tab */
-    
-    LogosList.clear();
-    LogosListAltID.clear();
-    LogosListPID.clear();
-    LogosListType.clear();
-    LogosListPicEncType.clear();        
-    LogosListPictureType.clear();
-    LogosListTokens.clear();
-    LogosListMediatype.clear();        
-    LogosListPref.clear();
-    
-    /* Items on the Sounds tab */
-    
-    SoundsList.clear();
-    SoundsListAltID.clear();
-    SoundsListPID.clear();
-    SoundsListType.clear();
-    SoundsListAudioEncType.clear();        
-    SoundsListAudioType.clear();        
-    SoundsListTokens.clear();
-    SoundsListMediatype.clear();        
-    SoundsListPref.clear();    
-    
-    /* Items on the Calendaring tab */
-    
-    CalendarList.clear();
-    CalendarListAltID.clear();
-    CalendarListPID.clear();
-    CalendarListType.clear();
-    CalendarListTokens.clear();
-    CalendarListMediatype.clear();        
-    CalendarListPref.clear();
-    
-    CalendarRequestList.clear();
-    CalendarRequestListAltID.clear();
-    CalendarRequestListPID.clear();
-    CalendarRequestListType.clear();
-    CalendarRequestListTokens.clear();
-    CalendarRequestListMediatype.clear();        
-    CalendarRequestListPref.clear();        
-    
-    FreeBusyList.clear();
-    FreeBusyListAltID.clear();
-    FreeBusyListPID.clear();
-    FreeBusyListType.clear();
-    FreeBusyListTokens.clear();
-    FreeBusyListMediatype.clear();        
-    FreeBusyListPref.clear();
-    
-    /* Items on the Security tab */
-    
-    KeyList.clear();
-    KeyListAltID.clear();
-    KeyListPID.clear();
-    KeyListKeyType.clear();        
-    KeyListDataType.clear();        
-    KeyListDataEncType.clear();
-    KeyListType.clear();
-    KeyListTokens.clear();
-    KeyListPref.clear();
-    
-    /* Items on the Other tab */
-    
-    VendorList.clear();
-    VendorListPEN.clear();
-    VendorListElement.clear();
-    
-    XTokenList.clear();        
-    XTokenListTokens.clear();
-    
-    wxSContactFilename.Clear();
-    boolContactModified = FALSE;
-    intSeekSelectedData = 0;
-    
-    /* Section for saving/loading data */
-    
-    ETag.Clear();
-    ETagOriginal.Clear();
-    
-    strValue.Clear();
-    strValue2.Clear();
-    strValue3.Clear();
-    
-    boolValue = FALSE;
-    boolValue2 = FALSE;
-    intValue = 0;
-    intValue2 = 0;
-    intValue3 = 0;
-    BinaryDataProc = FALSE;
-    EditMode = TRUE;
-    DialogOpen = FALSE;
-    
-    PictureImage = wxNullBitmap;
-    LogoImage = wxNullBitmap;
-    
-}
-
 void frmContactEditor::ContactFileChanged( wxCommandEvent &event ){
     
     // Stop the timer.
@@ -7725,49 +625,4 @@ void frmContactEditor::SetUID(int UID){
     
     ContactEditorUID = UID;
     
-}
-
-void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
-    
-    // Generate a drop down list of common names to use for the display as drop down box.
-    
-    wxString SetValue = cmbDisplayAs->GetValue();
-    
-    cmbDisplayAs->Clear();
-    cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
-    if (!txtOtherNames->GetValue().IsEmpty()){
-        
-        cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());    
-        
-    }
-    cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue());        
-    if (!txtOtherNames->GetValue().IsEmpty()){
-        
-        cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
-        
-    }
-    if (!txtTitle->GetValue().IsEmpty()){
-        cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
-    }
-    
-    cmbDisplayAs->SetValue(SetValue);
-    
-    this->SetTitle(cmbDisplayAs->GetValue());
-    
-}
-
-void frmContactEditor::UpdateName( wxCommandEvent &event ){
-    
-    this->SetTitle(cmbDisplayAs->GetValue());
-    
-    WindowData *WData = new WindowData;
-    
-    WData->DataType = 1;
-    WData->WindowPointer = this;
-    WData->WindowID = ContactEditorUID;
-    
-    wxCommandEvent editevent(WINDOW_EDIT);
-    editevent.SetClientData(WData);
-    wxPostEvent(GetParent(), editevent);
-    
 }
\ No newline at end of file
index f4dccc0..f0e73a7 100644 (file)
@@ -22,6 +22,28 @@ Subclass of frmContactEditorADT, which is generated by wxFormBuilder.
 #include "../frmActivityMgr.h"
 #include "../frmMain.h"
 
+#define CE_NICKNAME wxT("Nickname")
+#define CE_ADDRESS wxT("Address")
+#define CE_EMAIL wxT("Email")
+#define CE_IM wxT("IM")
+#define CE_TELEPHONE wxT("Telephone")
+#define CE_LANG wxT("Languages")
+#define CE_TZ wxT("Timezone")
+#define CE_RELATED wxT("Related")
+#define CE_WEBSITE wxT("Websites")
+#define CE_TITLE wxT("Titles")
+#define CE_GEOPOSITION wxT("Geoposition")
+#define CE_ROLE wxT("Roles")
+#define CE_ORG wxT("Organisations")
+#define CE_NOTE wxT("Notes")
+#define CE_CATEGORIES wxT("Categories")
+#define CE_GROUPS wxT("Groups")
+#define CE_PICTURES wxT("Pictures")
+#define CE_SOUNDS wxT("Sounds")
+#define CE_CALENDAR wxT("Calendar")
+#define CE_KEY wxT("Key")
+#define CE_TOKEN wxT("Token")
+
 //// end generated include
 
 struct frmMain;
@@ -614,6 +636,41 @@ class frmContactEditor : public frmContactEditorADT
                void ResetSaveProcessData();
                void ContactFileChanged( wxCommandEvent &event );
                void ClearContact();
+               
+               /* Functions for loading contacts */
+               void LoadKind(wxString KindType);
+               void LoadMember(wxString MemberData, int *GroupCount);
+               void LoadFN(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *FNCount, 
+                       bool *FNProcessed, vCard *ContactData);
+               void LoadN(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *NameProcessed, 
+                       vCard *ContactData);
+               void LoadNickname(wxString wxSpropertySeg1, wxString wxSPropertySeg2, 
+                       int *NicknameCount, vCard *ContactData);
+               void LoadGender(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *GenderProcessed, 
+                       vCard *ContactData);
+               void LoadBDay(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *BirthdayProcessed);
+               void LoadAnniversary(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *AnniversaryProcessed);
+               void LoadTimeZone(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *TZCount);
+               void LoadADR(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *ADRCount);
+               void LoadEmail(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *ADRCount);
+               void LoadIM(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *IMPPCount);
+               void LoadTelephone(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *TelCount);
+               void LoadLanguage(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *LangCount);
+               void LoadGeo(wxString wxSProptertySeg1, wxString wxSPropertySeg2, int *GeoCount);
+               void LoadRelated(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *RelatedCount);
+               void LoadURL(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *URLCount);
+               void LoadTitle(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *TitleCount);
+               void LoadRole(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *RoleCount);
+               void LoadOrg(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *OrgCount);
+               void LoadNote(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *NoteCount);
+               void LoadCategory(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *CategoryCount);
+               void LoadPhoto(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *PhotoCount);
+               void LoadLogo(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *PhotoCount);
+               void LoadSound(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *SoundCount);
+               void LoadCalURI(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *CalAdrCount);
+               void LoadCalAdrURI(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *CalReqAdrCount);
+               void LoadCalFreeBusy(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *FreeBusyCount);
+               void LoadKey(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *KeyCount);
        
                int intValueSeek = 1;
                bool IsGroup = FALSE;
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy