X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Load.cpp;h=c6ae96a6b328b061291a68ec74b005bac05a9910;hb=ada42724cf083b0a311cf22260485d61516c25c8;hp=995bb15e7c459a40113f2b45042948df542474c7;hpb=76d4a9e4241fb4a79b6785e30b5c80b6a2c2d037;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index 995bb15..c6ae96a 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -47,43 +47,6 @@ bool frmContactEditor::LoadContact(wxString Filename){ 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.Open(Filename, wxT("r")); -#endif - - if (ContactFile.IsOpened() == FALSE){ - - return FALSE; - - } - - ContactEditorData.LoadFile(Filename); - - ContactFile.ReadAll(&wxSContactString, wxConvAuto()); - - // Split the lines. - - std::map ContactFileLines; - std::map::iterator striter; - - wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n")); - - int ContactLineSeek = 0; - - while (wSTContactFileLines.HasMoreTokens() == TRUE){ - - ContactLine = wSTContactFileLines.GetNextToken(); - ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine)); - ContactLineSeek++; - - } -*/ - ContactLoadStatus LoadResult = ContactEditorData.LoadFile(Filename); switch(LoadResult){ @@ -119,30 +82,10 @@ bool frmContactEditor::LoadContact(wxString Filename){ // Get the line. - bool QuoteMode = FALSE; - bool PropertyFind = TRUE; - bool HasExtraNicknames = FALSE; - bool IgnoreGender = FALSE; - bool ExtraLineSeek = TRUE; - //bool BirthdayProcessed = FALSE; - //bool AnniversaryProcessed = FALSE; - bool FNProcessed = FALSE; - bool GenderProcessed = FALSE; - bool NameProcessed = 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; - size_t ContactLineLen = 0; - int QuoteBreakPoint = 0; - int FNCount = 0; - int NameCount = 0; int NicknameCount = 0; int ADRCount = 0; int EmailCount = 0; @@ -158,7 +101,6 @@ bool frmContactEditor::LoadContact(wxString Filename){ int OrgCount = 0; int NoteCount = 0; int CategoryCount = 0; - int GroupCount = 0; int PhotoCount = 0; int LogoCount = 0; int SoundCount = 0; @@ -168,12 +110,11 @@ bool frmContactEditor::LoadContact(wxString Filename){ int KeyCount = 0; int VendorCount = 0; int XTokenCount = 0; - //int intValueSeek = 1; // Process the unique ID (UID) - UIDToken = ContactEditorData.UIDToken; - + // Do nothing at the moment. + // Process the contact type (KIND) (frmContactEditor-LoadGroup.cpp) LoadKind(&ContactEditorData.ContactKind); @@ -374,17 +315,17 @@ bool frmContactEditor::LoadContact(wxString Filename){ // Process the instant messaging (IMPP). - LoadData(&ContactEditorData.GeneralIMList, + LoadData(&ContactEditorData.GeneralIMListTypeInfo, &ContactEditorData.GeneralIMListPref, - &ContactEditorData.GeneralIMListTypeInfo, + &ContactEditorData.GeneralIMList, lboIM, - &ContactEditorData.HomeIMList, - &ContactEditorData.HomeIMListPref, &ContactEditorData.HomeIMListTypeInfo, + &ContactEditorData.HomeIMListPref, + &ContactEditorData.HomeIMList, lboHomeIM, - &ContactEditorData.BusinessIMList, - &ContactEditorData.BusinessIMListPref, &ContactEditorData.BusinessIMListTypeInfo, + &ContactEditorData.BusinessIMListPref, + &ContactEditorData.BusinessIMList, lboBusinessIM, &IMPPCount); @@ -480,371 +421,6 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadData(&ContactEditorData.FullNamesList, cmbDisplayAs); - - /*for (std::map::iterator iter = ContactFileLines.begin(); - iter != ContactFileLines.end(); ++iter){ - - // Find the colon which splits the start bit from the data part. - - ContactLine = iter->second; - - while (ExtraLineSeek == TRUE){ - - // Check if there is extra data on the next line - // (indicated by space or tab at the start) and add data. - - iter++; - - if (iter == ContactFileLines.end()){ - - iter--; - break; - - } - - wxSPropertyNextLine = iter->second; - - - if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){ - - wxSPropertyNextLine.Remove(0, 1); - //wxSPropertyNextLine.Trim(FALSE); - //ContactLine.Trim(); - ContactLine.Append(wxSPropertyNextLine); - - } else { - - iter--; - ExtraLineSeek = FALSE; - - } - - } - - ContactLineLen = ContactLine.Len(); - - // Make sure we are not in quotation mode. - // Make sure colon does not have \ or \\ before it. - - for (int i = 0; i <= ContactLineLen; i++){ - - if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){ - - PropertyFind = FALSE; - - } else if (PropertyFind == TRUE){ - - wxSProperty.Append(ContactLine.Mid(i, 1)); - - } - - if (ContactLine.Mid(i, 1) == wxT("\"")){ - - if (QuoteMode == TRUE){ - - QuoteMode = FALSE; - - } else { - - QuoteMode = TRUE; - - } - - } - - if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){ - - QuoteBreakPoint = i; - break; - - } - - } - - // Split that line at the point into two variables (ignore the colon). - - wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint); - wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1)); - - // Add the data into the contact editor depending on what it is. - - 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; - } - - VersionProcessed = TRUE; - - }/* if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){ - - // See frmContactEditor-LoadGroup.cpp - - LoadKind(wxSPropertySeg2); - - }/* else if (wxSProperty == wxT("MEMBER")){ - - // See frmContactEditor-LoadGroup.cpp - - LoadMember(wxSPropertySeg2, &GroupCount); - - } else if (wxSProperty == wxT("FN")){ - - // See frmContactEditor-LoadName.cpp - - LoadFN(wxSPropertySeg1, wxSPropertySeg2, &FNCount, &FNProcessed, &ContactData); - - } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){ - - // See frmContactEditor-LoadName.cpp - - LoadN(wxSPropertySeg1, wxSPropertySeg2, &NameProcessed, &ContactData); - - } else if (wxSProperty == wxT("NICKNAME")){ - - // See frmContactEditor-LoadNickname.cpp - - LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData); - - } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ - - // See frmContactEditor-LoadGender.cpp - - LoadGender(wxSPropertySeg1, wxSPropertySeg2, &GenderProcessed, &ContactData); - - } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){ - - // See frmContactEditor-LoadBADays.cpp - - LoadBDay(wxSPropertySeg1, wxSPropertySeg2, &BirthdayProcessed); - - } else if (wxSProperty == wxT("ANNIVERSARY") && AnniversaryProcessed == FALSE){ - - // See frmContactEditor-LoadBADays.cpp - - LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed); - - } else if (wxSProperty == wxT("TZ")){ - - // See frmContactEditor-LoadTimeZone.cpp - - LoadTimeZone(wxSPropertySeg1, wxSPropertySeg2, &TZCount); - - } else if (wxSProperty == wxT("ADR")){ - - // See frmContactEditor-LoadAddress.cpp - - LoadADR(wxSPropertySeg1, wxSPropertySeg2, &ADRCount); - - } else if (wxSProperty == wxT("EMAIL")){ - - // See frmContactEditor-LoadEmail.cpp - - 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 - - LoadLanguage(wxSPropertySeg1, wxSPropertySeg2, &LangCount); - - } else if (wxSProperty == wxT("GEO")){ - - // See frmContactEditor-LoadGeo.cpp - - LoadGeo(wxSPropertySeg1, wxSPropertySeg2, &GeoCount); - - } else if (wxSProperty == wxT("RELATED")){ - - // See fromContactEditor-LoadRelated.cpp - - LoadRelated(wxSPropertySeg1, wxSPropertySeg2, &RelatedCount); - - } else if (wxSProperty == wxT("URL")){ - - // See frmContactEditor-LoadURL.cpp - - LoadURL(wxSPropertySeg1, wxSPropertySeg2, &URLCount); - - } else if (wxSProperty == wxT("TITLE")) { - - // See frmContactEditor-LoadTitle.cpp - - LoadTitle(wxSPropertySeg1, wxSPropertySeg2, &TitleCount); - - } else if (wxSProperty == wxT("ROLE")) { - - // See frmContactEditor-LoadRole.cpp - - LoadRole(wxSPropertySeg1, wxSPropertySeg2, &RoleCount); - - } else if (wxSProperty == wxT("ORG")) { - - // See frmContactEditor-LoadOrg.cpp - - LoadOrg(wxSPropertySeg1, wxSPropertySeg2, &OrgCount); - - } else if (wxSProperty == wxT("NOTE")) { - - // See frmContactEditor-LoadNote.cpp - - LoadNote(wxSPropertySeg1, wxSPropertySeg2, &NoteCount); - - } else if (wxSProperty == wxT("CATEGORIES")) { - - // See frmContactEditor-LoadCategory.cpp - - LoadCategory(wxSPropertySeg1, wxSPropertySeg2, &CategoryCount); - - } else if (wxSProperty == wxT("PHOTO")) { - - // See frmContactEditor-LoadPhoto.cpp - - LoadPhoto(wxSPropertySeg1, wxSPropertySeg2, &PhotoCount); - - } else if (wxSProperty == wxT("LOGO")) { - - // See frmContactEditor-LoadLogo.cpp - - LoadLogo(wxSPropertySeg1, wxSPropertySeg2, &LogoCount); - - } else if (wxSProperty == wxT("SOUND")) { - - // See frmContactEditor-LoadSound.cpp - - LoadSound(wxSPropertySeg1, wxSPropertySeg2, &SoundCount); - - } else if (wxSProperty == wxT("CALURI")){ - - // See frmContactEditor-LoadCalendar.cpp - - LoadCalURI(wxSPropertySeg1, wxSPropertySeg2, &CalAdrCount); - - } else if (wxSProperty == wxT("CALADRURI")){ - - // See frmContactEditor-LoadCalendar.cpp - - 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 - - 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. - - 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; - - 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++; - - } - - } 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; - - coldata.SetId(intValueSeek); - coldata.SetData(intValueSeek); - coldata.SetText(wxSPropertySeg1.Mid(2)); - - ListCtrlIndex = lboXToken->InsertItem(coldata); - - XTokenCount++; - intValueSeek++; - - - } - - // Reset the variables. - - QuoteMode = FALSE; - PropertyFind = TRUE; - ExtraLineSeek = TRUE; - ContactLineLen = 0; - QuoteBreakPoint = 0; - ContactLine.Clear(); - wxSProperty.Clear(); - - }*/ FMTimer.SetFilename(Filename); FMTimer.Start(10000, FALSE); @@ -859,6 +435,8 @@ void frmContactEditor::SplitValues(wxString *PropertyLine, std::map *SplitLength, int intSize){ + // Split the values. + size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; @@ -871,22 +449,22 @@ void frmContactEditor::SplitValues(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); - } else { + } else { - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); - - } + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + } - intSplitsFound++; - intSplitSeek = i; - intSplitSize = 0; + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + intSplitsFound++; + intSplitSeek = i; + intSplitSize = 0; + } } @@ -916,6 +494,9 @@ void frmContactEditor::LoadData(std::map *GeneralList, wxListCtrl *BusinessListCtrl, int *DataCount){ + // Load data into the controls (first section of data and preference + // only). + long ListCtrlIndex = -1; // Deal with the general items. @@ -1006,6 +587,9 @@ void frmContactEditor::LoadData(std::map *GeneralList, wxListCtrl *BusinessListCtrl, int *DataCount){ + // Load data into the controls (first section of data, + // type and preference). + long ListCtrlIndex = -1; // Deal with the general items. @@ -1106,6 +690,8 @@ void frmContactEditor::LoadData(std::map *ItemList, wxListCtrl *ItemCtrl, int *DataCount){ + // Load the data (name and preference only). + long ListCtrlIndex = -1; for (std::map::iterator Iter = ItemList->begin(); @@ -1138,6 +724,8 @@ void frmContactEditor::LoadData(std::map *ItemList, wxListCtrl *ItemCtrl, int *DataCount){ + // Load the data (name, preference and type). + long ListCtrlIndex = -1; for (std::map::iterator Iter = ItemList->begin(); @@ -1178,6 +766,8 @@ void frmContactEditor::LoadData(wxString ItemName, wxListCtrl *ItemCtrl, int *DataCount){ + // Load data (name, preference, type and data type). + long ListCtrlIndex = -1; for (std::map::iterator Iter = ItemList->begin(); @@ -1246,6 +836,8 @@ void frmContactEditor::LoadPictureData(wxString ItemName, wxListCtrl *ItemCtrl, int *DataCount){ + // Load the picture data. + long ListCtrlIndex = -1; for (std::map::iterator Iter = ItemList->begin(); @@ -1307,7 +899,9 @@ void frmContactEditor::LoadVendorData(std::map *ItemListPEN, std::map *ItemListElement, wxListCtrl *ItemCtrl, int *DataCount){ - + + // Load the vendor data. + long ListCtrlIndex = -1; wxString ItemValue; @@ -1340,6 +934,8 @@ void frmContactEditor::LoadXTokenData(std::map *ItemListTokens, wxListCtrl *ItemCtrl, int *DataCount){ + // Load the X-Token data. + long ListCtrlIndex = -1; wxString ItemValue; @@ -1369,6 +965,8 @@ void frmContactEditor::LoadXTokenData(std::map *ItemListTokens, void frmContactEditor::LoadData(std::map *ItemList, wxComboBox *ItemCtrl){ + // Load data into a wxComboBox. + int ItemIndex = 0; if (MapDataExists(&ItemIndex, ItemList)){ @@ -1385,6 +983,8 @@ void frmContactEditor::LoadRelatedData(std::map *ItemList, wxListCtrl *ItemCtrl, int *DataCount){ + // Load related data (name, preference and type). + long ListCtrlIndex = -1; wxString RelatedType; @@ -1515,6 +1115,8 @@ void frmContactEditor::LoadRelatedData(std::map *ItemList, void frmContactEditor::LoadKind(ContactKindType *KindType){ + // Load contact kind. + switch (*KindType){ case CONTACTKIND_INDIVIDUAL: cmbType->SetSelection(1); @@ -1541,6 +1143,12 @@ void frmContactEditor::LoadKind(ContactKindType *KindType){ void frmContactEditor::LoadBirthday(wxString *BirthdayData, bool *BirthdayText){ + // Load Birthday. + + if (BirthdayData->IsEmpty()){ + return; + } + if (*BirthdayText == FALSE){ int DateYear = 0; @@ -1549,7 +1157,7 @@ void frmContactEditor::LoadBirthday(wxString *BirthdayData, bool *BirthdayText){ wxString wxSData; - if (Birthday.Mid(0, 2) == wxT("--")){ + if (BirthdayData->Mid(0, 2) == wxT("--")){ // Skip year. @@ -1576,6 +1184,12 @@ void frmContactEditor::LoadBirthday(wxString *BirthdayData, bool *BirthdayText){ void frmContactEditor::LoadAnniversary(wxString *AnniversaryData, bool *AnniversaryText){ + // Load Anniversary. + + if (AnniversaryData->IsEmpty()){ + return; + } + if (*AnniversaryText == FALSE){ int DateYear = 0; @@ -1584,7 +1198,7 @@ void frmContactEditor::LoadAnniversary(wxString *AnniversaryData, bool *Annivers wxString wxSData; - if (Anniversary.Mid(0, 2) == wxT("--")){ + if (AnniversaryData->Mid(0, 2) == wxT("--")){ // Skip year. @@ -1611,6 +1225,8 @@ void frmContactEditor::LoadAnniversary(wxString *AnniversaryData, bool *Annivers void frmContactEditor::LoadGender(wxString *GenderComponent, wxString *GenderIdentity){ + // Load Gender. + // Deal with the Gender Component. if (*GenderComponent == wxT("M")){ @@ -1655,6 +1271,8 @@ void frmContactEditor::LoadName(wxString *NameTitle, wxString *NameForename, wxString *NameSurname, wxString *NameOtherNames, wxString *NameSuffix){ + // Load Name. + txtTitle->SetValue(*NameTitle); txtForename->SetValue(*NameForename); txtSurname->SetValue(*NameSurname); @@ -1665,6 +1283,8 @@ void frmContactEditor::LoadName(wxString *NameTitle, wxString *NameForename, void frmContactEditor::LoadMember(std::map *GroupList){ + // Load group data. + // 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). @@ -1675,16 +1295,13 @@ void frmContactEditor::LoadMember(std::map *GroupList){ 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>; std::multimap> vCardNamesAsc; std::multimap> vCardNamesDsc; @@ -1704,102 +1321,106 @@ void frmContactEditor::LoadMember(std::map *GroupList){ vCardFilename.Right(5) == wxT(".vcard") || vCardFilename.Right(5) == wxT(".VCARD")){ - vCard Person; + vCard Person; - vCardFilenameFull.Append(AccountDirFinal); - vCardFilenameFull.Append(wxT("/")); - vCardFilenameFull.Append(vCardFilename); + vCardFilenameFull.Append(AccountDirFinal); + vCardFilenameFull.Append(wxT("/")); + vCardFilenameFull.Append(vCardFilename); - Person.LoadFile(vCardFilenameFull); + Person.LoadFile(vCardFilenameFull); - if (MemberData.Left(9) == wxT("urn:uuid:")){ + if (MemberData.Left(9) == wxT("urn:uuid:")){ - wxString NewPropValue; - NewPropValue = MemberData.Mid(9, wxString::npos); - MemberData = NewPropValue; + wxString NewPropValue; + NewPropValue = MemberData.Mid(9, wxString::npos); + MemberData = NewPropValue; - } + } - if (Person.MeetBaseSpecification()){ + if (Person.MeetBaseSpecification()){ - wxString KindStatus = Person.Get(wxT("KIND")); + wxString KindStatus = Person.Get(wxT("KIND")); - if (KindStatus == wxT("group")){ + if (KindStatus == wxT("group")){ - vCardFilename.Clear(); - vCardFilenameFull.Clear(); - vCardDataString.Clear(); - ProcFiles = vcardaccdir.GetNext(&vCardFilename); - continue; + 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; - - if (PersonUID != MemberData){ + wxString PersonName = Person.Get(wxT("N")); + wxString PersonUID = Person.Get(wxT("UID")); + wxString PersonFilename = vCardFilenameFull; + + if (PersonUID != MemberData){ - vCardFilename.Clear(); - vCardFilenameFull.Clear(); - vCardDataString.Clear(); - ProcFiles = vcardaccdir.GetNext(&vCardFilename); - continue; + vCardFilename.Clear(); + vCardFilenameFull.Clear(); + vCardDataString.Clear(); + ProcFiles = vcardaccdir.GetNext(&vCardFilename); + continue; - } else { - FoundContact = TRUE; - } + } else { + + FoundContact = TRUE; + + } - //ContactsNames.insert(std::make_pair(PersonName, ContactIndex)); - //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID)); + //ContactsNames.insert(std::make_pair(PersonName, ContactIndex)); + //ContactsUIDs.insert(std::make_pair(ContactIndex, PersonUID)); - if (XVMData.SortMode == 1){ + if (XVMData.SortMode == 1){ - // Split the name into sections. + // Split the name into sections. - vCardDataString = Person.Get(wxT("N")); + vCardDataString = Person.Get(wxT("N")); - vCardName NameData = Person.GetName(); + vCardName NameData = Person.GetName(); - vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname; + vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname; - } else if (XVMData.SortMode == 2){ + } else if (XVMData.SortMode == 2){ - // Split the name into sections. + // Split the name into sections. - vCardName NameData = Person.GetName(); + vCardName NameData = Person.GetName(); - vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename; + vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename; - } else if (XVMData.SortMode == 3){ + } else if (XVMData.SortMode == 3){ - // Check and make sure that the top most nickname is used. + // Check and make sure that the top most nickname is used. - vCardDataString = Person.Get(wxT("NICKNAME")); + vCardDataString = Person.Get(wxT("NICKNAME")); - if (vCardDataString.IsEmpty()){ + if (vCardDataString.IsEmpty()){ - vCardDataString = wxT("(no nickname)"); + vCardDataString = wxT("(no nickname)"); - } + } - } else if (XVMData.SortMode == 4){ + } else if (XVMData.SortMode == 4){ - vCardDataString = Person.Get(wxT("FN")); + vCardDataString = Person.Get(wxT("FN")); - } + } + + if (XVMData.AscendingMode == TRUE){ + + vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID)); + + } else { + + vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID)); + + } - if (XVMData.AscendingMode == TRUE){ - vCardNamesAsc.insert(std::make_pair(vCardDataString, PersonUID)); } else { - vCardNamesDsc.insert(std::make_pair(vCardDataString, PersonUID)); - } - - } else { - - } - + } } @@ -1808,44 +1429,48 @@ void frmContactEditor::LoadMember(std::map *GroupList){ vCardDataString.Clear(); ProcFiles = vcardaccdir.GetNext(&vCardFilename); - } + } - if (FoundContact == FALSE){ + if (FoundContact == FALSE){ + if (XVMData.AscendingMode == TRUE){ - vCardNamesAsc.insert(std::make_pair(MemberIter->second, MemberIter->second)); + + vCardNamesAsc.insert(std::make_pair(MemberIter->second, MemberIter->second)); + } else { - vCardNamesDsc.insert(std::make_pair(MemberIter->second, MemberIter->second)); + + vCardNamesDsc.insert(std::make_pair(MemberIter->second, MemberIter->second)); + } - } - if (XVMData.AscendingMode == TRUE){ + } + + if (XVMData.AscendingMode == TRUE){ for (std::map::iterator iter = vCardNamesAsc.begin(); - iter != vCardNamesAsc.end(); ++iter){ + iter != vCardNamesAsc.end(); ++iter){ wxListItem ItemData; ItemData.SetId(0); ItemData.SetText(iter->first); - lboGroups->InsertItem(ItemData); } - - } else { + } else { for (std::map::iterator iter = vCardNamesDsc.begin(); - iter != vCardNamesDsc.end(); ++iter){ + iter != vCardNamesDsc.end(); ++iter){ wxListItem ItemData; ItemData.SetId(0); ItemData.SetText(iter->first); - + lboGroups->InsertItem(ItemData); - } + } } @@ -1870,6 +1495,8 @@ void frmContactEditor::LoadAddress(std::map *GeneralAddressList, std::map *BusinessAddressListPref, int *AddressCount){ + // Load address. + long ListCtrlIndex = -1; // Deal with the general addresses.