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<int, wxString> ContactFileLines;
- std::map<int, wxString>::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){
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 KeyCount = 0;
int VendorCount = 0;
int XTokenCount = 0;
- //int intValueSeek = 1;
// Process the unique ID (UID)
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.
-
- 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);
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;