+// frmContactEditor-Load.cpp - frmContactEditor load contact subroutines.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
+
#include <map>
#include <wx/ffile.h>
#include "../vcard/vcard.h"
#include "../common/textprocessing.h"
#include "../common/dirs.h"
+#include "cdo/ContactDataObject.h"
bool frmContactEditor::LoadContact(wxString Filename){
wxString wxSContactString;
wxString ContactLine;
vCard ContactData;
- XABViewMode XVMData = MainPtr->GetViewMode();
+ XABViewMode XVMData;
+ if (StartupEditMode == FALSE){
+ XVMData = MainPtr->GetViewMode();
+ }
wxSContactFilename = Filename;
// Check if we are using wxWidgets version 2.8 or less and
// execute the required command accordingly.
-
+/*
#if wxABI_VERSION < 20900
ContactFile.Open(Filename.c_str(), wxT("r"));
#else
}
- ContactFile.ReadAll(&wxSContactString, wxConvAuto());
+ ContactEditorData.LoadFile(Filename);
+ ContactFile.ReadAll(&wxSContactString, wxConvAuto());
+
// Split the lines.
std::map<int, wxString> ContactFileLines;
ContactLineSeek++;
}
+*/
+ ContactLoadStatus LoadResult = ContactEditorData.LoadFile(Filename);
+
+ switch(LoadResult){
+
+ case CONTACTLOAD_OK:
+ break;
+ case CONTACTLOAD_FILEMISSING:
+ wxMessageBox(_("The file with the filename given does not exist."),
+ _("Contact not found"), wxICON_ERROR);
+ this->Close();
+ return FALSE;
+ break;
+ case CONTACTLOAD_FILEERROR:
+ wxMessageBox(_("The file with the filename given cannot be opened due to an error while trying open it."),
+ _("Error loading contact"), wxICON_ERROR);
+ this->Close();
+ return FALSE;
+ break;
+ case CONTACTLOAD_FILEINVALIDFORMAT:
+ wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."),
+ _("Contact not supported"), wxICON_ERROR);
+ this->Close();
+ return FALSE;
+ break;
+ case CONTACTLOAD_FILEBASESPECFAIL:
+ wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."),
+ _("Contact not supported"), wxICON_ERROR);
+ this->Close();
+ return FALSE;
+ break;
+
+ };
+
// Get the line.
bool QuoteMode = FALSE;
bool HasExtraNicknames = FALSE;
bool IgnoreGender = FALSE;
bool ExtraLineSeek = TRUE;
- bool BirthdayProcessed = FALSE;
- bool AnniversaryProcessed = FALSE;
+ //bool BirthdayProcessed = FALSE;
+ //bool AnniversaryProcessed = FALSE;
bool FNProcessed = FALSE;
bool GenderProcessed = FALSE;
bool NameProcessed = FALSE;
- bool UIDProcessed = FALSE;
- bool KindProcessed = FALSE;
+ //bool UIDProcessed = FALSE;
+ //bool KindProcessed = FALSE;
bool ETagFound = FALSE;
bool ETagOrigFound = FALSE;
+ bool VersionProcessed = FALSE;
int intExtraNickname = 0;
wxString wxSProperty;
wxString wxSPropertySeg1;
wxString wxSPropertySeg2;
wxString wxSPropertyNextLine;
- int ContactLineLen = 0;
+ size_t ContactLineLen = 0;
int QuoteBreakPoint = 0;
int FNCount = 0;
int NameCount = 0;
int XTokenCount = 0;
//int intValueSeek = 1;
- for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
+ // Process the unique ID (UID)
+
+ // Do nothing at the moment.
+
+ // Process the contact type (KIND) (frmContactEditor-LoadGroup.cpp)
+
+ LoadKind(&ContactEditorData.ContactKind);
+
+ // Process the Birthday (BDAY) (frmContactEditor-LoadBADays.cpp)
+
+ LoadBirthday(&ContactEditorData.Birthday, &ContactEditorData.BirthdayText);
+
+ // Process the Anniversary (ANNIVERSARY) (frmContactEditor-LoadBADays.cpp)
+
+ LoadAnniversary(&ContactEditorData.Anniversary, &ContactEditorData.AnniversaryText);
+
+ // Process the Gender (GENDER) (frmContactEditor-LoadGender.cpp)
+
+ LoadGender(&ContactEditorData.Gender, &ContactEditorData.GenderDetails);
+
+ // Process the Name (N) (frmContactEditor-LoadName.cpp)
+
+ LoadName(&ContactEditorData.NameTitle, &ContactEditorData.NameForename,
+ &ContactEditorData.NameSurname, &ContactEditorData.NameOtherNames,
+ &ContactEditorData.NameSuffix);
+
+ // Process the group members (MEMBER) (frmContactEditor-LoadGroup.cpp)
+
+ LoadMember(&ContactEditorData.GroupsList);
+
+ // Process the addresses (ADR) (frmContactEditor-LoadAddress.cpp)
+
+ LoadAddress(&ContactEditorData.GeneralAddressList,
+ &ContactEditorData.GeneralAddressListTown,
+ &ContactEditorData.GeneralAddressListCounty,
+ &ContactEditorData.GeneralAddressListPostCode,
+ &ContactEditorData.GeneralAddressListPref,
+ &ContactEditorData.HomeAddressList,
+ &ContactEditorData.HomeAddressListTown,
+ &ContactEditorData.HomeAddressListCounty,
+ &ContactEditorData.HomeAddressListPostCode,
+ &ContactEditorData.HomeAddressListPref,
+ &ContactEditorData.BusinessAddressList,
+ &ContactEditorData.BusinessAddressListTown,
+ &ContactEditorData.BusinessAddressListCounty,
+ &ContactEditorData.BusinessAddressListPostCode,
+ &ContactEditorData.BusinessAddressListPref,
+ &ADRCount);
+
+ // Process the timezones (TZ).
+
+ LoadData(&ContactEditorData.GeneralTZList,
+ &ContactEditorData.GeneralTZListPref,
+ lboTimezones,
+ &ContactEditorData.HomeTZList,
+ &ContactEditorData.HomeTZListPref,
+ lboHomeTimezones,
+ &ContactEditorData.BusinessTZList,
+ &ContactEditorData.BusinessTZListPref,
+ lboBusinessTimezones,
+ &TZCount);
+
+ // Process the emails (EMAIL).
+
+ LoadData(&ContactEditorData.GeneralEmailList,
+ &ContactEditorData.GeneralEmailListPref,
+ lboEmails,
+ &ContactEditorData.HomeEmailList,
+ &ContactEditorData.HomeEmailListPref,
+ lboHomeEmails,
+ &ContactEditorData.BusinessEmailList,
+ &ContactEditorData.BusinessEmailListPref,
+ lboBusinessEmail,
+ &EmailCount);
+
+ // Process the nicknames (NICKNAME).
+
+ LoadData(&ContactEditorData.GeneralNicknamesList,
+ &ContactEditorData.GeneralNicknamesListPref,
+ lboNicknames,
+ &ContactEditorData.HomeNicknamesList,
+ &ContactEditorData.HomeNicknamesListPref,
+ lboHomeNicknames,
+ &ContactEditorData.BusinessNicknamesList,
+ &ContactEditorData.BusinessNicknamesListPref,
+ lboBusinessNicknames,
+ &NicknameCount);
+
+ // Process the languages (LANG).
+
+ LoadData(&ContactEditorData.GeneralLanguageList,
+ &ContactEditorData.GeneralLanguageListPref,
+ lboLanguages,
+ &ContactEditorData.HomeLanguageList,
+ &ContactEditorData.HomeLanguageListPref,
+ lboHomeLanguages,
+ &ContactEditorData.BusinessLanguageList,
+ &ContactEditorData.BusinessLanguageListPref,
+ lboBusinessLanguages,
+ &LangCount);
+
+ // Process the geopositiosn (GEO).
+
+ LoadData(&ContactEditorData.GeneralGeographyList,
+ &ContactEditorData.GeneralGeographyListPref,
+ lboGeoposition,
+ &ContactEditorData.HomeGeographyList,
+ &ContactEditorData.HomeGeographyListPref,
+ lboHomeGeoposition,
+ &ContactEditorData.BusinessGeographyList,
+ &ContactEditorData.BusinessGeographyListPref,
+ lboBusinessGeoposition,
+ &GeoCount);
+
+ // Process the websites (URL).
+
+ LoadData(&ContactEditorData.GeneralWebsiteList,
+ &ContactEditorData.GeneralWebsiteListPref,
+ lboWebsites,
+ &ContactEditorData.HomeWebsiteList,
+ &ContactEditorData.HomeWebsiteListPref,
+ lboHomeWebsites,
+ &ContactEditorData.BusinessWebsiteList,
+ &ContactEditorData.BusinessWebsiteListPref,
+ lboBusinessWebsites,
+ &URLCount);
+
+ // Process the titles (TITLE).
+
+ LoadData(&ContactEditorData.GeneralTitleList,
+ &ContactEditorData.GeneralTitleListPref,
+ lboTitles,
+ &ContactEditorData.HomeTitleList,
+ &ContactEditorData.HomeTitleListPref,
+ lboHomeTitles,
+ &ContactEditorData.BusinessTitleList,
+ &ContactEditorData.BusinessTitleListPref,
+ lboBusinessTitles,
+ &TitleCount);
+
+ // Process the roles (ROLE).
+
+ LoadData(&ContactEditorData.GeneralRoleList,
+ &ContactEditorData.GeneralRoleListPref,
+ lboRoles,
+ &ContactEditorData.HomeRoleList,
+ &ContactEditorData.HomeRoleListPref,
+ lboHomeRoles,
+ &ContactEditorData.BusinessRoleList,
+ &ContactEditorData.BusinessRoleListPref,
+ lboBusinessRoles,
+ &RoleCount);
+
+ // Process the roles (ORG).
+
+ LoadData(&ContactEditorData.GeneralOrganisationsList,
+ &ContactEditorData.GeneralOrganisationsListPref,
+ lboOrganisations,
+ &ContactEditorData.HomeOrganisationsList,
+ &ContactEditorData.HomeOrganisationsListPref,
+ lboHomeOrganisations,
+ &ContactEditorData.BusinessOrganisationsList,
+ &ContactEditorData.BusinessOrganisationsListPref,
+ lboBusinessOrganisations,
+ &OrgCount);
+
+ // Process the notes (NOTE).
+
+ LoadData(&ContactEditorData.GeneralNoteList,
+ &ContactEditorData.GeneralNoteListPref,
+ lboNotes,
+ &ContactEditorData.HomeNoteList,
+ &ContactEditorData.HomeNoteListPref,
+ lboHomeNotes,
+ &ContactEditorData.BusinessNoteList,
+ &ContactEditorData.BusinessNoteListPref,
+ lboBusinessNotes,
+ &NoteCount);
+
+ // Process the categories (CATEGORIES).
+
+ LoadData(&ContactEditorData.CategoriesList,
+ &ContactEditorData.CategoriesListPref,
+ lboCategories,
+ &CategoryCount);
+
+ // Process the telephone numbers (TEL).
+
+ LoadData(&ContactEditorData.GeneralTelephoneList,
+ &ContactEditorData.GeneralTelephoneListPref,
+ &ContactEditorData.GeneralTelephoneListTypeInfo,
+ lboTelephone,
+ &ContactEditorData.HomeTelephoneList,
+ &ContactEditorData.HomeTelephoneListPref,
+ &ContactEditorData.HomeTelephoneListTypeInfo,
+ lboHomeTelephone,
+ &ContactEditorData.BusinessTelephoneList,
+ &ContactEditorData.BusinessTelephoneListPref,
+ &ContactEditorData.BusinessTelephoneListTypeInfo,
+ lboBusinessTelephone,
+ &TelCount);
+
+ // Process the instant messaging (IMPP).
+
+ LoadData(&ContactEditorData.GeneralIMListTypeInfo,
+ &ContactEditorData.GeneralIMListPref,
+ &ContactEditorData.GeneralIMList,
+ lboIM,
+ &ContactEditorData.HomeIMListTypeInfo,
+ &ContactEditorData.HomeIMListPref,
+ &ContactEditorData.HomeIMList,
+ lboHomeIM,
+ &ContactEditorData.BusinessIMListTypeInfo,
+ &ContactEditorData.BusinessIMListPref,
+ &ContactEditorData.BusinessIMList,
+ lboBusinessIM,
+ &IMPPCount);
+
+ // Process the photos (PHOTO).
+
+ LoadPictureData("PHOTO",
+ &ContactEditorData.PicturesList,
+ &ContactEditorData.PicturesListPref,
+ &ContactEditorData.PicturesListType,
+ lboPictures,
+ &PhotoCount);
+
+ // Process the logos (LOGO).
+
+ LoadPictureData("LOGO",
+ &ContactEditorData.LogosList,
+ &ContactEditorData.LogosListPref,
+ &ContactEditorData.LogosListType,
+ lboLogos,
+ &LogoCount);
+
+ // Process the sounds (SOUND).
+
+ LoadPictureData("SOUND",
+ &ContactEditorData.SoundsList,
+ &ContactEditorData.SoundsListPref,
+ &ContactEditorData.SoundsListType,
+ lboSounds,
+ &SoundCount);
+
+ // Process the calendar addresses (CALURI).
+
+ LoadData("CALURI",
+ &ContactEditorData.CalendarList,
+ &ContactEditorData.CalendarListPref,
+ &ContactEditorData.CalendarListType,
+ NULL,
+ lboCalendarAddresses,
+ &CalAdrCount);
+
+ // Process the calendar request addresses (CALADRURI).
+
+ LoadData("CALADRURI",
+ &ContactEditorData.CalendarRequestList,
+ &ContactEditorData.CalendarRequestListPref,
+ &ContactEditorData.CalendarRequestListType,
+ NULL,
+ lboCalendarRequestAddress,
+ &CalReqAdrCount);
+
+ // Process the free busy addresses (FBURL).
+
+ LoadData("FBURL",
+ &ContactEditorData.FreeBusyList,
+ &ContactEditorData.FreeBusyListPref,
+ &ContactEditorData.FreeBusyListType,
+ NULL,
+ lboFreeBusyAddresses,
+ &FreeBusyCount);
+
+ // Process the keys. (KEY)
+
+ LoadData("KEY",
+ &ContactEditorData.KeyList,
+ &ContactEditorData.KeyListPref,
+ &ContactEditorData.KeyListType,
+ &ContactEditorData.KeyListDataType,
+ lboKeys,
+ &KeyCount);
+
+ // Process the vendor specific information (VND-*).
+
+ LoadVendorData(&ContactEditorData.VendorListPEN,
+ &ContactEditorData.VendorListElement,
+ lboVendorNamespace,
+ &VendorCount);
+
+ // Process the X-Tokens (X-*).
+
+ LoadXTokenData(&ContactEditorData.XTokenListTokens,
+ lboXToken,
+ &XTokenCount);
+
+ // Process the related people (RELATED).
+
+ LoadRelatedData(&ContactEditorData.GeneralRelatedList,
+ &ContactEditorData.GeneralRelatedListPref,
+ &ContactEditorData.GeneralRelatedListType,
+ lboRelated,
+ &RelatedCount);
+
+ // Process the full name (FN).
+
+ LoadData(&ContactEditorData.FullNamesList,
+ cmbDisplayAs);
+
+ /*for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
iter != ContactFileLines.end(); ++iter){
// Find the colon which splits the start bit from the data part.
// Add the data into the contact editor depending on what it is.
- if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- if (wxSPropertySeg2 == wxT("individual")){
-
- cmbType->SetSelection(1);
-
- } else if (wxSPropertySeg2 == wxT("group")){
-
- cmbType->SetSelection(2);
- IsGroup = TRUE;
-
- } else if (wxSPropertySeg2 == wxT("org")){
-
- cmbType->SetSelection(3);
-
- } else if (wxSPropertySeg2 == wxT("location")){
-
- cmbType->SetSelection(4);
-
- } else {
-
- cmbType->SetSelection(0);
+ if (wxSProperty == wxT("VERSION") && VersionProcessed == FALSE){
+
+ // Check if version is 4.0, otherwise don't
+ // load.
+ if (wxSPropertySeg2 != wxT("4.0")){
+ wxMessageBox(_("This file is not a vCard 4.0 contact and is not supported under Xestia Address Book."),
+ _("Contact not supported"), wxICON_ERROR);
+ this->Close();
+ return FALSE;
}
- wxCommandEvent nullevent;
-
- UpdateMembersTab(nullevent);
-
- } else if (wxSProperty == wxT("MEMBER")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 8;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- // Go through the list of contacts for the account and find the matching UID.
- // If contact with UID doesn't match then say (unknown contact).
-
- wxString AccountDirFinal = GetAccountDir(wxSContactAccount, FALSE);
-
- //wxString vcardfilenamewxs;
- wxString vCardFilename;
- wxString vCardFilenameFull;
- wxString vCardDataString;
- //wxStringTokenizer vcardfileline;
- wxString lwxs;
- wxString setname, setvalue;
- //vCardNames = new std::map<wxString, wxString, std::greater<wxString>>;
- std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
- std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
- int ContactIndex = 0;
-
- wxDir vcardaccdir(AccountDirFinal);
-
- bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
- while(ProcFiles){
-
- if (vCardFilename.Right(4) == wxT(".vcf") ||
- vCardFilename.Right(4) == wxT(".VCF") ||
- vCardFilename.Right(5) == wxT(".vcard") ||
- vCardFilename.Right(5) == wxT(".VCARD")){
-
- vCard Person;
+ VersionProcessed = TRUE;
- vCardFilenameFull.Append(AccountDirFinal);
- vCardFilenameFull.Append(wxT("/"));
- vCardFilenameFull.Append(vCardFilename);
+ }/* if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){
- Person.LoadFile(vCardFilenameFull);
+ // See frmContactEditor-LoadGroup.cpp
- if (wxSPropertySeg2.Left(9) == wxT("urn:uuid:")){
+ LoadKind(wxSPropertySeg2);
- wxString NewPropValue;
- NewPropValue = wxSPropertySeg2.Mid(9, wxString::npos);
- wxSPropertySeg2 = NewPropValue;
+ }/* else if (wxSProperty == wxT("MEMBER")){
- }
+ // See frmContactEditor-LoadGroup.cpp
+
+ LoadMember(wxSPropertySeg2, &GroupCount);
- if (Person.MeetBaseSpecification()){
-
- wxString KindStatus = Person.Get(wxT("KIND"));
+ } else if (wxSProperty == wxT("FN")){
- if (KindStatus == wxT("group")){
+ // See frmContactEditor-LoadName.cpp
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
- continue;
+ LoadFN(wxSPropertySeg1, wxSPropertySeg2, &FNCount, &FNProcessed, &ContactData);
- }
+ } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
- wxString PersonName = Person.Get(wxT("N"));
- wxString PersonUID = Person.Get(wxT("UID"));
- wxString PersonFilename = vCardFilenameFull;
-
- if (PersonUID != wxSPropertySeg2){
-
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
- continue;
-
- }
+ // See frmContactEditor-LoadName.cpp
- //ContactsNames.insert(std::make_pair(PersonName, ContactIndex));
- //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID));
-
- if (XVMData.SortMode == 1){
-
- // Split the name into sections.
+ LoadN(wxSPropertySeg1, wxSPropertySeg2, &NameProcessed, &ContactData);
+
+ } else if (wxSProperty == wxT("NICKNAME")){
- vCardDataString = Person.Get(wxT("N"));
-
- vCardName NameData = Person.GetName();
-
- vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
-
- } else if (XVMData.SortMode == 2){
-
- // Split the name into sections.
-
- vCardName NameData = Person.GetName();
-
- vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
-
- } else if (XVMData.SortMode == 3){
-
- // Check and make sure that the top most nickname is used.
-
- vCardDataString = Person.Get(wxT("NICKNAME"));
-
- if (vCardDataString.IsEmpty()){
+ // See frmContactEditor-LoadNickname.cpp
- vCardDataString = wxT("(no nickname)");
+ LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData);
- }
-
- } else if (XVMData.SortMode == 4){
-
- vCardDataString = Person.Get(wxT("FN"));
-
- }
-
- if (XVMData.AscendingMode == TRUE){
- vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID));
- } else {
- vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID));
- }
+ } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){
- } else {
-
- }
-
-
-
- }
-
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
-
- }
-
- if (XVMData.AscendingMode == TRUE){
-
- for (std::map<wxString,wxString>::iterator iter = vCardNamesAsc.begin();
- iter != vCardNamesAsc.end(); ++iter){
+ // See frmContactEditor-LoadGender.cpp
+
+ LoadGender(wxSPropertySeg1, wxSPropertySeg2, &GenderProcessed, &ContactData);
+
+ } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){
- wxListItem ItemData;
-
- ItemData.SetId(0);
- ItemData.SetText(iter->first);
+ // See frmContactEditor-LoadBADays.cpp
+
+ LoadBDay(wxSPropertySeg1, wxSPropertySeg2, &BirthdayProcessed);
+
+ } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
- lboGroups->InsertItem(ItemData);
-
- GroupsList.insert(std::make_pair(intValueSeek, iter->second));
+ // See frmContactEditor-LoadBADays.cpp
- }
+ LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed);
+ } else if (wxSProperty == wxT("TZ")){
- } else {
+ // See frmContactEditor-LoadTimeZone.cpp
- for (std::map<wxString,wxString>::iterator iter = vCardNamesDsc.begin();
- iter != vCardNamesDsc.end(); ++iter){
-
- wxListItem ItemData;
-
- ItemData.SetId(0);
- ItemData.SetText(iter->first);
-
- lboGroups->InsertItem(ItemData);
-
- GroupsList.insert(std::make_pair(intValueSeek, iter->second));
-
- }
-
- }
+ LoadTimeZone(wxSPropertySeg1, wxSPropertySeg2, &TZCount);
+
+ } else if (wxSProperty == wxT("ADR")){
- GroupCount++;
- intValueSeek++;
+ // See frmContactEditor-LoadAddress.cpp
- } else if (wxSProperty == wxT("FN")){
+ LoadADR(wxSPropertySeg1, wxSPropertySeg2, &ADRCount);
- /*
+ } else if (wxSProperty == wxT("EMAIL")){
- NameDisplayAs = wxSPropertySeg2;
- cmbDisplayAs->SetValue(ContactData.Convert(wxSPropertySeg2, TRUE));
+ // See frmContactEditor-LoadEmail.cpp
- */
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 4;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 3;
+ LoadEmail(wxSPropertySeg1, wxSPropertySeg2, &EmailCount);
+
+ } else if (wxSProperty == wxT("IMPP")){
+
+ // See frmContactEditor-LoadIM.cpp
+
+ LoadIM(wxSPropertySeg1, wxSPropertySeg2, &IMPPCount);
+
+ }/* else if (wxSProperty == wxT("TEL")){
+
+ // See frmContactEditor-LoadTelephone.cpp
+
+ LoadTelephone(wxSPropertySeg1, wxSPropertySeg2, &TelCount);
+
+ } else if (wxSProperty == wxT("LANG")){
+
+ // See frmContactEditor-LoadLanguage.cpp
- // Look for type before continuing.
+ LoadLanguage(wxSPropertySeg1, wxSPropertySeg2, &LangCount);
+
+ } else if (wxSProperty == wxT("GEO")){
+
+ // See frmContactEditor-LoadGeo.cpp
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ LoadGeo(wxSPropertySeg1, wxSPropertySeg2, &GeoCount);
+
+ } else if (wxSProperty == wxT("RELATED")){
- SLiter = SplitLength.find(intiter->first);
+ // See fromContactEditor-LoadRelated.cpp
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
+ LoadRelated(wxSPropertySeg1, wxSPropertySeg2, &RelatedCount);
+
+ } else if (wxSProperty == wxT("URL")){
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
+ // See frmContactEditor-LoadURL.cpp
+
+ LoadURL(wxSPropertySeg1, wxSPropertySeg2, &URLCount);
+
+ } else if (wxSProperty == wxT("TITLE")) {
+
+ // See frmContactEditor-LoadTitle.cpp
- // Setup blank lines for later on.
-
- FullNamesList.insert(std::make_pair(intValueSeek, wxT("")));
- FullNamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- FullNamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
- FullNamesListPref.insert(std::make_pair(intValueSeek, 0));
- FullNamesListType.insert(std::make_pair(intValueSeek, wxT("")));
- FullNamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
- FullNamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
+ LoadTitle(wxSPropertySeg1, wxSPropertySeg2, &TitleCount);
- intPrevValue = 3;
+ } else if (wxSProperty == wxT("ROLE")) {
+
+ // See frmContactEditor-LoadRole.cpp
+
+ LoadRole(wxSPropertySeg1, wxSPropertySeg2, &RoleCount);
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ } else if (wxSProperty == wxT("ORG")) {
+
+ // See frmContactEditor-LoadOrg.cpp
- SLiter = SplitLength.find(intiter->first);
+ LoadOrg(wxSPropertySeg1, wxSPropertySeg2, &OrgCount);
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- ProcessCaptureStrings(&PropertyValue);
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- if (PropertyName == wxT("ALTID")){
-
- FullNamesListAltID.erase(intValueSeek); FullNamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
+ } else if (wxSProperty == wxT("NOTE")) {
- FullNamesListPID.erase(intValueSeek); FullNamesListPID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- FullNamesListPref.erase(intValueSeek); FullNamesListPref.insert(std::make_pair(intValueSeek, intPref));
-
- }
-
- } else if (PropertyName == wxT("LANG")){
+ // See frmContactEditor-LoadNote.cpp
- FullNamesListLanguage.erase(intValueSeek); FullNamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
+ LoadNote(wxSPropertySeg1, wxSPropertySeg2, &NoteCount);
- for (int i = 0; i <= intPropertyLen; i++){
+ } else if (wxSProperty == wxT("CATEGORIES")) {
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 1){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- }
-
- intSplitSize = 0;
-
- }
+ // See frmContactEditor-LoadCategory.cpp
- }
-
- // Add the data to the General/Home/Work address variables.
+ LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount);
- /*
-
- wxListItem coldata;
+ } else if (wxSProperty == wxT("PHOTO")) {
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(IMPPType);
+ // See frmContactEditor-LoadPhoto.cpp
- */
+ LoadPhoto(wxSPropertySeg1, wxSPropertySeg2, &PhotoCount);
+
+ } else if (wxSProperty == wxT("LOGO")) {
+
+ // See frmContactEditor-LoadLogo.cpp
+
+ LoadLogo(wxSPropertySeg1, wxSPropertySeg2, &LogoCount);
- //ProcessCaptureStrings(wxsPropertySeg2);
+ } else if (wxSProperty == wxT("SOUND")) {
+
+ // See frmContactEditor-LoadSound.cpp
- ProcessCaptureStrings(&wxSPropertySeg2);
+ LoadSound(wxSPropertySeg1, wxSPropertySeg2, &SoundCount);
- FullNamesList.erase(intValueSeek);
- FullNamesListType.erase(intValueSeek);
- FullNamesListTokens.erase(intValueSeek);
- FullNamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- FullNamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
+ } else if (wxSProperty == wxT("CALURI")){
+
+ // See frmContactEditor-LoadCalendar.cpp
- if (intType == 0){
+ LoadCalURI(wxSPropertySeg1, wxSPropertySeg2, &CalAdrCount);
+
+ } else if (wxSProperty == wxT("CALADRURI")){
+
+ // See frmContactEditor-LoadCalendar.cpp
- FullNamesListType.insert(std::make_pair(intValueSeek, wxT("")));
+ LoadCalAdrURI(wxSPropertySeg1, wxSPropertySeg2, &CalReqAdrCount);
+
+ } else if (wxSProperty == wxT("FBURL")){
+
+ // See frmContactEditor-LoadCalendar.cpp
+
+ LoadCalFreeBusy(wxSPropertySeg1, wxSPropertySeg2, &FreeBusyCount);
+
+ } else if (wxSProperty == wxT("KEY")){
+
+ // See frmContactEditor-LoadKey.cpp
- } else if (intType == 1){
+ LoadKey(wxSPropertySeg1, wxSPropertySeg2, &KeyCount);
+
+ } else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){
+
+ UIDToken = wxSPropertySeg2;
+ UIDProcessed = TRUE;
+
+ } else if (wxSProperty.Mid(0, 3) == wxT("VND")){
+
+ // Split the Vendor three ways.
- FullNamesListType.insert(std::make_pair(intValueSeek, wxT("home")));
+ wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-"));
- } else if (intType == 2){
+ wxString wxSVNDID;
+ wxString wxSVNDPropName;
+ long ListCtrlIndex;
+
+ while (wSTVendorDetails.HasMoreTokens() == TRUE){
- FullNamesListType.insert(std::make_pair(intValueSeek, wxT("work")));
+ wSTVendorDetails.GetNextToken();
+ wxSVNDID = wSTVendorDetails.GetNextToken();
+ wxSVNDPropName = wSTVendorDetails.GetNextToken();
+ break;
}
- if (FNProcessed == FALSE){
+ if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
- NameDisplayAs = wxSPropertySeg2;
- cmbDisplayAs->SetValue(ContactData.Convert(wxSPropertySeg2, TRUE));
- FNProcessed = TRUE;
-
- }
+ // Setup the values for later processing.
- /*if (intType == 0){
+ VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
+ VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
+ VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
- ListCtrlIndex = lboIM->InsertItem(coldata);
-
- lboIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
-
- if (intPref > 0 && intPref < 101){
-
- lboIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralIMList.erase(intValueSeek);
- GeneralIMListType.erase(intValueSeek);
- GeneralIMListTokens.erase(intValueSeek);
- GeneralIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralIMListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
+ // Add the data to the vendor variables.
- ListCtrlIndex = lboHomeIM->InsertItem(coldata);
-
- lboHomeIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
+ wxListItem coldata;
+
+ coldata.SetId(intValueSeek);
+ coldata.SetData(intValueSeek);
+ coldata.SetText(wxSVNDID + wxT("-") + wxSVNDPropName);
- if (intPref > 0 && intPref < 101){
+ ListCtrlIndex = lboVendorNamespace->InsertItem(coldata);
- lboHomeIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeIMList.erase(intValueSeek);
- HomeIMListType.erase(intValueSeek);
- HomeIMListTokens.erase(intValueSeek);
- HomeIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeIMListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
+ VendorList.erase(intValueSeek);
+ VendorListPEN.erase(intValueSeek);
+ VendorListElement.erase(intValueSeek);
- ListCtrlIndex = lboBusinessIM->InsertItem(coldata);
-
- lboBusinessIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessIMList.erase(intValueSeek);
- BusinessIMListType.erase(intValueSeek);
- BusinessIMListTokens.erase(intValueSeek);
- BusinessIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessIMListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
+ VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
+ VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
+ VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
- }*/
+ VendorCount++;
+ intValueSeek++;
- FNCount++;
- intValueSeek++;
+ }
- } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){
+ } else if (wxSProperty.Mid(0, 2) == wxT("X-")){
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 3;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- // Look for type before continuing.
-
- intPrevValue = 2;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- }
-
- intPrevValue = 2;
+ long ListCtrlIndex;
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ XTokenList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
+ XTokenListTokens.insert(std::make_pair(intValueSeek, wxSPropertySeg1.Mid(2)));
- SLiter = SplitLength.find(intiter->first);
+ // Add to the form.
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- ProcessCaptureStrings(&PropertyValue);
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- if (PropertyName == wxT("ALTID")){
-
- NameAltID = PropertyValue;
-
- } else if (PropertyName == wxT("LANG")){
+ wxListItem coldata;
+
+ coldata.SetId(intValueSeek);
+ coldata.SetData(intValueSeek);
+ coldata.SetText(wxSPropertySeg1.Mid(2));
- NameLanguage = PropertyValue;
-
- } else if (PropertyName == wxT("SORT-AS")){
-
- NameDisplayAs = PropertyValue;
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
+ ListCtrlIndex = lboXToken->InsertItem(coldata);
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitSeek = 0;
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
+ XTokenCount++;
+ intValueSeek++;
- for (int i = 0; i <= intPropertyLen; i++){
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 4){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
+ }
- }
-
- // Split the data into several parts.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- if (intiter->first == 1){
-
- // Deal with family name.
-
- SLiter = SplitLength.find(1);
-
- txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
-
- intPrevValue = intiter->second;
- NameSurname = wxSPropertySeg2.Mid(0, SLiter->second);
-
- } else if (intiter->first == 2){
-
- // Deal with given names.
-
- SLiter = SplitLength.find(2);
-
- txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
- NameForename = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
-
- } else if (intiter->first == 3){
-
- // Deal with additional names.
-
- SLiter = SplitLength.find(3);
-
- txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
- NameOtherNames = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
-
- } else if (intiter->first == 4){
-
- // Deal with honorifix prefixes and suffixes.
-
- SLiter = SplitLength.find(4);
-
- txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
- NameTitle = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
-
- txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
- NameSuffix = wxSPropertySeg2.Mid(intPrevValue);
-
- }
-
- }
-
- NameTokens = PropertyTokens;
- NameProcessed = TRUE;
+ // Reset the variables.
- } else if (wxSProperty == wxT("NICKNAME")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 10;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
+ QuoteMode = FALSE;
+ PropertyFind = TRUE;
+ ExtraLineSeek = TRUE;
+ ContactLineLen = 0;
+ QuoteBreakPoint = 0;
+ ContactLine.Clear();
+ wxSProperty.Clear();
+
+ }*/
+
+ FMTimer.SetFilename(Filename);
+ FMTimer.Start(10000, FALSE);
+
+ EditMode = TRUE;
+
+ return TRUE;
+}
- intPrevValue = 9;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
+void frmContactEditor::SplitValues(wxString *PropertyLine,
+ std::map<int,int> *SplitPoints,
+ std::map<int,int> *SplitLength,
+ int intSize){
+
+ size_t intPropertyLen = PropertyLine->Len();
+ int intSplitsFound = 0;
+ int intSplitSize = 0;
+ int intSplitSeek = 0;
+
+ for (int i = intSize; i <= intPropertyLen; i++){
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralNicknamesList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNicknamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNicknamesListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeNicknamesList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNicknamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNicknamesListPref.insert(std::make_pair(intValueSeek, 0));
- HomeNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessNicknamesList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNicknamesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNicknamesListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNicknamesListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessNicknamesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNicknamesListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 9;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- ProcessCaptureStrings(&PropertyValue);
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- if (PropertyName == wxT("ALTID")){
+ intSplitSize++;
+
+ if (PropertyLine->Mid(i, 1) == wxT(";") &&
+ PropertyLine->Mid((i - 1), 1) != wxT("\\")){
+
+ if (intSplitsFound == 0){
+
+ SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
+
+ } else {
+
+ SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
+
+ }
+
+ SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
+
+ intSplitsFound++;
+ intSplitSeek = i;
+ intSplitSize = 0;
+
+ }
- if (intType == 0){ GeneralNicknamesListAltID.erase(intValueSeek); GeneralNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeNicknamesListAltID.erase(intValueSeek); HomeNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessNicknamesListAltID.erase(intValueSeek); BusinessNicknamesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
+ }
- if (intType == 0){ GeneralNicknamesListPID.erase(intValueSeek); GeneralNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeNicknamesListPID.erase(intValueSeek); HomeNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessNicknamesListPID.erase(intValueSeek); BusinessNicknamesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralNicknamesListPref.erase(intValueSeek); GeneralNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeNicknamesListPref.erase(intValueSeek); HomeNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessNicknamesListPref.erase(intValueSeek); BusinessNicknamesListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- if (intType == 0){ GeneralNicknamesListLanguage.erase(intValueSeek); GeneralNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeNicknamesListLanguage.erase(intValueSeek); HomeNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessNicknamesListLanguage.erase(intValueSeek); BusinessNicknamesListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboNicknames->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralNicknamesList.erase(intValueSeek);
- GeneralNicknamesListType.erase(intValueSeek);
- GeneralNicknamesListTokens.erase(intValueSeek);
- GeneralNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralNicknamesListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeNicknames->InsertItem(coldata);
+ if (intSplitsFound == 0){
- if (intPref > 0 && intPref < 101){
-
- lboHomeNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
+ SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
+ SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
- HomeNicknamesList.erase(intValueSeek);
- HomeNicknamesListType.erase(intValueSeek);
- HomeNicknamesListTokens.erase(intValueSeek);
- HomeNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeNicknamesListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessNicknames->InsertItem(coldata);
+ } else {
- if (intPref > 0 && intPref < 101){
-
- lboBusinessNicknames->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
+ SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
+ SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
- BusinessNicknamesList.erase(intValueSeek);
- BusinessNicknamesListType.erase(intValueSeek);
- BusinessNicknamesListTokens.erase(intValueSeek);
- BusinessNicknamesList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessNicknamesListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessNicknamesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- NicknameCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 8;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 7;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
+ }
+
+}
+
+void frmContactEditor::LoadData(std::map<int, wxString> *GeneralList,
+ std::map<int, int> *GeneralListPref,
+ wxListCtrl *GeneralListCtrl,
+ std::map<int, wxString> *HomeList,
+ std::map<int, int> *HomeListPref,
+ wxListCtrl *HomeListCtrl,
+ std::map<int, wxString> *BusinessList,
+ std::map<int, int> *BusinessListPref,
+ wxListCtrl *BusinessListCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+
+ // Deal with the general items.
+
+ for (std::map<int,wxString>::iterator Iter = GeneralList->begin();
+ Iter != GeneralList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
+ ListCtrlIndex = GeneralListCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, GeneralListPref)){
- }
-
- }
+ GeneralListCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", GeneralListPref->find(*DataCount)->second));
- wxStringTokenizer GenderDetails (wxSPropertySeg2, wxT(";"));
-
- wxString GenderComponent;
- wxString GenderIdentity;
-
- if (GenderDetails.CountTokens() >= 2){
-
- GenderComponent = GenderDetails.GetNextToken();
- GenderIdentity = GenderDetails.GetString();
-
- ProcessCaptureStrings(&GenderIdentity);
-
- txtGenderDescription->SetValue(ContactData.Convert(GenderIdentity, TRUE));
-
- } else {
-
- GenderComponent = GenderDetails.GetNextToken();
-
- }
-
- if (GenderComponent == wxT("M")){
-
- // Gender is Male.
-
- cmbGender->SetSelection(1);
-
- } else if (GenderComponent == wxT("F")){
-
- // Gender is Female.
-
- cmbGender->SetSelection(2);
-
- } else if (GenderComponent == wxT("O")){
-
- // Gender is Other.
-
- cmbGender->SetSelection(3);
-
- } else if (GenderComponent == wxT("N")){
-
- // Gender is None/Not Applicable.
-
- cmbGender->SetSelection(4);
-
- } else if (GenderComponent == wxT("U")){
-
- // Gender is Unknown.
-
- cmbGender->SetSelection(5);
-
- }
-
- GenderTokens = PropertyTokens;
- GenderProcessed = TRUE;
+ }
+
+ (*DataCount)++;
+
+ }
+
+ // Deal with the home items.
+
+ for (std::map<int,wxString>::iterator Iter = HomeList->begin();
+ Iter != HomeList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
- } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){
+ ListCtrlIndex = HomeListCtrl->InsertItem(coldata);
- // Process date. Preserve the remainder in the string.
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool BirthdayText = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && BirthdayText == FALSE){
-
- ProcessCaptureStrings(&wxSPropertySeg2);
- txtBirthday->SetValue(wxSPropertySeg2);
- Birthday = wxSPropertySeg2;
- BirthdayText = TRUE;
-
- }
+ if (MapDataExists(DataCount, HomeListPref)){
- }
+ HomeListCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", HomeListPref->find(*DataCount)->second));
- // Setup blank lines for later on.
-
- intPrevValue = 5;
+ }
+
+ (*DataCount)++;
+
+ }
+
+ // Deal with the work items.
+
+ for (std::map<int,wxString>::iterator Iter = BusinessList->begin();
+ Iter != BusinessList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ ListCtrlIndex = BusinessListCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, BusinessListPref)){
- SLiter = SplitLength.find(intiter->first);
+ BusinessListCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", BusinessListPref->find(*DataCount)->second));
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- ProcessCaptureStrings(&PropertyValue);
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- if (PropertyName == wxT("ALTID")){
+ }
+
+ (*DataCount)++;
+
+ }
- BirthdayAltID = PropertyValue;
-
- } else if (PropertyName == wxT("CALSCALE")){
-
- BirthdayCalScale = PropertyValue;
-
- } else if (PropertyName != wxT("VALUE")) {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
+}
+
+void frmContactEditor::LoadData(std::map<int, wxString> *GeneralList,
+ std::map<int, int> *GeneralListPref,
+ std::map<int, wxString> *GeneralListType,
+ wxListCtrl *GeneralListCtrl,
+ std::map<int, wxString> *HomeList,
+ std::map<int, int> *HomeListPref,
+ std::map<int, wxString> *HomeListType,
+ wxListCtrl *HomeListCtrl,
+ std::map<int, wxString> *BusinessList,
+ std::map<int, int> *BusinessListPref,
+ std::map<int, wxString> *BusinessListType,
+ wxListCtrl *BusinessListCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+
+ // Deal with the general items.
+
+ for (std::map<int,wxString>::iterator Iter = GeneralList->begin();
+ Iter != GeneralList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
- }
+ ListCtrlIndex = GeneralListCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, GeneralListPref)){
- // Add the data to the variables and form.
-
- if (BirthdayText == FALSE){
-
- Birthday = wxSPropertySeg2;
- int DateYear = 0;
- wxDateTime::Month DateMonth;
- unsigned int DateDay;
-
- wxString wxSData;
-
- if (Birthday.Mid(0, 2) == wxT("--")){
-
- // Skip year.
-
- } else {
-
- DateYear = wxAtoi(Birthday.Mid(0,4));
-
- }
-
- DateMonth = (wxDateTime::Month)(wxAtoi(Birthday.Mid(4,2)) - 1);
- DateDay = wxAtoi(Birthday.Mid(6,2));
-
- wxDateTime BDayDate(DateDay,DateMonth,DateYear);
-
- /*BDayDate.SetDay(DateDay);
- BDayDate.SetMonth(wxDateTime::Month::Jan);
- BDayDate.SetYear(DateYear);*/
-
- dapBirthday->SetValue(BDayDate);
-
- }
-
- BirthdayTokens = PropertyTokens;
-
- BirthdayProcessed = TRUE;
+ GeneralListCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", GeneralListPref->find(*DataCount)->second));
- } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){
-
- // Process date. Preserve the remainder in the string.
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool AnniversaryText = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 13;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 12;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("VALUE") && PropertyValue == wxT("text") && AnniversaryText == FALSE){
-
- ProcessCaptureStrings(&wxSPropertySeg2);
- txtAnniversary->SetValue(wxSPropertySeg2);
- Anniversary = wxSPropertySeg2;
- AnniversaryText = TRUE;
-
- }
+ }
+
+ if (MapDataExists(DataCount, GeneralListType)){
- }
+ GeneralListCtrl->SetItem(ListCtrlIndex, 1, GeneralListType->find(*DataCount)->second);
- // Setup blank lines for later on.
+ }
+
+ (*DataCount)++;
+
+ }
+
+ // Deal with the home items.
+
+ for (std::map<int,wxString>::iterator Iter = HomeList->begin();
+ Iter != HomeList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
- intPrevValue = 12;
+ ListCtrlIndex = HomeListCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, HomeListPref)){
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ HomeListCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", HomeListPref->find(*DataCount)->second));
- SLiter = SplitLength.find(intiter->first);
+ }
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- AnniversaryAltID = PropertyValue;
-
- } else if (PropertyName == wxT("CALSCALE")){
-
- AnniversaryCalScale = PropertyValue;
-
- } else if (PropertyName != wxT("VALUE")) {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
+ if (MapDataExists(DataCount, HomeListType)){
- }
+ HomeListCtrl->SetItem(ListCtrlIndex, 1, HomeListType->find(*DataCount)->second);
- // Add the data to the variables and form.
-
- if (AnniversaryText == FALSE){
-
- Anniversary = wxSPropertySeg2;
- int DateYear = 0;
- wxDateTime::Month DateMonth;
- int DateDay;
-
- wxString wxSData;
-
- if (Anniversary.Mid(0, 2) == wxT("--")){
-
- // Skip year.
-
- } else {
-
- DateYear = wxAtoi(Anniversary.Mid(0,4));
-
- }
+ }
+
+ (*DataCount)++;
+
+ }
+
+ // Deal with the work items.
+
+ for (std::map<int,wxString>::iterator Iter = BusinessList->begin();
+ Iter != BusinessList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
+
+ ListCtrlIndex = BusinessListCtrl->InsertItem(coldata);
- DateMonth = (wxDateTime::Month)(wxAtoi(Anniversary.Mid(4,2)) - 1);
- DateDay = wxAtoi(Anniversary.Mid(6,2));
-
- wxDateTime ADayDate(DateDay,DateMonth,DateYear);
-
- dapAnniversary->SetValue(ADayDate);
-
- }
-
- AnniversaryTokens = PropertyTokens;
-
- AnniversaryProcessed = TRUE;
+ if (MapDataExists(DataCount, BusinessListPref)){
- } else if (wxSProperty == wxT("TZ")){
+ BusinessListCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", BusinessListPref->find(*DataCount)->second));
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 4;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 3;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralTZList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTZListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTZListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTZListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralTZListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTZListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeTZList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTZListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTZListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTZListPref.insert(std::make_pair(intValueSeek, 0));
- HomeTZListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTZListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessTZList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTZListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTZListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTZListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessTZListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTZListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 3;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- // Process properties.
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralTZListAltID.erase(intValueSeek); GeneralTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTZListAltID.erase(intValueSeek); HomeTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTZListAltID.erase(intValueSeek); BusinessTZListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralTZListPID.erase(intValueSeek); GeneralTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTZListPID.erase(intValueSeek); HomeTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTZListPID.erase(intValueSeek); BusinessTZListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ GeneralTZListMediatype.erase(intValueSeek); GeneralTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTZListMediatype.erase(intValueSeek); HomeTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTZListMediatype.erase(intValueSeek); BusinessTZListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- if (intType == 0){ GeneralTZListPref.erase(intValueSeek); GeneralTZListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeTZListPref.erase(intValueSeek); HomeTZListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessTZListPref.erase(intValueSeek); BusinessTZListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 6){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboTimezones->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralTZList.erase(intValueSeek);
- GeneralTZListType.erase(intValueSeek);
- GeneralTZListTokens.erase(intValueSeek);
- GeneralTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralTZListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeTimezones->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeTZList.erase(intValueSeek);
- HomeTZListType.erase(intValueSeek);
- HomeTZListTokens.erase(intValueSeek);
- HomeTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeTZListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessTimezones->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessTZList.erase(intValueSeek);
- BusinessTZListType.erase(intValueSeek);
- BusinessTZListTokens.erase(intValueSeek);
- BusinessTZList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessTZListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessTZListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- TZCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("ADR")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString AddressLabel;
- wxString AddressLang;
- wxString AddressAltID;
- wxString AddressPID;
- wxString AddressTokens;
- wxString AddressGeo;
- wxString AddressTimezone;
- wxString AddressType;
- wxString AddressMediatype;
- wxString AddressPOBox;
- wxString AddressExtended;
- wxString AddressStreet;
- wxString AddressLocality;
- wxString AddressCity;
- wxString AddressRegion;
- wxString AddressPostalCode;
- wxString AddressCountry;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 4;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralAddressList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeAddressList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
- HomeAddressListPref.insert(std::make_pair(intValueSeek, 0));
- HomeAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessAddressList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListTown.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListCounty.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListCountry.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListLabel.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListLang.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListGeo.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessAddressListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessAddressListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 4;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- ProcessCaptureStrings(&PropertyValue);
-
- // Process properties.
-
- if (PropertyName == wxT("LABEL")){
-
- if (intType == 0){ GeneralAddressListLabel.erase(intValueSeek); GeneralAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListLabel.erase(intValueSeek); HomeAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListLabel.erase(intValueSeek); BusinessAddressListLabel.insert(std::make_pair(intValueSeek, PropertyValue));}
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- if (intType == 0){ GeneralAddressListLang.erase(intValueSeek); GeneralAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListLang.erase(intValueSeek); HomeAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListLang.erase(intValueSeek); BusinessAddressListLang.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralAddressListAltID.erase(intValueSeek); GeneralAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListAltID.erase(intValueSeek); HomeAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListAltID.erase(intValueSeek); BusinessAddressListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralAddressListPID.erase(intValueSeek); GeneralAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListPID.erase(intValueSeek); HomeAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListPID.erase(intValueSeek); BusinessAddressListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("GEO")){
-
- if (intType == 0){ GeneralAddressListGeo.erase(intValueSeek); GeneralAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListGeo.erase(intValueSeek); HomeAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListGeo.erase(intValueSeek); BusinessAddressListGeo.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("TZ")){
-
- if (intType == 0){ GeneralAddressListTimezone.erase(intValueSeek); GeneralAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListTimezone.erase(intValueSeek); HomeAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListTimezone.erase(intValueSeek); BusinessAddressListTimezone.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ GeneralAddressListMediatype.erase(intValueSeek); GeneralAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeAddressListMediatype.erase(intValueSeek); HomeAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessAddressListMediatype.erase(intValueSeek); BusinessAddressListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- if (intType == 0){ GeneralAddressListPref.erase(intValueSeek); GeneralAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeAddressListPref.erase(intValueSeek); HomeAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessAddressListPref.erase(intValueSeek); BusinessAddressListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- }
-
- } else {
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 6){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- // Split the data into several parts.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- if (intiter->first == 1){
-
- // Deal with PO Box.
-
- SLiter = SplitLength.find(1);
-
- //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
- AddressPOBox = wxSPropertySeg2.Mid(0, SLiter->second);
- intPrevValue = intiter->second;
-
- } else if (intiter->first == 2){
-
- // Deal with extended address.
-
- SLiter = SplitLength.find(2);
-
- AddressExtended = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
- //txtForename->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
-
- } else if (intiter->first == 3){
-
- // Deal with street address.
-
- SLiter = SplitLength.find(3);
-
- AddressStreet = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
- //txtOtherNames->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
-
- } else if (intiter->first == 4){
-
- // Deal with locality
-
- SLiter = SplitLength.find(4);
-
- AddressLocality = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
- //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
-
- //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
-
- } else if (intiter->first == 5){
-
- // Deal with region.
-
- SLiter = SplitLength.find(5);
-
- AddressRegion = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
- //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
-
- //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
-
- } else if (intiter->first == 6){
-
- // Deal with post code.
-
- SLiter = SplitLength.find(6);
-
- AddressPostalCode = wxSPropertySeg2.Mid(intPrevValue, SLiter->second);
- //txtTitle->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue, SLiter->second), TRUE));
- intPrevValue = intiter->second;
-
- // Deal with country.
-
- AddressCountry = wxSPropertySeg2.Mid(intPrevValue);
- //txtSuffix->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(intPrevValue), TRUE));
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&AddressStreet, &AddressLocality, &AddressRegion, &AddressPostalCode, &AddressCountry);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(AddressStreet);
-
- if (intType == 0){
-
- ListCtrlIndex = lboAddresses->InsertItem(coldata);
- lboAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
- lboAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
- lboAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
-
- if (intPref > 0 && intPref < 101){
-
- lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralAddressList.erase(intValueSeek);
- GeneralAddressListTown.erase(intValueSeek);
- GeneralAddressListCounty.erase(intValueSeek);
- GeneralAddressListPostCode.erase(intValueSeek);
- GeneralAddressListCountry.erase(intValueSeek);
- GeneralAddressListType.erase(intValueSeek);
- GeneralAddressListTokens.erase(intValueSeek);
- GeneralAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
- GeneralAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
- GeneralAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
- GeneralAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
- GeneralAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
- GeneralAddressListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeAddresses->InsertItem(coldata);
- lboHomeAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
- lboHomeAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
- lboHomeAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeAddressList.erase(intValueSeek);
- HomeAddressListTown.erase(intValueSeek);
- HomeAddressListCounty.erase(intValueSeek);
- HomeAddressListPostCode.erase(intValueSeek);
- HomeAddressListCountry.erase(intValueSeek);
- HomeAddressListType.erase(intValueSeek);
- HomeAddressListTokens.erase(intValueSeek);
- HomeAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
- HomeAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
- HomeAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
- HomeAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
- HomeAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
- HomeAddressListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata);
- lboBusinessAddresses->SetItem(ListCtrlIndex, 1, AddressLocality);
- lboBusinessAddresses->SetItem(ListCtrlIndex, 2, AddressRegion);
- lboBusinessAddresses->SetItem(ListCtrlIndex, 3, AddressPostalCode);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessAddresses->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessAddressList.erase(intValueSeek);
- BusinessAddressListTown.erase(intValueSeek);
- BusinessAddressListCounty.erase(intValueSeek);
- BusinessAddressListPostCode.erase(intValueSeek);
- BusinessAddressListCountry.erase(intValueSeek);
- BusinessAddressListType.erase(intValueSeek);
- BusinessAddressListTokens.erase(intValueSeek);
- BusinessAddressList.insert(std::make_pair(intValueSeek, AddressStreet));
- BusinessAddressListTown.insert(std::make_pair(intValueSeek, AddressLocality));
- BusinessAddressListCounty.insert(std::make_pair(intValueSeek, AddressRegion));
- BusinessAddressListPostCode.insert(std::make_pair(intValueSeek, AddressPostalCode));
- BusinessAddressListCountry.insert(std::make_pair(intValueSeek, AddressCountry));
- BusinessAddressListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessAddressListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- ADRCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("EMAIL")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- std::map<int, int>::iterator SPoint;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString AddressLabel;
- wxString AddressLang;
- wxString AddressAltID;
- wxString AddressPID;
- wxString AddressTokens;
- wxString AddressGeo;
- wxString AddressTimezone;
- wxString AddressType;
- wxString AddressMediatype;
- wxString AddressPOBox;
- wxString AddressExtended;
- wxString AddressStreet;
- wxString AddressLocality;
- wxString AddressCity;
- wxString AddressRegion;
- wxString AddressPostalCode;
- wxString AddressCountry;
- bool AfterFirstProperty = FALSE;
- bool FirstToken = TRUE;
- int intSplitSeek = 0;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 7;
- int intPref = 0;
- int intType = 0;
- int intSplitPoint = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 6;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralEmailList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralEmailListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralEmailListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralEmailListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralEmailListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeEmailList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeEmailListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeEmailListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeEmailListPref.insert(std::make_pair(intValueSeek, 0));
- HomeEmailListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessEmailList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessEmailListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessEmailListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessEmailListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessEmailListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 6;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- ProcessCaptureStrings(&PropertyValue);
-
- // Process properties.
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralEmailListAltID.erase(intValueSeek); GeneralEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeEmailListAltID.erase(intValueSeek); HomeEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessEmailListAltID.erase(intValueSeek); BusinessEmailListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralEmailListPID.erase(intValueSeek); GeneralEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeEmailListPID.erase(intValueSeek); HomeEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessEmailListPID.erase(intValueSeek); BusinessEmailListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- if (intType == 0){ GeneralEmailListPref.erase(intValueSeek); GeneralEmailListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeEmailListPref.erase(intValueSeek); HomeEmailListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessEmailListPref.erase(intValueSeek); BusinessEmailListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- // Add the data to the General/Home/Work email variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
-
-
- ListCtrlIndex = lboEmails->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboEmails->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralEmailList.erase(intValueSeek);
- GeneralEmailListType.erase(intValueSeek);
- GeneralEmailListTokens.erase(intValueSeek);
- GeneralEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralEmailListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeEmails->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeEmails->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeEmailList.erase(intValueSeek);
- HomeEmailListType.erase(intValueSeek);
- HomeEmailListTokens.erase(intValueSeek);
- HomeEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeEmailListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessEmail->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessEmail->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessEmailList.erase(intValueSeek);
- BusinessEmailListType.erase(intValueSeek);
- BusinessEmailListTokens.erase(intValueSeek);
- BusinessEmailList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessEmailListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessEmailListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- EmailCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("IMPP")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- std::map<int, int>::iterator SPoint;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString IMPPType;
- wxString IMPPAddress;
- bool AfterFirstProperty = FALSE;
- bool FirstToken = TRUE;
- int intSplitSeek = 0;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitPoint = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralIMList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralIMListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralIMListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralIMListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralIMListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralIMListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeIMList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeIMListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeIMListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeIMListPref.insert(std::make_pair(intValueSeek, 0));
- HomeIMListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- HomeIMListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessIMList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessIMListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessIMListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessIMListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessIMListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessIMListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 5;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- ProcessCaptureStrings(&PropertyValue);
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralIMListAltID.erase(intValueSeek); GeneralIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeIMListAltID.erase(intValueSeek); HomeIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessIMListAltID.erase(intValueSeek); BusinessIMListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralIMListPID.erase(intValueSeek); GeneralIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeIMListPID.erase(intValueSeek); HomeIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessIMListPID.erase(intValueSeek); BusinessIMListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- if (intType == 0){ GeneralIMListPref.erase(intValueSeek); GeneralIMListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeIMListPref.erase(intValueSeek); HomeIMListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessIMListPref.erase(intValueSeek); BusinessIMListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ GeneralIMListMediatype.erase(intValueSeek); GeneralIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeIMListMediatype.erase(intValueSeek); HomeIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessIMListMediatype.erase(intValueSeek); BusinessIMListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 1){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- // Split the data into several parts.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- if (intiter->first == 1){
-
- // Deal with PO Box.
-
- SLiter = SplitLength.find(1);
-
- //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
- IMPPType = wxSPropertySeg2.Mid(0, SLiter->second);
- intPrevValue = intiter->second;
-
- IMPPAddress = wxSPropertySeg2.Mid(intPrevValue);
-
- }
-
- }
-
- // Check what IM type it is.
-
- if (IMPPType == wxT("aim")){
-
- IMPPType = wxT("AIM");
-
- } else if (IMPPType == wxT("gg")){
-
- IMPPType = wxT("Gadu-Gadu");
-
- } else if (IMPPType == wxT("icq")){
-
- IMPPType = wxT("ICQ");
-
- } else if (IMPPType == wxT("skype")){
-
- IMPPType = wxT("Skype");
-
- } else if (IMPPType == wxT("xmpp")){
-
- IMPPType = wxT("XMPP");
-
- } else if (IMPPType == wxT("yahoo")){
-
- IMPPType = wxT("Yahoo");
-
- } else {
-
- // Do nothing.
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(IMPPType);
-
- if (intType == 0){
-
- ListCtrlIndex = lboIM->InsertItem(coldata);
-
- lboIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
-
- if (intPref > 0 && intPref < 101){
-
- lboIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralIMList.erase(intValueSeek);
- GeneralIMListType.erase(intValueSeek);
- GeneralIMListTokens.erase(intValueSeek);
- GeneralIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralIMListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeIM->InsertItem(coldata);
-
- lboHomeIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeIMList.erase(intValueSeek);
- HomeIMListType.erase(intValueSeek);
- HomeIMListTokens.erase(intValueSeek);
- HomeIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeIMListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessIM->InsertItem(coldata);
-
- lboBusinessIM->SetItem(ListCtrlIndex, 1, IMPPAddress);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessIM->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessIMList.erase(intValueSeek);
- BusinessIMListType.erase(intValueSeek);
- BusinessIMListTokens.erase(intValueSeek);
- BusinessIMList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessIMListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessIMListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- IMPPCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("TEL")){
-
- // Check TEL and make sure it is functioning properly.
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int> TypeSplitPoints;
- std::map<int, int> TypeSplitLength;
- std::map<int, int>::iterator SLiter;
- std::map<int, int>::iterator SPoint;
- std::map<int, int>::iterator TSLiter;
- std::map<int, int>::iterator TSPoint;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString TelType;
- wxString TelNumber;
- wxString TelTypeUI;
- wxString TelTypeDetail;
- bool AfterFirstProperty = FALSE;
- bool FirstToken = TRUE;
- int intSplitSeek = 0;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intPref = 0;
- int intType = 0;
- int intSplitPoint = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 4;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- // Process each value in type and translate each
- // part.
-
- // Strip out the quotes if they are there.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- TelTypeDetail = PropertyValue;
-
- intSplitSize = 0;
- intSplitsFound = 0;
- intSplitPoint = 0;
-
- for (int i = 0; i <= intPropertyValueLen; i++){
-
- intSplitSize++;
-
- if (PropertyValue.Mid(i, 1) == wxT(",") && PropertyValue.Mid((i - 1), 1) != wxT("\\")){
-
- if (intSplitsFound == 0){
-
- TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
- TypeSplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- } else {
-
- TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
- TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
-
- }
-
- intSplitsFound++;
- i++;
- intSplitPoint = i;
- intSplitSize = 0;
-
- }
-
- }
-
- TypeSplitPoints.insert(std::make_pair(intSplitsFound, intSplitPoint));
- TypeSplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
-
- int intTypeSeek = 0;
-
- for (std::map<int, int>::iterator typeiter = TypeSplitPoints.begin();
- typeiter != TypeSplitPoints.end(); ++typeiter){
-
- wxString TypePropertyName;
-
- TSLiter = TypeSplitLength.find(typeiter->first);
-
- TypePropertyName = PropertyValue.Mid(typeiter->second, TSLiter->second);
-
- if (intTypeSeek == 0){
-
-
- } else {
-
- TelTypeUI.Append(wxT(","));
-
- }
-
- if (TypePropertyName == wxT("home")){
-
- intType = 1;
-
- } else if (TypePropertyName == wxT("work")){
-
- intType = 2;
-
- }
-
-
- if (TypePropertyName == wxT("text")){
-
- TelTypeUI.Append(_("text"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("voice")){
-
- TelTypeUI.Append(_("voice"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("fax")){
-
- TelTypeUI.Append(_("fax"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("cell")){
-
- TelTypeUI.Append(_("mobile"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("video")){
-
- TelTypeUI.Append(_("video"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("pager")){
-
- TelTypeUI.Append(_("pager"));
- intTypeSeek++;
-
- } else if (TypePropertyName == wxT("textphone")){
-
- TelTypeUI.Append(_("textphone"));
- intTypeSeek++;
-
- }
-
- }
-
- }
-
-
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralTelephoneList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTelephoneListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTelephoneListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeTelephoneList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTelephoneListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTelephoneListPref.insert(std::make_pair(intValueSeek, 0));
- HomeTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessTelephoneList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTelephoneListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTelephoneListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTelephoneListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessTelephoneListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 4;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- // Process properties.
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralTelephoneListAltID.erase(intValueSeek); GeneralTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTelephoneListAltID.erase(intValueSeek); HomeTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTelephoneListAltID.erase(intValueSeek); BusinessTelephoneListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralTelephoneListPID.erase(intValueSeek); GeneralTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTelephoneListPID.erase(intValueSeek); HomeTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTelephoneListPID.erase(intValueSeek); BusinessTelephoneListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- if (intType == 0){ GeneralTelephoneListPref.erase(intValueSeek); GeneralTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeTelephoneListPref.erase(intValueSeek); HomeTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessTelephoneListPref.erase(intValueSeek); BusinessTelephoneListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 1){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- // Split the data into several parts.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- if (intiter->first == 1){
-
- // Deal with PO Box.
-
- SLiter = SplitLength.find(1);
-
- //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
- TelType = wxSPropertySeg2.Mid(0, SLiter->second);
- intPrevValue = intiter->second;
-
- TelNumber = wxSPropertySeg2.Mid(intPrevValue);
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&PropertyValue);
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(TelNumber);
-
- if (intType == 0){
-
- ListCtrlIndex = lboTelephone->InsertItem(coldata);
-
- lboTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI);
-
- if (intPref > 0 && intPref < 101){
-
- lboTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralTelephoneList.erase(intValueSeek);
- GeneralTelephoneListType.erase(intValueSeek);
- GeneralTelephoneListTokens.erase(intValueSeek);
- GeneralTelephoneList.insert(std::make_pair(intValueSeek, TelNumber));
- GeneralTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail));
- GeneralTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeTelephone->InsertItem(coldata);
-
- lboHomeTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeTelephoneList.erase(intValueSeek);
- HomeTelephoneListType.erase(intValueSeek);
- HomeTelephoneListTokens.erase(intValueSeek);
- HomeTelephoneList.insert(std::make_pair(intValueSeek, TelNumber));
- HomeTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail));
- HomeTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessTelephone->InsertItem(coldata);
-
- lboBusinessTelephone->SetItem(ListCtrlIndex, 1, TelTypeUI);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessTelephone->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessTelephoneList.erase(intValueSeek);
- BusinessTelephoneListType.erase(intValueSeek);
- BusinessTelephoneListTokens.erase(intValueSeek);
- BusinessTelephoneList.insert(std::make_pair(intValueSeek, TelNumber));
- BusinessTelephoneListType.insert(std::make_pair(intValueSeek, TelTypeDetail));
- BusinessTelephoneListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- TelCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("LANG")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralLanguageList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralLanguageListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralLanguageListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralLanguageListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralLanguageListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeLanguageList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeLanguageListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeLanguageListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeLanguageListPref.insert(std::make_pair(intValueSeek, 0));
- HomeLanguageListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessLanguageList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessLanguageListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessLanguageListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessLanguageListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessLanguageListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 5;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralLanguageListAltID.erase(intValueSeek); GeneralLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeLanguageListAltID.erase(intValueSeek); HomeLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessLanguageListAltID.erase(intValueSeek); BusinessLanguageListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralLanguageListPID.erase(intValueSeek); GeneralLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeLanguageListPID.erase(intValueSeek); HomeLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessLanguageListPID.erase(intValueSeek); BusinessLanguageListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralLanguageListPref.erase(intValueSeek); GeneralLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeLanguageListPref.erase(intValueSeek); HomeLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessLanguageListPref.erase(intValueSeek); BusinessLanguageListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboLanguages->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralLanguageList.erase(intValueSeek);
- GeneralLanguageListType.erase(intValueSeek);
- GeneralLanguageListTokens.erase(intValueSeek);
- GeneralLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralLanguageListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeLanguages->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeLanguageList.erase(intValueSeek);
- HomeLanguageListType.erase(intValueSeek);
- HomeLanguageListTokens.erase(intValueSeek);
- HomeLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeLanguageListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessLanguages->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessLanguages->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessLanguageList.erase(intValueSeek);
- BusinessLanguageListType.erase(intValueSeek);
- BusinessLanguageListTokens.erase(intValueSeek);
- BusinessLanguageList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessLanguageListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessLanguageListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- LangCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("GEO")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString GeoType;
- wxString GeoData;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 4;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralGeographyList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralGeographyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralGeographyListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralGeographyListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralGeographyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeGeographyList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeGeographyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeGeographyListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeGeographyListPref.insert(std::make_pair(intValueSeek, 0));
- HomeGeographyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessGeographyList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessGeographyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessGeographyListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessGeographyListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessGeographyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 4;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralGeographyListAltID.erase(intValueSeek); GeneralGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeGeographyListAltID.erase(intValueSeek); HomeGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessGeographyListAltID.erase(intValueSeek); BusinessGeographyListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralGeographyListPID.erase(intValueSeek); GeneralGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeGeographyListPID.erase(intValueSeek); HomeGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessGeographyListPID.erase(intValueSeek); BusinessGeographyListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ GeneralGeographyListMediatype.erase(intValueSeek); GeneralGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeGeographyListMediatype.erase(intValueSeek); HomeGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessGeographyListMediatype.erase(intValueSeek); BusinessGeographyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- if (intType == 0){ GeneralGeographyListPref.erase(intValueSeek); GeneralGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeGeographyListPref.erase(intValueSeek); HomeGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessGeographyListPref.erase(intValueSeek); BusinessGeographyListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(":") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 1){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- if (intiter->first == 1){
-
- // Deal with PO Box.
-
- SLiter = SplitLength.find(1);
-
- //txtSurname->SetValue(ContactData.Convert(wxSPropertySeg2.Mid(0, SLiter->second), TRUE));
- GeoType = wxSPropertySeg2.Mid(0, SLiter->second);
- intPrevValue = intiter->second;
-
- GeoData = wxSPropertySeg2.Mid(intPrevValue);
-
- }
-
- }
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
-
-
- if (intType == 0){
-
- /*
-
- ListCtrlIndex = lboTimezones->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- */
- /*
- txtGeopositioning->SetValue(GeoData);
- */
-
- GeneralGeographyList.erase(intValueSeek);
- GeneralGeographyListType.erase(intValueSeek);
- GeneralGeographyListTokens.erase(intValueSeek);
- GeneralGeographyList.insert(std::make_pair(intValueSeek, GeoData));
- GeneralGeographyListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CaptureString(&GeoData, FALSE);
- coldata.SetText(GeoData);
- ListCtrlIndex = lboGeoposition->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- } else if (intType == 1){
-
- /*
-
- ListCtrlIndex = lboHomeTimezones->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- */
-
- /*
- txtHomeGeopositioning->SetValue(GeoData);
- */
-
- HomeGeographyList.erase(intValueSeek);
- HomeGeographyListType.erase(intValueSeek);
- HomeGeographyListTokens.erase(intValueSeek);
- HomeGeographyList.insert(std::make_pair(intValueSeek, GeoData));
- HomeGeographyListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CaptureString(&GeoData, FALSE);
- coldata.SetText(GeoData);
- ListCtrlIndex = lboHomeGeoposition->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessGeoposition->InsertItem(coldata);
-
- /*
-
- ListCtrlIndex = lboBusinessTimezones->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessTimezones->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- */
-
- /*
- txtBusinessGeopositioning->SetValue(GeoData);
- */
-
- BusinessGeographyList.erase(intValueSeek);
- BusinessGeographyListType.erase(intValueSeek);
- BusinessGeographyListTokens.erase(intValueSeek);
- BusinessGeographyList.insert(std::make_pair(intValueSeek, GeoData));
- BusinessGeographyListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessGeographyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CaptureString(&GeoData, FALSE);
- coldata.SetText(GeoData);
- ListCtrlIndex = lboBusinessGeoposition->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessGeoposition->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- }
-
- GeoCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("RELATED")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString RelatedType;
- wxString RelatedTypeOriginal;
- wxString RelatedName;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 9;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 8;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process these.
-
- RelatedTypeOriginal = PropertyValue;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("contact")){
-
- RelatedType = _("Contact");
-
- } else if (PropertyValue == wxT("acquaintance")){
-
- RelatedType = _("Acquaintance");
-
- } else if (PropertyValue == wxT("friend")){
-
- RelatedType = _("Friend");
-
- } else if (PropertyValue == wxT("met")){
-
- RelatedType = _("Met");
-
- } else if (PropertyValue == wxT("co-worker")){
-
- RelatedType = _("Co-worker");
-
- } else if (PropertyValue == wxT("colleague")){
-
- RelatedType = _("Colleague");
-
- } else if (PropertyValue == wxT("co-resident")){
-
- RelatedType = _("Co-resident");
-
- } else if (PropertyValue == wxT("neighbor")){
-
- RelatedType = _("Neighbour");
-
- } else if (PropertyValue == wxT("child")){
-
- RelatedType = _("Child");
-
- } else if (PropertyValue == wxT("parent")){
-
- RelatedType = _("Parent");
-
- } else if (PropertyValue == wxT("sibling")){
-
- RelatedType = _("Sibling");
-
- } else if (PropertyValue == wxT("spouse")){
-
- RelatedType = _("Spouse");
-
- } else if (PropertyValue == wxT("kin")){
-
- RelatedType = _("Kin");
-
- } else if (PropertyValue == wxT("muse")){
-
- RelatedType = _("Muse");
-
- } else if (PropertyValue == wxT("crush")){
-
- RelatedType = _("Crush");
-
- } else if (PropertyValue == wxT("date")){
-
- RelatedType = _("Date");
-
- } else if (PropertyValue == wxT("sweetheart")){
-
- RelatedType = _("Sweetheart");
-
- } else if (PropertyValue == wxT("me")){
-
- RelatedType = _("Me");
-
- } else if (PropertyValue == wxT("agent")){
-
- RelatedType = _("Agent");
-
- } else if (PropertyValue == wxT("emergency")){
-
- RelatedType = _("Emergency");
-
- } else {
-
- RelatedType = PropertyValue;
-
- }
-
- }
-
- }
-
- intPrevValue = 8;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- GeneralRelatedListAltID.erase(intValueSeek);
- GeneralRelatedListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
-
- GeneralRelatedListPID.erase(intValueSeek);
- GeneralRelatedListPID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intPref > 0 && intPref < 101){
-
- GeneralRelatedListPref.erase(intValueSeek);
- GeneralRelatedListPref.insert(std::make_pair(intValueSeek, intPref));
-
-
- }
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- GeneralRelatedListLanguage.erase(intValueSeek);
- GeneralRelatedListLanguage.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Split the address.
-
- //std::map<int, int>::iterator SLiter;
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(RelatedType);
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- ListCtrlIndex = lboRelated->InsertItem(coldata);
-
- lboRelated->SetItem(ListCtrlIndex, 1, wxSPropertySeg2);
-
- if (intPref > 0 && intPref < 101){
-
- lboRelated->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralRelatedList.erase(intValueSeek);
- GeneralRelatedListRelType.erase(intValueSeek);
- GeneralRelatedListType.erase(intValueSeek);
- GeneralRelatedListTokens.erase(intValueSeek);
- GeneralRelatedList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralRelatedListRelType.insert(std::make_pair(intValueSeek, RelatedTypeOriginal));
- GeneralRelatedListType.insert(std::make_pair(intValueSeek, RelatedTypeOriginal));
- GeneralRelatedListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- RelatedCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("URL")){
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 4;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralWebsiteList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralWebsiteListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralWebsiteListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeWebsiteList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeWebsiteListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeWebsiteListPref.insert(std::make_pair(intValueSeek, 0));
- HomeWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessWebsiteList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessWebsiteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessWebsiteListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessWebsiteListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessWebsiteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 4;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralWebsiteListAltID.erase(intValueSeek); GeneralWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeWebsiteListAltID.erase(intValueSeek); HomeWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessWebsiteListAltID.erase(intValueSeek); BusinessWebsiteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralWebsiteListPID.erase(intValueSeek); GeneralWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeWebsiteListPID.erase(intValueSeek); HomeWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessWebsiteListPID.erase(intValueSeek); BusinessWebsiteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralWebsiteListPref.erase(intValueSeek); GeneralWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeWebsiteListPref.erase(intValueSeek); HomeWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessWebsiteListPref.erase(intValueSeek); BusinessWebsiteListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ GeneralWebsiteListMediatype.erase(intValueSeek); GeneralWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeWebsiteListMediatype.erase(intValueSeek); HomeWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessWebsiteListMediatype.erase(intValueSeek); BusinessWebsiteListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboWebsites->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralWebsiteList.erase(intValueSeek);
- GeneralWebsiteListType.erase(intValueSeek);
- GeneralWebsiteListTokens.erase(intValueSeek);
- GeneralWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralWebsiteListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeWebsites->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeWebsiteList.erase(intValueSeek);
- HomeWebsiteListType.erase(intValueSeek);
- HomeWebsiteListTokens.erase(intValueSeek);
- HomeWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeWebsiteListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessWebsites->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessWebsites->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessWebsiteList.erase(intValueSeek);
- BusinessWebsiteListType.erase(intValueSeek);
- BusinessWebsiteListTokens.erase(intValueSeek);
- BusinessWebsiteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessWebsiteListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessWebsiteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- URLCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("TITLE")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 7;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 6;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralTitleList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTitleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTitleListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTitleListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralTitleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTitleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeTitleList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTitleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTitleListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTitleListPref.insert(std::make_pair(intValueSeek, 0));
- HomeTitleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- HomeTitleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessTitleList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTitleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTitleListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTitleListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessTitleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessTitleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 6;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralTitleListAltID.erase(intValueSeek); GeneralTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTitleListAltID.erase(intValueSeek); HomeTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTitleListAltID.erase(intValueSeek); BusinessTitleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralTitleListPID.erase(intValueSeek); GeneralTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTitleListPID.erase(intValueSeek); HomeTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTitleListPID.erase(intValueSeek); BusinessTitleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralTitleListPref.erase(intValueSeek); GeneralTitleListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeTitleListPref.erase(intValueSeek); HomeTitleListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessTitleListPref.erase(intValueSeek); BusinessTitleListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- if (intType == 0){ GeneralTitleListLanguage.erase(intValueSeek); GeneralTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeTitleListLanguage.erase(intValueSeek); HomeTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessTitleListLanguage.erase(intValueSeek); BusinessTitleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboTitles->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralTitleList.erase(intValueSeek);
- GeneralTitleListType.erase(intValueSeek);
- GeneralTitleListTokens.erase(intValueSeek);
- GeneralTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralTitleListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeTitles->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeTitleList.erase(intValueSeek);
- HomeTitleListType.erase(intValueSeek);
- HomeTitleListTokens.erase(intValueSeek);
- HomeTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeTitleListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessTitles->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessTitles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessTitleList.erase(intValueSeek);
- BusinessTitleListType.erase(intValueSeek);
- BusinessTitleListTokens.erase(intValueSeek);
- BusinessTitleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessTitleListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessTitleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- TitleCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("ROLE")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralRoleList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralRoleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralRoleListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralRoleListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralRoleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralRoleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeRoleList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeRoleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeRoleListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeRoleListPref.insert(std::make_pair(intValueSeek, 0));
- HomeRoleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- HomeRoleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessRoleList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessRoleListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessRoleListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessRoleListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessRoleListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessRoleListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 5;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralRoleListAltID.erase(intValueSeek); GeneralRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeRoleListAltID.erase(intValueSeek); HomeRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessRoleListAltID.erase(intValueSeek); BusinessRoleListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralRoleListPID.erase(intValueSeek); GeneralRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeRoleListPID.erase(intValueSeek); HomeRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessRoleListPID.erase(intValueSeek); BusinessRoleListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralRoleListPref.erase(intValueSeek); GeneralRoleListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeRoleListPref.erase(intValueSeek); HomeRoleListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessRoleListPref.erase(intValueSeek); BusinessRoleListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- if (intType == 0){ GeneralRoleListLanguage.erase(intValueSeek); GeneralRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeRoleListLanguage.erase(intValueSeek); HomeRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessRoleListLanguage.erase(intValueSeek); BusinessRoleListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboRoles->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralRoleList.erase(intValueSeek);
- GeneralRoleListType.erase(intValueSeek);
- GeneralRoleListTokens.erase(intValueSeek);
- GeneralRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralRoleListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeRoles->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeRoleList.erase(intValueSeek);
- HomeRoleListType.erase(intValueSeek);
- HomeRoleListTokens.erase(intValueSeek);
- HomeRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeRoleListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessRoles->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessRoles->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessRoleList.erase(intValueSeek);
- BusinessRoleListType.erase(intValueSeek);
- BusinessRoleListTokens.erase(intValueSeek);
- BusinessRoleList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessRoleListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessRoleListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- RoleCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("ORG")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 4;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralOrganisationsList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralOrganisationsListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeOrganisationsList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeOrganisationsListPref.insert(std::make_pair(intValueSeek, 0));
- HomeOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- HomeOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
- HomeOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessOrganisationsList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessOrganisationsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessOrganisationsListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessOrganisationsListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessOrganisationsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessOrganisationsListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessOrganisationsListSortAs.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 4;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralOrganisationsListAltID.erase(intValueSeek); GeneralOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeOrganisationsListAltID.erase(intValueSeek); HomeOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessOrganisationsListAltID.erase(intValueSeek); BusinessOrganisationsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralOrganisationsListPID.erase(intValueSeek); GeneralOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeOrganisationsListPID.erase(intValueSeek); HomeOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessOrganisationsListPID.erase(intValueSeek); BusinessOrganisationsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralOrganisationsListPref.erase(intValueSeek); GeneralOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeOrganisationsListPref.erase(intValueSeek); HomeOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessOrganisationsListPref.erase(intValueSeek); BusinessOrganisationsListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- if (intType == 0){ GeneralOrganisationsListLanguage.erase(intValueSeek); GeneralOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeOrganisationsListLanguage.erase(intValueSeek); HomeOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessOrganisationsListLanguage.erase(intValueSeek); BusinessOrganisationsListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("SORT-AS")){
-
- if (intType == 0){ GeneralOrganisationsListSortAs.erase(intValueSeek); GeneralOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeOrganisationsListSortAs.erase(intValueSeek); HomeOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessOrganisationsListSortAs.erase(intValueSeek); BusinessOrganisationsListSortAs.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- if (intType == 0){
-
- ListCtrlIndex = lboOrganisations->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- GeneralOrganisationsList.erase(intValueSeek);
- GeneralOrganisationsListType.erase(intValueSeek);
- GeneralOrganisationsListTokens.erase(intValueSeek);
- GeneralOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 1){
-
- ListCtrlIndex = lboHomeOrganisations->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- HomeOrganisationsList.erase(intValueSeek);
- HomeOrganisationsListType.erase(intValueSeek);
- HomeOrganisationsListTokens.erase(intValueSeek);
- HomeOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- } else if (intType == 2){
-
- ListCtrlIndex = lboBusinessOrganisations->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessOrganisations->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- BusinessOrganisationsList.erase(intValueSeek);
- BusinessOrganisationsListType.erase(intValueSeek);
- BusinessOrganisationsListTokens.erase(intValueSeek);
- BusinessOrganisationsList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessOrganisationsListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessOrganisationsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- }
-
- OrgCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("NOTE")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- if (intType == 0){
-
- GeneralNoteList.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNoteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNoteListPID.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNoteListPref.insert(std::make_pair(intValueSeek, 0));
- GeneralNoteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNoteListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- HomeNoteList.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNoteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNoteListPID.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNoteListPref.insert(std::make_pair(intValueSeek, 0));
- HomeNoteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- HomeNoteListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 2){
-
- BusinessNoteList.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNoteListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNoteListPID.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNoteListPref.insert(std::make_pair(intValueSeek, 0));
- BusinessNoteListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- BusinessNoteListLanguage.insert(std::make_pair(intValueSeek, wxT("")));
-
- }
-
- intPrevValue = 5;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, SLiter->second);
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ GeneralNoteListAltID.erase(intValueSeek); GeneralNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeNoteListAltID.erase(intValueSeek); HomeNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessNoteListAltID.erase(intValueSeek); BusinessNoteListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ GeneralNoteListPID.erase(intValueSeek); GeneralNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeNoteListPID.erase(intValueSeek); HomeNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessNoteListPID.erase(intValueSeek); BusinessNoteListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ GeneralNoteListPref.erase(intValueSeek); GeneralNoteListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ HomeNoteListPref.erase(intValueSeek); HomeNoteListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ BusinessNoteListPref.erase(intValueSeek); BusinessNoteListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("LANGUAGE")){
-
- if (intType == 0){ GeneralNoteListLanguage.erase(intValueSeek); GeneralNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ HomeNoteListLanguage.erase(intValueSeek); HomeNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ BusinessNoteListLanguage.erase(intValueSeek); BusinessNoteListLanguage.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
-
- if (intType == 0){
-
- GeneralNoteList.erase(intValueSeek);
- GeneralNoteListType.erase(intValueSeek);
- GeneralNoteListTokens.erase(intValueSeek);
- GeneralNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- GeneralNoteListType.insert(std::make_pair(intValueSeek, wxT("")));
- GeneralNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- //CaptureString(&wxSPropertySeg2, FALSE);
-
- coldata.SetText(wxSPropertySeg2);
-
- ListCtrlIndex = lboNotes->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- } else if (intType == 1){
-
- HomeNoteList.erase(intValueSeek);
- HomeNoteListType.erase(intValueSeek);
- HomeNoteListTokens.erase(intValueSeek);
- HomeNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- HomeNoteListType.insert(std::make_pair(intValueSeek, wxT("home")));
- HomeNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CaptureString(&wxSPropertySeg2, FALSE);
-
- coldata.SetText(wxSPropertySeg2);
-
- ListCtrlIndex = lboHomeNotes->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboHomeNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- } else if (intType == 2){
-
- BusinessNoteList.erase(intValueSeek);
- BusinessNoteListType.erase(intValueSeek);
- BusinessNoteListTokens.erase(intValueSeek);
- BusinessNoteList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- BusinessNoteListType.insert(std::make_pair(intValueSeek, wxT("work")));
- BusinessNoteListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CaptureString(&wxSPropertySeg2, FALSE);
-
- coldata.SetText(wxSPropertySeg2);
-
- ListCtrlIndex = lboBusinessNotes->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboBusinessNotes->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- }
-
- NoteCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("CATEGORIES")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- wxString PropertyType;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 12;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 11;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
- PropertyType = wxT("work");
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
- PropertyType = wxT("home");
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- CategoriesList.insert(std::make_pair(intValueSeek, wxT("")));
- CategoriesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- CategoriesListPID.insert(std::make_pair(intValueSeek, wxT("")));
- CategoriesListPref.insert(std::make_pair(intValueSeek, 0));
- CategoriesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 11;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ CategoriesListAltID.erase(intValueSeek); CategoriesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ CategoriesListPID.erase(intValueSeek); CategoriesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ CategoriesListPref.erase(intValueSeek); CategoriesListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Deal with multiple categories.
-
- SplitPoints.clear();
- SplitLength.clear();
- intSplitSize = 0;
- intSplitsFound = 0;
- intSplitSeek = 0;
- intPrevValue = 0;
- intPropertyLen = wxSPropertySeg2.Len();
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- if (intSplitSize == 0 && wxSPropertySeg2.Mid(i, 1) == wxT(" ")){
-
- continue;
-
- }
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(",") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- if (AfterFirstToken == TRUE){
-
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
- SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
-
- } else {
-
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- AfterFirstToken = TRUE;
-
- }
-
- intSplitsFound++;
- intSplitSeek = i;
- intSplitSize = 0;
-
- }
-
- }
-
- SplitPoints.insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
- SplitLength.insert(std::make_pair(intSplitsFound, intSplitSize));
-
- intPrevValue = 0;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg2.Mid(intPrevValue, (SLiter->second + 1));
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- /*
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- */
-
- // Add the data to the General/Home/Work address variables.
-
- // Trim any whitespace from the start and end.
-
- PropertyData = PropertyData.Trim(FALSE);
- PropertyData = PropertyData.Trim(TRUE);
-
- ProcessCaptureStrings(&PropertyData);
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(PropertyData);
-
- ListCtrlIndex = lboCategories->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboCategories->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
- }
-
- CategoriesList.erase(intValueSeek);
- CategoriesListType.erase(intValueSeek);
- CategoriesListTokens.erase(intValueSeek);
- CategoriesList.insert(std::make_pair(intValueSeek, PropertyData));
- CategoriesListType.insert(std::make_pair(intValueSeek, PropertyType));
- CategoriesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CategoryCount++;
- intValueSeek++;
-
- }
-
- } else if (wxSProperty == wxT("PHOTO")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 7;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 6;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- PicturesList.insert(std::make_pair(intValueSeek, ""));
- PicturesListType.insert(std::make_pair(intValueSeek, wxT("")));
- PicturesListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- PicturesListPID.insert(std::make_pair(intValueSeek, wxT("")));
- PicturesListPref.insert(std::make_pair(intValueSeek, 0));
- PicturesListPicEncType.insert(std::make_pair(intValueSeek, wxT("")));
- PicturesListPictureType.insert(std::make_pair(intValueSeek, wxT("")));
- PicturesListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- PicturesListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 6;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ PicturesListAltID.erase(intValueSeek); PicturesListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ PicturesListPID.erase(intValueSeek); PicturesListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ PicturesListPref.erase(intValueSeek); PicturesListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ PicturesListMediatype.erase(intValueSeek); PicturesListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 6){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- wxString wxSPhotoURI;
- wxString wxSPhotoMIME;
- wxString wxSPhotoEncoding;
- wxString wxSPhotoData;
- std::string base64enc;
-
- if (intSplitsFound = 0){
-
- } else {
-
- std::map<int, int>::iterator striter;
-
- striter = SplitLength.find(1);
-
- wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
-
- while (wSTDataType.HasMoreTokens() == TRUE){
-
- wxSPhotoURI = wSTDataType.GetNextToken();
- wxSPhotoMIME = wSTDataType.GetNextToken();
- break;
-
- }
-
- wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
-
- while (wSTDataInfo.HasMoreTokens() == TRUE){
-
- wxSPhotoEncoding = wSTDataInfo.GetNextToken();
- wxSPhotoData = wSTDataInfo.GetNextToken();
- base64enc = wxSPhotoData.mb_str();
- break;
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(_("Picture"));
-
- ListCtrlIndex = lboPictures->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboPictures->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- PicturesList.erase(intValueSeek);
- PicturesListType.erase(intValueSeek);
- PicturesListTokens.erase(intValueSeek);
- PicturesListPictureType.erase(intValueSeek);
- PicturesListPicEncType.erase(intValueSeek);
- PicturesList.insert(std::make_pair(intValueSeek, base64enc));
- PicturesListPictureType.insert(std::make_pair(intValueSeek, wxSPhotoMIME));
- PicturesListPicEncType.insert(std::make_pair(intValueSeek, wxSPhotoEncoding));
-
- if (intType == 0){
-
- PicturesListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- PicturesListType.insert(std::make_pair(intValueSeek, wxT("home")));
- lboLogos->SetItem(ListCtrlIndex, 1, _("Home"));
-
- } else if (intType == 2){
-
- PicturesListType.insert(std::make_pair(intValueSeek, wxT("work")));
- lboLogos->SetItem(ListCtrlIndex, 1, _("Work"));
-
- }
-
- PicturesListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- PhotoCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("LOGO")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 6;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 5;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- LogosList.insert(std::make_pair(intValueSeek, ""));
- LogosListType.insert(std::make_pair(intValueSeek, wxT("")));
- LogosListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- LogosListPID.insert(std::make_pair(intValueSeek, wxT("")));
- LogosListPref.insert(std::make_pair(intValueSeek, 0));
- LogosListPicEncType.insert(std::make_pair(intValueSeek, wxT("")));
- LogosListPictureType.insert(std::make_pair(intValueSeek, wxT("")));
- LogosListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- LogosListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 5;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ LogosListAltID.erase(intValueSeek); LogosListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ LogosListPID.erase(intValueSeek); LogosListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ LogosListPref.erase(intValueSeek); LogosListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ LogosListMediatype.erase(intValueSeek); LogosListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- wxString wxSPhotoURI;
- wxString wxSPhotoMIME;
- wxString wxSPhotoEncoding;
- wxString wxSPhotoData;
- std::string base64enc;
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- if (intSplitsFound = 0){
-
- } else {
-
- std::map<int, int>::iterator striter;
-
- striter = SplitLength.find(1);
-
- wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
-
- while (wSTDataType.HasMoreTokens() == TRUE){
-
- wxSPhotoURI = wSTDataType.GetNextToken();
- wxSPhotoMIME = wSTDataType.GetNextToken();
- break;
-
- }
-
- wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
-
- while (wSTDataInfo.HasMoreTokens() == TRUE){
-
- wxSPhotoEncoding = wSTDataInfo.GetNextToken();
- wxSPhotoData = wSTDataInfo.GetNextToken();
- base64enc = wxSPhotoData.mb_str();
- break;
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(_("Picture"));
-
- ListCtrlIndex = lboLogos->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboLogos->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- LogosList.erase(intValueSeek);
- LogosListType.erase(intValueSeek);
- LogosListTokens.erase(intValueSeek);
- LogosListPictureType.erase(intValueSeek);
- LogosListPicEncType.erase(intValueSeek);
- LogosList.insert(std::make_pair(intValueSeek, base64enc));
- LogosListPictureType.insert(std::make_pair(intValueSeek, wxSPhotoMIME));
- LogosListPicEncType.insert(std::make_pair(intValueSeek, wxSPhotoEncoding));
-
- if (intType == 0){
-
- LogosListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- LogosListType.insert(std::make_pair(intValueSeek, wxT("home")));
- lboLogos->SetItem(ListCtrlIndex, 1, _("Home"));
-
- } else if (intType == 2){
-
- LogosListType.insert(std::make_pair(intValueSeek, wxT("work")));
- lboLogos->SetItem(ListCtrlIndex, 1, _("Work"));
-
- }
-
- LogosListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- LogoCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("SOUND")) {
-
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 7;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 6;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- SoundsList.insert(std::make_pair(intValueSeek, ""));
- SoundsListType.insert(std::make_pair(intValueSeek, wxT("")));
- SoundsListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- SoundsListPID.insert(std::make_pair(intValueSeek, wxT("")));
- SoundsListPref.insert(std::make_pair(intValueSeek, 0));
- SoundsListAudioEncType.insert(std::make_pair(intValueSeek, wxT("")));
- SoundsListAudioType.insert(std::make_pair(intValueSeek, wxT("")));
- SoundsListTokens.insert(std::make_pair(intValueSeek, wxT("")));
- SoundsListMediatype.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 6;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- ProcessCaptureStrings(&PropertyValue);
-
- if (PropertyName == wxT("ALTID")){
-
- if (intType == 0){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ SoundsListAltID.erase(intValueSeek); SoundsListAltID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PID")){
-
- if (intType == 0){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ SoundsListPID.erase(intValueSeek); SoundsListPID.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- if (intType == 0){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 1){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); }
- else if (intType == 2){ SoundsListPref.erase(intValueSeek); SoundsListPref.insert(std::make_pair(intValueSeek, intPref)); }
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- if (intType == 0){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 1){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
- else if (intType == 2){ SoundsListMediatype.erase(intValueSeek); SoundsListMediatype.insert(std::make_pair(intValueSeek, PropertyValue)); }
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
-
- ProcessCaptureStrings(&wxSPropertySeg2);
-
- for (int i = 0; i <= intPropertyLen; i++){
-
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 6){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
-
- }
-
- wxString wxSSoundURI;
- wxString wxSSoundMIME;
- wxString wxSSoundEncoding;
- wxString wxSSoundData;
- std::string base64enc;
-
- if (intSplitsFound = 0){
-
- } else {
-
- std::map<int, int>::iterator striter;
-
- striter = SplitLength.find(1);
-
- wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
-
- while (wSTDataType.HasMoreTokens() == TRUE){
-
- wxSSoundURI = wSTDataType.GetNextToken();
- wxSSoundMIME = wSTDataType.GetNextToken();
- break;
-
- }
-
- wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 1)), wxT(","));
-
- while (wSTDataInfo.HasMoreTokens() == TRUE){
-
- wxSSoundEncoding = wSTDataInfo.GetNextToken();
- wxSSoundData = wSTDataInfo.GetNextToken();
- base64enc = wxSSoundData.mb_str();
- break;
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(_("Sound"));
-
- ListCtrlIndex = lboSounds->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboSounds->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- SoundsList.erase(intValueSeek);
- SoundsListType.erase(intValueSeek);
- SoundsListTokens.erase(intValueSeek);
- SoundsListAudioType.erase(intValueSeek);
- SoundsListAudioEncType.erase(intValueSeek);
- SoundsList.insert(std::make_pair(intValueSeek, base64enc));
- SoundsListAudioType.insert(std::make_pair(intValueSeek, wxSSoundMIME));
- SoundsListAudioEncType.insert(std::make_pair(intValueSeek, wxSSoundEncoding));
-
- if (intType == 0){
-
- SoundsListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- SoundsListType.insert(std::make_pair(intValueSeek, wxT("home")));
- lboLogos->SetItem(ListCtrlIndex, 1, _("Home"));
-
- } else if (intType == 2){
-
- SoundsListType.insert(std::make_pair(intValueSeek, wxT("work")));
- lboLogos->SetItem(ListCtrlIndex, 1, _("Work"));
-
- }
-
- SoundsListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- SoundCount++;
- intValueSeek++;
-
- } else if (wxSProperty == wxT("CALURI")){
+ }
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 8;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 7;
-
- // Look for type before continuing.
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- CalendarList.insert(std::make_pair(intValueSeek, wxT("")));
- CalendarListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- CalendarListPID.insert(std::make_pair(intValueSeek, wxT("")));
- CalendarListPref.insert(std::make_pair(intValueSeek, 0));
- CalendarListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 6;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- if (PropertyName == wxT("ALTID")){
+ if (MapDataExists(DataCount, BusinessListType)){
+
+ BusinessListCtrl->SetItem(ListCtrlIndex, 1, BusinessListType->find(*DataCount)->second);
+
+ }
+
+ (*DataCount)++;
+
+ }
- CalendarListAltID.erase(intValueSeek); CalendarListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
+}
- CalendarListPID.erase(intValueSeek); CalendarListPID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- CalendarListPref.erase(intValueSeek); CalendarListPref.insert(std::make_pair(intValueSeek, intPref));
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- CalendarListMediatype.erase(intValueSeek); CalendarListMediatype.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
+
+void frmContactEditor::LoadData(std::map<int,wxString> *ItemList,
+ std::map<int,int> *ItemListPref,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+
+ for (std::map<int,wxString>::iterator Iter = ItemList->begin();
+ Iter != ItemList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
+
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
+ if (MapDataExists(DataCount, ItemListPref)){
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
+ ItemCtrl->SetItem(ListCtrlIndex, 1, wxString::Format("%i", ItemListPref->find(*DataCount)->second));
+
+ }
+
+ (*DataCount)++;
+
+ }
- ListCtrlIndex = lboCalendarAddresses->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboCalendarAddresses->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- CaptureString(&wxSPropertySeg2, FALSE);
+}
+
+void frmContactEditor::LoadData(std::map<int,wxString> *ItemList,
+ std::map<int,int> *ItemListPref,
+ std::map<int,wxString> *ItemListType,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+
+ for (std::map<int,wxString>::iterator Iter = ItemList->begin();
+ Iter != ItemList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
+
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
- CalendarList.erase(intValueSeek);
- CalendarListType.erase(intValueSeek);
- CalendarListTokens.erase(intValueSeek);
- CalendarList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
-
- if (intType == 0){
-
- CalendarListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- CalendarListType.insert(std::make_pair(intValueSeek, wxT("home")));
- lboCalendarAddresses->SetItem(ListCtrlIndex, 1, _("Home"), intPref);
-
- } else if (intType == 2){
-
- CalendarListType.insert(std::make_pair(intValueSeek, wxT("work")));
- lboCalendarAddresses->SetItem(ListCtrlIndex, 1, _("Work"), intPref);
-
- }
-
- CalendarListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CalAdrCount++;
- intValueSeek++;
+ if (MapDataExists(DataCount, ItemListType)){
- } else if (wxSProperty == wxT("CALADRURI")){
+ ItemCtrl->SetItem(ListCtrlIndex, 1, ItemListType->find(*DataCount)->second);
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 11;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 10;
-
- // Look for type before continuing.
-
-
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
+ }
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
+ if (MapDataExists(DataCount, ItemListPref)){
+
+ ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second));
+
+ }
+
+ (*DataCount)++;
+
+ }
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- CalendarRequestList.insert(std::make_pair(intValueSeek, wxT("")));
- CalendarRequestListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- CalendarRequestListPID.insert(std::make_pair(intValueSeek, wxT("")));
- CalendarRequestListPref.insert(std::make_pair(intValueSeek, 0));
- CalendarRequestListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 10;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
-
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- if (PropertyName == wxT("ALTID")){
+}
- CalendarRequestListAltID.erase(intValueSeek); CalendarRequestListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
+void frmContactEditor::LoadData(wxString ItemName,
+ std::map<int,wxString> *ItemList,
+ std::map<int,int> *ItemListPref,
+ std::map<int,wxString> *ItemListType,
+ std::map<int,wxString> *ItemListDataType,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
- CalendarRequestListPID.erase(intValueSeek); CalendarRequestListPID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- CalendarRequestListPref.erase(intValueSeek); CalendarRequestListPref.insert(std::make_pair(intValueSeek, intPref));
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- CalendarRequestListMediatype.erase(intValueSeek); CalendarRequestListMediatype.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
+ long ListCtrlIndex = -1;
+
+ for (std::map<int,wxString>::iterator Iter = ItemList->begin();
+ Iter != ItemList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+ coldata.SetText(Iter->second);
+
+ if (ItemName == "KEY"){
+
+ // Get the key type, if any.
+
+ if (MapDataExists(DataCount, ItemListDataType)){
+
+ if (ItemListDataType->find(*DataCount)->second == "application/pgp-keys"){
- }
+ coldata.SetText(_("PGP Key"));
}
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
-
- ListCtrlIndex = lboCalendarRequestAddress->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboCalendarRequestAddress->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- CaptureString(&wxSPropertySeg2, FALSE);
-
- CalendarRequestList.erase(intValueSeek);
- CalendarRequestListType.erase(intValueSeek);
- CalendarRequestListTokens.erase(intValueSeek);
- CalendarRequestList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
-
- if (intType == 0){
-
- CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("home")));
- lboCalendarRequestAddress->SetItem(ListCtrlIndex, 1, _("Home"), intPref);
-
- } else if (intType == 2){
+ } else {
- CalendarRequestListType.insert(std::make_pair(intValueSeek, wxT("work")));
- lboCalendarRequestAddress->SetItem(ListCtrlIndex, 1, _("Work"), intPref);
+ coldata.SetText(_("Key"));
}
-
- CalendarRequestListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- CalReqAdrCount++;
- intValueSeek++;
- } else if (wxSProperty == wxT("FBURL")){
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 7;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 6;
-
- // Look for type before continuing.
+ }
+
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, ItemListType)){
+
+ if (ItemListType->find(*DataCount)->second == "home"){
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ ItemCtrl->SetItem(ListCtrlIndex, 1, _("Home"));
- SLiter = SplitLength.find(intiter->first);
+ } else if (ItemListType->find(*DataCount)->second == "work"){
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- if (PropertyName == wxT("TYPE")){
-
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
-
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
+ ItemCtrl->SetItem(ListCtrlIndex, 1, _("Work"));
}
-
- // Setup blank lines for later on.
-
- FreeBusyList.insert(std::make_pair(intValueSeek, wxT("")));
- FreeBusyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- FreeBusyListPID.insert(std::make_pair(intValueSeek, wxT("")));
- FreeBusyListPref.insert(std::make_pair(intValueSeek, 0));
- FreeBusyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 6;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
-
- SLiter = SplitLength.find(intiter->first);
-
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
-
- if (PropertyName == wxT("ALTID")){
+ }
+
+ if (MapDataExists(DataCount, ItemListPref)){
+
+ ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second));
+
+ }
+
+ (*DataCount)++;
+
+ }
- FreeBusyListAltID.erase(intValueSeek); FreeBusyListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
+}
- FreeBusyListPID.erase(intValueSeek); FreeBusyListPID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- FreeBusyListPref.erase(intValueSeek); FreeBusyListPref.insert(std::make_pair(intValueSeek, intPref));
-
- } else if (PropertyName == wxT("MEDIATYPE")){
-
- FreeBusyListMediatype.erase(intValueSeek); FreeBusyListMediatype.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
+void frmContactEditor::LoadPictureData(wxString ItemName,
+ std::map<int,std::string> *ItemList,
+ std::map<int,int> *ItemListPref,
+ std::map<int,wxString> *ItemListType,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+
+ for (std::map<int,std::string>::iterator Iter = ItemList->begin();
+ Iter != ItemList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg2);
+ if (ItemName == "PHOTO"){
+
+ coldata.SetText("Picture");
+
+ } else if (ItemName == "LOGO"){
- ListCtrlIndex = lboFreeBusyAddresses->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboFreeBusyAddresses->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), intPref));
-
- }
-
- CaptureString(&wxSPropertySeg2, FALSE);
-
- FreeBusyList.erase(intValueSeek);
- FreeBusyListType.erase(intValueSeek);
- FreeBusyListTokens.erase(intValueSeek);
- FreeBusyList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
-
- if (intType == 0){
-
- FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType == 1){
-
- FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("home")));
- lboFreeBusyAddresses->SetItem(ListCtrlIndex, 1, _("Home"), intPref);
-
- } else if (intType == 2){
-
- FreeBusyListType.insert(std::make_pair(intValueSeek, wxT("work")));
- lboFreeBusyAddresses->SetItem(ListCtrlIndex, 1, _("Work"), intPref);
-
- }
-
- FreeBusyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- FreeBusyCount++;
- intValueSeek++;
- } else if (wxSProperty == wxT("KEY")){
+ coldata.SetText("Logo");
+
+ } else if (ItemName == "SOUND"){
+
+ coldata.SetText("Sound");
+
+ } else {
- int intPropertyLen = wxSPropertySeg1.Len();
- std::map<int, int> SplitPoints;
- std::map<int, int> SplitLength;
- std::map<int, int>::iterator SLiter;
- wxString PropertyData;
- wxString PropertyName;
- wxString PropertyValue;
- wxString PropertyTokens;
- bool AfterFirstToken = FALSE;
- bool FirstToken = TRUE;
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intPrevValue = 5;
- int intPref = 0;
- int intType = 0;
- int intSplitSeek = 0;
- long ListCtrlIndex;
-
- SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
-
- intPrevValue = 4;
+ coldata.SetText("Object");
+
+ }
+
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, ItemListType)){
+
+ if (ItemListType->find(*DataCount)->second == "home"){
- // Look for type before continuing.
+ ItemCtrl->SetItem(ListCtrlIndex, 1, _("Home"));
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+ } else if (ItemListType->find(*DataCount)->second == "work"){
- SLiter = SplitLength.find(intiter->first);
+ ItemCtrl->SetItem(ListCtrlIndex, 1, _("Work"));
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
+ }
- if (PropertyName == wxT("TYPE")){
+ }
- if (PropertyValue == wxT("work")){
-
- intType = 2;
-
- } else if (PropertyValue == wxT("home")){
+ if (MapDataExists(DataCount, ItemListPref)){
+
+ ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second));
+
+ }
+
+ (*DataCount)++;
+
+ }
- intType = 1;
-
- } else {
-
- intType = 0;
-
- }
-
- }
-
- }
-
- // Setup blank lines for later on.
-
- KeyList.insert(std::make_pair(intValueSeek, wxT("")));
- KeyListAltID.insert(std::make_pair(intValueSeek, wxT("")));
- KeyListPID.insert(std::make_pair(intValueSeek, wxT("")));
- KeyListPref.insert(std::make_pair(intValueSeek, 0));
- KeyListKeyType.insert(std::make_pair(intValueSeek, FALSE));
- KeyListDataType.insert(std::make_pair(intValueSeek, wxT("")));
- KeyListDataEncType.insert(std::make_pair(intValueSeek, wxT("")));
- KeyListTokens.insert(std::make_pair(intValueSeek, wxT("")));
-
- intPrevValue = 4;
-
- for (std::map<int, int>::iterator intiter = SplitPoints.begin();
- intiter != SplitPoints.end(); ++intiter){
+}
+
+void frmContactEditor::LoadVendorData(std::map<int,wxString> *ItemListPEN,
+ std::map<int,wxString> *ItemListElement,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+ wxString ItemValue;
+
+ for (std::map<int,wxString>::iterator Iter = ItemListPEN->begin();
+ Iter != ItemListPEN->end();
+ Iter++){
- SLiter = SplitLength.find(intiter->first);
+ ItemValue.clear();
- PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
-
- wxStringTokenizer PropertyElement (PropertyData, wxT("="));
- PropertyName = PropertyElement.GetNextToken();
- PropertyValue = PropertyElement.GetNextToken();
-
- intPrevValue = intiter->second;
-
- // Process properties.
-
- int intPropertyValueLen = PropertyValue.Len();
-
- if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
-
- PropertyValue.Trim();
- PropertyValue.RemoveLast();
-
- }
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+
+ ItemValue.Append(ItemListPEN->find(*DataCount)->second);
+ ItemValue.Append("-");
+ ItemValue.Append(ItemListElement->find(*DataCount)->second);
- if (PropertyValue.Mid(0, 1) == wxT("\"")){
-
- PropertyValue.Remove(0, 1);
-
- }
+ coldata.SetText(ItemValue);
- if (PropertyName == wxT("ALTID")){
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
+
+ (*DataCount)++;
+
+ }
+
+}
- KeyListAltID.erase(intValueSeek); KeyListAltID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
+void frmContactEditor::LoadXTokenData(std::map<int,wxString> *ItemListTokens,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+ wxString ItemValue;
- KeyListPID.erase(intValueSeek); KeyListPID.insert(std::make_pair(intValueSeek, PropertyValue));
-
- } else if (PropertyName == wxT("PREF")){
-
- intPref = wxAtoi(PropertyValue);
-
- KeyListPref.erase(intValueSeek); KeyListPref.insert(std::make_pair(intValueSeek, intPref));
-
- } else {
-
- // Something else we don't know about so append
- // to the tokens variable.
-
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
-
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
-
- }
-
- }
-
- }
+ for (std::map<int,wxString>::iterator Iter = ItemListTokens->begin();
+ Iter != ItemListTokens->end();
+ Iter++){
- intPropertyLen = wxSPropertySeg2.Len();
- SplitPoints.clear();
- SplitLength.clear();
- intSplitsFound = 0;
- intSplitSize = 0;
- intPrevValue = 0;
+ ItemValue.clear();
- for (int i = 0; i <= intPropertyLen; i++){
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+
+ ItemValue.Append(ItemListTokens->find(*DataCount)->second);
- intSplitSize++;
-
- if (wxSPropertySeg2.Mid(i, 1) == wxT(";") && wxSPropertySeg2.Mid((i - 1), 1) != wxT("\\")){
-
- intSplitsFound++;
- SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
-
- if (intSplitsFound == 6){
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
- break;
-
- } else {
-
- SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- intSplitSize = 0;
-
- }
+ coldata.SetText(ItemValue);
+
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
+
+ (*DataCount)++;
+
+ }
+
+}
+
+void frmContactEditor::LoadData(std::map<int,wxString> *ItemList,
+ wxComboBox *ItemCtrl){
+
+ int ItemIndex = 0;
+
+ if (MapDataExists(&ItemIndex, ItemList)){
+
+ cmbDisplayAs->SetValue(ItemList->find(0)->second);
+
+ }
+
+}
+
+void frmContactEditor::LoadRelatedData(std::map<int,wxString> *ItemList,
+ std::map<int,int> *ItemListPref,
+ std::map<int,wxString> *ItemListType,
+ wxListCtrl *ItemCtrl,
+ int *DataCount){
+
+ long ListCtrlIndex = -1;
+ wxString RelatedType;
+
+ for (std::map<int,wxString>::iterator Iter = ItemList->begin();
+ Iter != ItemList->end();
+ Iter++){
+
+ RelatedType.clear();
+
+ wxListItem coldata;
+
+ coldata.SetId(*DataCount);
+ coldata.SetData(*DataCount);
+
+ if (MapDataExists(DataCount, ItemListType)){
+
+ std::map<int,wxString>::iterator TypeIter = ItemListType->find(*DataCount);
+ if (TypeIter->second == wxT("contact")){
+
+ RelatedType = _("Contact");
+
+ } else if (TypeIter->second == wxT("acquaintance")){
+
+ RelatedType = _("Acquaintance");
+
+ } else if (TypeIter->second == wxT("friend")){
+
+ RelatedType = _("Friend");
+
+ } else if (TypeIter->second == wxT("met")){
+
+ RelatedType = _("Met");
+
+ } else if (TypeIter->second == wxT("co-worker")){
+
+ RelatedType = _("Co-worker");
+
+ } else if (TypeIter->second == wxT("colleague")){
+
+ RelatedType = _("Colleague");
+
+ } else if (TypeIter->second == wxT("co-resident")){
+
+ RelatedType = _("Co-resident");
+
+ } else if (TypeIter->second == wxT("neighbor")){
+
+ RelatedType = _("Neighbour");
+
+ } else if (TypeIter->second == wxT("child")){
+
+ RelatedType = _("Child");
+
+ } else if (TypeIter->second == wxT("parent")){
+
+ RelatedType = _("Parent");
+
+ } else if (TypeIter->second == wxT("sibling")){
+
+ RelatedType = _("Sibling");
+
+ } else if (TypeIter->second == wxT("spouse")){
+
+ RelatedType = _("Spouse");
+
+ } else if (TypeIter->second == wxT("kin")){
+
+ RelatedType = _("Kin");
+
+ } else if (TypeIter->second == wxT("muse")){
+
+ RelatedType = _("Muse");
+
+ } else if (TypeIter->second == wxT("crush")){
+
+ RelatedType = _("Crush");
+
+ } else if (TypeIter->second == wxT("date")){
+
+ RelatedType = _("Date");
+
+ } else if (TypeIter->second == wxT("sweetheart")){
+
+ RelatedType = _("Sweetheart");
+
+ } else if (TypeIter->second == wxT("me")){
+
+ RelatedType = _("Me");
+
+ } else if (TypeIter->second == wxT("agent")){
+
+ RelatedType = _("Agent");
+
+ } else if (TypeIter->second == wxT("emergency")){
+
+ RelatedType = _("Emergency");
+
+ } else {
+
+ RelatedType = TypeIter->second;
+
}
+
+ }
+
+ coldata.SetText(RelatedType);
+
+ ListCtrlIndex = ItemCtrl->InsertItem(coldata);
+
+ if (MapDataExists(DataCount, ItemList)){
+
+ ItemCtrl->SetItem(ListCtrlIndex, 1, ItemList->find(*DataCount)->second);
+
+ }
+
+ if (MapDataExists(DataCount, ItemListPref)){
+
+ ItemCtrl->SetItem(ListCtrlIndex, 2, wxString::Format("%i", ItemListPref->find(*DataCount)->second));
+
+ }
+
+ (*DataCount)++;
+
+ }
+
+}
+
+void frmContactEditor::LoadKind(ContactKindType *KindType){
+
+ switch (*KindType){
+ case CONTACTKIND_INDIVIDUAL:
+ cmbType->SetSelection(1);
+ break;
+ case CONTACTKIND_GROUP:
+ cmbType->SetSelection(2);
+ break;
+ case CONTACTKIND_ORGANISATION:
+ cmbType->SetSelection(3);
+ break;
+ case CONTACTKIND_LOCATION:
+ cmbType->SetSelection(4);
+ break;
+ case CONTACTKIND_NONE:
+ cmbType->SetSelection(0);
+ break;
+ }
- wxString wxSKeyURI;
- wxString wxSKeyMIME;
- wxString wxSKeyEncoding;
- wxString wxSKeyData;
- std::string base64enc;
-
- if (intSplitsFound = 0){
-
- } else {
+ wxCommandEvent nullevent;
- std::map<int, int>::iterator striter;
+ UpdateMembersTab(nullevent);
+
+}
+
+void frmContactEditor::LoadBirthday(wxString *BirthdayData, bool *BirthdayText){
+
+ if (BirthdayData->IsEmpty()){
+ return;
+ }
+
+ if (*BirthdayText == FALSE){
+
+ int DateYear = 0;
+ wxDateTime::Month DateMonth;
+ unsigned int DateDay;
+
+ wxString wxSData;
+
+ if (BirthdayData->Mid(0, 2) == wxT("--")){
+
+ // Skip year.
+
+ } else {
+
+ DateYear = wxAtoi(BirthdayData->Mid(0,4));
+
+ }
+
+ DateMonth = (wxDateTime::Month)(wxAtoi(BirthdayData->Mid(4,2)) - 1);
+ DateDay = wxAtoi(BirthdayData->Mid(6,2));
+
+ wxDateTime BDayDate(DateDay,DateMonth,DateYear);
+
+ dapBirthday->SetValue(BDayDate);
+
+ } else {
+
+ txtBirthday->SetValue(*BirthdayData);
+
+ }
+
+}
+
+void frmContactEditor::LoadAnniversary(wxString *AnniversaryData, bool *AnniversaryText){
+
+ if (AnniversaryData->IsEmpty()){
+ return;
+ }
+
+ if (*AnniversaryText == FALSE){
+
+ int DateYear = 0;
+ wxDateTime::Month DateMonth;
+ int DateDay;
+
+ wxString wxSData;
+
+ if (AnniversaryData->Mid(0, 2) == wxT("--")){
+
+ // Skip year.
+
+ } else {
+
+ DateYear = wxAtoi(AnniversaryData->Mid(0,4));
+
+ }
+
+ DateMonth = (wxDateTime::Month)(wxAtoi(AnniversaryData->Mid(4,2)) - 1);
+ DateDay = wxAtoi(AnniversaryData->Mid(6,2));
+
+ wxDateTime ADayDate(DateDay,DateMonth,DateYear);
+
+ dapAnniversary->SetValue(ADayDate);
+
+ } else {
+
+ txtAnniversary->SetValue(*AnniversaryData);
+
+ }
+
+}
+
+void frmContactEditor::LoadGender(wxString *GenderComponent, wxString *GenderIdentity){
+
+ // Deal with the Gender Component.
+
+ if (*GenderComponent == wxT("M")){
+
+ // Gender is Male.
- striter = SplitLength.find(1);
+ cmbGender->SetSelection(1);
+
+ } else if (*GenderComponent == wxT("F")){
+
+ // Gender is Female.
- wxStringTokenizer wSTDataType(wxSPropertySeg2.Mid(0, striter->second), wxT(":"));
+ cmbGender->SetSelection(2);
+
+ } else if (*GenderComponent == wxT("O")){
+
+ // Gender is Other.
- while (wSTDataType.HasMoreTokens() == TRUE){
-
- wxSKeyURI = wSTDataType.GetNextToken();
- wxSKeyMIME = wSTDataType.GetNextToken();
- break;
-
- }
+ cmbGender->SetSelection(3);
+
+ } else if (*GenderComponent == wxT("N")){
+
+ // Gender is None/Not Applicable.
+
+ cmbGender->SetSelection(4);
+
+ } else if (*GenderComponent == wxT("U")){
+
+ // Gender is Unknown.
- if (wxSKeyURI == wxT("data")){
-
- wxStringTokenizer wSTDataInfo(wxSPropertySeg2.Mid((striter->second + 2)), wxT(","));
-
- while (wSTDataInfo.HasMoreTokens() == TRUE){
-
- wxSKeyEncoding = wSTDataInfo.GetNextToken();
- wxSKeyData = wSTDataInfo.GetNextToken();
- break;
-
- }
-
+ cmbGender->SetSelection(5);
+
+ }
+
+ // Deal with the Gender Identity.
+
+ txtGenderDescription->SetValue(*GenderIdentity);
+
+}
+
+void frmContactEditor::LoadName(wxString *NameTitle, wxString *NameForename,
+ wxString *NameSurname, wxString *NameOtherNames,
+ wxString *NameSuffix){
+
+ txtTitle->SetValue(*NameTitle);
+ txtForename->SetValue(*NameForename);
+ txtSurname->SetValue(*NameSurname);
+ txtOtherNames->SetValue(*NameOtherNames);
+ txtSuffix->SetValue(*NameSuffix);
+
+}
+
+void frmContactEditor::LoadMember(std::map<int,wxString> *GroupList){
+
+ // Go through the list of contacts for the account and find the matching UID.
+ // If contact with UID doesn't match then say (unknown contact).
+
+ XABViewMode XVMData;
+ if (StartupEditMode == FALSE){
+ XVMData = MainPtr->GetViewMode();
+ }
+
+ wxString AccountDirFinal = GetAccountDir(wxSContactAccount, FALSE);
+
+ //wxString vcardfilenamewxs;
+ wxString vCardFilename;
+ wxString vCardFilenameFull;
+ wxString vCardDataString;
+ //wxStringTokenizer vcardfileline;
+ wxString lwxs;
+ wxString setname, setvalue;
+ wxString MemberData;
+ bool FoundContact = FALSE;
+ //vCardNames = new std::map<wxString, wxString, std::greater<wxString>>;
+ std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
+ std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
+
+ wxDir vcardaccdir(AccountDirFinal);
+
+ for (std::map<int,wxString>::iterator MemberIter = GroupList->begin();
+ MemberIter != GroupList->end();
+ MemberIter++){
+
+ MemberData = MemberIter->second;
+
+ bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
+ while(ProcFiles){
+
+ if (vCardFilename.Right(4) == wxT(".vcf") ||
+ vCardFilename.Right(4) == wxT(".VCF") ||
+ vCardFilename.Right(5) == wxT(".vcard") ||
+ vCardFilename.Right(5) == wxT(".VCARD")){
+
+ vCard Person;
+
+ vCardFilenameFull.Append(AccountDirFinal);
+ vCardFilenameFull.Append(wxT("/"));
+ vCardFilenameFull.Append(vCardFilename);
+
+ Person.LoadFile(vCardFilenameFull);
+
+ if (MemberData.Left(9) == wxT("urn:uuid:")){
+
+ wxString NewPropValue;
+ NewPropValue = MemberData.Mid(9, wxString::npos);
+ MemberData = NewPropValue;
+
+ }
+
+ if (Person.MeetBaseSpecification()){
+
+ wxString KindStatus = Person.Get(wxT("KIND"));
+
+ if (KindStatus == wxT("group")){
+
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+ continue;
+
}
+
+ wxString PersonName = Person.Get(wxT("N"));
+ wxString PersonUID = Person.Get(wxT("UID"));
+ wxString PersonFilename = vCardFilenameFull;
- }
-
- // Add the data to the General/Home/Work address variables.
-
- wxListItem coldata;
-
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
-
- if (wxSKeyURI == wxT("data")){
+ if (PersonUID != MemberData){
- if (wxSKeyMIME == wxT("application/pgp-keys")){
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+ continue;
- coldata.SetText(_("PGP Key"));
-
} else {
-
- coldata.SetText(_("Key"));
-
+ FoundContact = TRUE;
}
-
- KeyListDataEncType.erase(intValueSeek);
- KeyListKeyType.erase(intValueSeek);
- KeyListDataEncType.insert(std::make_pair(intValueSeek, wxSKeyEncoding));
- KeyListKeyType.insert(std::make_pair(intValueSeek, TRUE));
-
- KeyList.erase(intValueSeek);
- KeyList.insert(std::make_pair(intValueSeek, wxSKeyData));
-
- } else {
-
- coldata.SetText(wxSPropertySeg2);
-
- KeyList.erase(intValueSeek);
- KeyList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
-
+
+ //ContactsNames.insert(std::make_pair(PersonName, ContactIndex));
+ //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID));
+
+ if (XVMData.SortMode == 1){
+
+ // Split the name into sections.
+
+ vCardDataString = Person.Get(wxT("N"));
+
+ vCardName NameData = Person.GetName();
+
+ vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
+
+ } else if (XVMData.SortMode == 2){
+
+ // Split the name into sections.
+
+ vCardName NameData = Person.GetName();
+
+ vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
+
+ } else if (XVMData.SortMode == 3){
+
+ // Check and make sure that the top most nickname is used.
+
+ vCardDataString = Person.Get(wxT("NICKNAME"));
+
+ if (vCardDataString.IsEmpty()){
+
+ vCardDataString = wxT("(no nickname)");
+
+ }
+
+ } else if (XVMData.SortMode == 4){
+
+ vCardDataString = Person.Get(wxT("FN"));
+
+ }
+
+ if (XVMData.AscendingMode == TRUE){
+ vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID));
+ } else {
+ vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID));
+ }
+
+ } else {
+
+ }
+
+
+
}
-
- ListCtrlIndex = lboKeys->InsertItem(coldata);
-
- if (intPref > 0 && intPref < 101){
-
- lboKeys->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), intPref));
-
+
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+
+ }
+
+ if (FoundContact == FALSE){
+ if (XVMData.AscendingMode == TRUE){
+ vCardNamesAsc.insert(std::make_pair(MemberIter->second, MemberIter->second));
+ } else {
+ vCardNamesDsc.insert(std::make_pair(MemberIter->second, MemberIter->second));
}
-
+ }
- KeyListType.erase(intValueSeek);
- KeyListTokens.erase(intValueSeek);
- KeyListDataType.erase(intValueSeek);
+ if (XVMData.AscendingMode == TRUE){
- KeyListDataType.insert(std::make_pair(intValueSeek, wxSKeyMIME));
-
- if (intType = 0){
-
- KeyListType.insert(std::make_pair(intValueSeek, wxT("")));
-
- } else if (intType = 1){
-
- KeyListType.insert(std::make_pair(intValueSeek, wxT("home")));
-
- } else if (intType = 2){
-
- KeyListType.insert(std::make_pair(intValueSeek, wxT("work")));
+ for (std::map<wxString,wxString>::iterator iter = vCardNamesAsc.begin();
+ iter != vCardNamesAsc.end(); ++iter){
+
+ wxListItem ItemData;
+ ItemData.SetId(0);
+ ItemData.SetText(iter->first);
+
+ lboGroups->InsertItem(ItemData);
+
}
+
+
+ } else {
+
+ for (std::map<wxString,wxString>::iterator iter = vCardNamesDsc.begin();
+ iter != vCardNamesDsc.end(); ++iter){
+
+ wxListItem ItemData;
- KeyListTokens.insert(std::make_pair(intValueSeek, PropertyTokens));
-
- KeyCount++;
- intValueSeek++;
+ ItemData.SetId(0);
+ ItemData.SetText(iter->first);
+
+ lboGroups->InsertItem(ItemData);
+
+ }
+
+ }
+
+ }
+
+}
+
+void frmContactEditor::LoadAddress(std::map<int, wxString> *GeneralAddressList,
+ std::map<int, wxString> *GeneralAddressListTown,
+ std::map<int, wxString> *GeneralAddressListCounty,
+ std::map<int, wxString> *GeneralAddressListPostCode,
+ std::map<int, int> *GeneralAddressListPref,
+ std::map<int, wxString> *HomeAddressList,
+ std::map<int, wxString> *HomeAddressListTown,
+ std::map<int, wxString> *HomeAddressListCounty,
+ std::map<int, wxString> *HomeAddressListPostCode,
+ std::map<int, int> *HomeAddressListPref,
+ std::map<int, wxString> *BusinessAddressList,
+ std::map<int, wxString> *BusinessAddressListTown,
+ std::map<int, wxString> *BusinessAddressListCounty,
+ std::map<int, wxString> *BusinessAddressListPostCode,
+ std::map<int, int> *BusinessAddressListPref,
+ int *AddressCount){
+
+ long ListCtrlIndex = -1;
+
+ // Deal with the general addresses.
+
+ for (std::map<int,wxString>::iterator Iter = GeneralAddressList->begin();
+ Iter != GeneralAddressList->end();
+ Iter++){
+
+ wxListItem coldata;
+
+ coldata.SetId(*AddressCount);
+ coldata.SetData(*AddressCount);
+ coldata.SetText(Iter->second);
- } else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){
+ ListCtrlIndex = lboAddresses->InsertItem(coldata);
- UIDToken = wxSPropertySeg2;
- UIDProcessed = TRUE;
+ if (MapDataExists(AddressCount, GeneralAddressListTown)){
- } else if (wxSProperty.Mid(0, 3) == wxT("VND")){
+ lboAddresses->SetItem(ListCtrlIndex, 1, GeneralAddressListTown->find(*AddressCount)->second);
- // Split the Vendor three ways.
-
- wxStringTokenizer wSTVendorDetails(wxSPropertySeg1, wxT("-"));
-
- wxString wxSVNDID;
- wxString wxSVNDPropName;
- long ListCtrlIndex;
+ }
- while (wSTVendorDetails.HasMoreTokens() == TRUE){
-
- wSTVendorDetails.GetNextToken();
- wxSVNDID = wSTVendorDetails.GetNextToken();
- wxSVNDPropName = wSTVendorDetails.GetNextToken();
- break;
-
- }
-
- if (!wxSVNDID.IsEmpty() && !wxSVNDPropName.IsEmpty()){
-
- // Setup the values for later processing.
-
- VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
- VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
-
- // Add the data to the vendor variables.
-
- wxListItem coldata;
+ if (MapDataExists(AddressCount, GeneralAddressListCounty)){
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSVNDID + wxT("-") + wxSVNDPropName);
-
- ListCtrlIndex = lboVendorNamespace->InsertItem(coldata);
-
- VendorList.erase(intValueSeek);
- VendorListPEN.erase(intValueSeek);
- VendorListElement.erase(intValueSeek);
-
- VendorList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- VendorListPEN.insert(std::make_pair(intValueSeek, wxSVNDID));
- VendorListElement.insert(std::make_pair(intValueSeek, wxSVNDPropName));
-
- VendorCount++;
- intValueSeek++;
-
- }
+ lboAddresses->SetItem(ListCtrlIndex, 2, GeneralAddressListCounty->find(*AddressCount)->second);
- } else if (wxSProperty.Mid(0, 2) == wxT("X-")){
+ }
- long ListCtrlIndex;
-
- XTokenList.insert(std::make_pair(intValueSeek, wxSPropertySeg2));
- XTokenListTokens.insert(std::make_pair(intValueSeek, wxSPropertySeg1.Mid(2)));
-
- // Add to the form.
-
- wxListItem coldata;
+ if (MapDataExists(AddressCount, GeneralAddressListPostCode)){
- coldata.SetId(intValueSeek);
- coldata.SetData(intValueSeek);
- coldata.SetText(wxSPropertySeg1.Mid(2));
-
- ListCtrlIndex = lboXToken->InsertItem(coldata);
-
- XTokenCount++;
- intValueSeek++;
-
+ lboAddresses->SetItem(ListCtrlIndex, 3, GeneralAddressListPostCode->find(*AddressCount)->second);
}
- // Reset the variables.
+ if (MapDataExists(AddressCount, GeneralAddressListPref)){
- QuoteMode = FALSE;
- PropertyFind = TRUE;
- ExtraLineSeek = TRUE;
- ContactLineLen = 0;
- QuoteBreakPoint = 0;
- ContactLine.Clear();
- wxSProperty.Clear();
-
- }
+ lboAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", GeneralAddressListPref->find(*AddressCount)->second));
+
+ }
- FMTimer.SetFilename(Filename);
- FMTimer.Start(10000, FALSE);
+ (*AddressCount)++;
- EditMode = TRUE;
+ }
- return TRUE;
-}
-
-void frmContactEditor::SplitValues(wxString *PropertyLine,
- std::map<int,int> *SplitPoints,
- std::map<int,int> *SplitLength,
- int intSize){
+ // Deal with the home addresses.
- int intPropertyLen = PropertyLine->Len();
- int intSplitsFound = 0;
- int intSplitSize = 0;
- int intSplitSeek = 0;
+ for (std::map<int,wxString>::iterator Iter = HomeAddressList->begin();
+ Iter != HomeAddressList->end();
+ Iter++){
- for (int i = intSize; i <= intPropertyLen; i++){
+ wxListItem coldata;
- intSplitSize++;
-
- if (PropertyLine->Mid(i, 1) == wxT(";") &&
- PropertyLine->Mid((i - 1), 1) != wxT("\\")){
-
- if (intSplitsFound == 0){
-
- SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
-
- } else {
-
- SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
-
- }
-
- SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
-
- intSplitsFound++;
- intSplitSeek = i;
- intSplitSize = 0;
-
+ coldata.SetId(*AddressCount);
+ coldata.SetData(*AddressCount);
+ coldata.SetText(Iter->second);
+
+ ListCtrlIndex = lboHomeAddresses->InsertItem(coldata);
+
+ if (MapDataExists(AddressCount, HomeAddressListTown)){
+
+ lboHomeAddresses->SetItem(ListCtrlIndex, 1, HomeAddressListTown->find(*AddressCount)->second);
+
}
+ if (MapDataExists(AddressCount, HomeAddressListCounty)){
+
+ lboHomeAddresses->SetItem(ListCtrlIndex, 2, HomeAddressListCounty->find(*AddressCount)->second);
+
+ }
+
+ if (MapDataExists(AddressCount, HomeAddressListPostCode)){
+
+ lboHomeAddresses->SetItem(ListCtrlIndex, 3, HomeAddressListPostCode->find(*AddressCount)->second);
+
+ }
+
+ if (MapDataExists(AddressCount, HomeAddressListPref)){
+
+ lboHomeAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", HomeAddressListPref->find(*AddressCount)->second));
+
+ }
+
+ (*AddressCount)++;
+
}
+
+ // Deal with the work addresses.
+
+ for (std::map<int,wxString>::iterator Iter = BusinessAddressList->begin();
+ Iter != BusinessAddressList->end();
+ Iter++){
+
+ wxListItem coldata;
- if (intSplitsFound == 0){
-
- SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
- SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
-
- } else {
-
- SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
- SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
+ coldata.SetId(*AddressCount);
+ coldata.SetData(*AddressCount);
+ coldata.SetText(Iter->second);
+
+ ListCtrlIndex = lboBusinessAddresses->InsertItem(coldata);
+
+ if (MapDataExists(AddressCount, BusinessAddressListTown)){
+
+ lboBusinessAddresses->SetItem(ListCtrlIndex, 1, BusinessAddressListTown->find(*AddressCount)->second);
+
+ }
+ if (MapDataExists(AddressCount, BusinessAddressListCounty)){
+
+ lboBusinessAddresses->SetItem(ListCtrlIndex, 2, BusinessAddressListCounty->find(*AddressCount)->second);
+
+ }
+
+ if (MapDataExists(AddressCount, BusinessAddressListPostCode)){
+
+ lboBusinessAddresses->SetItem(ListCtrlIndex, 3, BusinessAddressListPostCode->find(*AddressCount)->second);
+
+ }
+
+ if (MapDataExists(AddressCount, BusinessAddressListPref)){
+
+ lboBusinessAddresses->SetItem(ListCtrlIndex, 4, wxString::Format("%i", BusinessAddressListPref->find(*AddressCount)->second));
+
+ }
+
+ (*AddressCount)++;
+
}
}
\ No newline at end of file