X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Load.cpp;h=56e4b9ff3c4349cfcf3095070398dc681851dfa4;hb=97ebb2bdd18e21f4ed3e7a99e91b411cf5827324;hp=3f1d4075a33a39b742412502862d8121aafee1e8;hpb=616fa8b7c718ffaf13815ba5bad3d7b54f55c6b1;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index 3f1d407..56e4b9f 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -1,3 +1,21 @@ +// 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 + #include #include @@ -12,6 +30,7 @@ #include "../vcard/vcard.h" #include "../common/textprocessing.h" #include "../common/dirs.h" +#include "cdo/ContactDataObject.h" bool frmContactEditor::LoadContact(wxString Filename){ @@ -43,6 +62,8 @@ bool frmContactEditor::LoadContact(wxString Filename){ } + ContactEditorData.LoadFile(Filename); + ContactFile.ReadAll(&wxSContactString, wxConvAuto()); // Split the lines. @@ -69,13 +90,13 @@ bool frmContactEditor::LoadContact(wxString Filename){ 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; @@ -115,6 +136,55 @@ bool frmContactEditor::LoadContact(wxString Filename){ int XTokenCount = 0; //int intValueSeek = 1; + // Process the unique ID (UID) + + UIDToken = ContactEditorData.UIDToken; + + // 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 address (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); + for (std::map::iterator iter = ContactFileLines.begin(); iter != ContactFileLines.end(); ++iter){ @@ -207,7 +277,6 @@ bool frmContactEditor::LoadContact(wxString Filename){ // Check if version is 4.0, otherwise don't // load. - wxPuts(wxSPropertySeg2); 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); @@ -217,37 +286,37 @@ bool frmContactEditor::LoadContact(wxString Filename){ VersionProcessed = TRUE; - } if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){ + }/* if (wxSProperty == wxT("KIND") && KindProcessed == FALSE){ // See frmContactEditor-LoadGroup.cpp LoadKind(wxSPropertySeg2); - } else if (wxSProperty == wxT("MEMBER")){ + }/* else if (wxSProperty == wxT("MEMBER")){ // See frmContactEditor-LoadGroup.cpp LoadMember(wxSPropertySeg2, &GroupCount); - } else if (wxSProperty == wxT("FN")){ + }*/ else if (wxSProperty == wxT("FN")){ // See frmContactEditor-LoadName.cpp LoadFN(wxSPropertySeg1, wxSPropertySeg2, &FNCount, &FNProcessed, &ContactData); - } else if (wxSProperty == wxT("N") && NameProcessed == FALSE){ + }/* else if (wxSProperty == wxT("N") && NameProcessed == FALSE){ // See frmContactEditor-LoadName.cpp LoadN(wxSPropertySeg1, wxSPropertySeg2, &NameProcessed, &ContactData); - } else if (wxSProperty == wxT("NICKNAME")){ + }*/ else if (wxSProperty == wxT("NICKNAME")){ // See frmContactEditor-LoadNickname.cpp LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData); - } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ + }/* else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ // See frmContactEditor-LoadGender.cpp @@ -265,19 +334,19 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed); - } else if (wxSProperty == wxT("TZ")){ + }*/ else if (wxSProperty == wxT("TZ")){ // See frmContactEditor-LoadTimeZone.cpp LoadTimeZone(wxSPropertySeg1, wxSPropertySeg2, &TZCount); - } else if (wxSProperty == wxT("ADR")){ + }/* else if (wxSProperty == wxT("ADR")){ // See frmContactEditor-LoadAddress.cpp LoadADR(wxSPropertySeg1, wxSPropertySeg2, &ADRCount); - } else if (wxSProperty == wxT("EMAIL")){ + }*/ else if (wxSProperty == wxT("EMAIL")){ // See frmContactEditor-LoadEmail.cpp @@ -391,12 +460,12 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadKey(wxSPropertySeg1, wxSPropertySeg2, &KeyCount); - } else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){ + }/* else if (wxSProperty == wxT("UID") && UIDProcessed == FALSE){ UIDToken = wxSPropertySeg2; UIDProcessed = TRUE; - } else if (wxSProperty.Mid(0, 3) == wxT("VND")){ + }*/ else if (wxSProperty.Mid(0, 3) == wxT("VND")){ // Split the Vendor three ways.