From: Steve Brokenshire Date: Mon, 28 Dec 2015 19:20:44 +0000 (+0000) Subject: Introduced simplified LoadBirthday and LoadAnniversary. X-Git-Tag: release-0.09~142 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=b119dfb7131f355e5527bd9c4271c1f3bd32285d Introduced simplified LoadBirthday and LoadAnniversary. --- diff --git a/source/contacteditor/frmContactEditor-Load.cpp b/source/contacteditor/frmContactEditor-Load.cpp index 6d63680..8449f61 100644 --- a/source/contacteditor/frmContactEditor-Load.cpp +++ b/source/contacteditor/frmContactEditor-Load.cpp @@ -136,7 +136,15 @@ bool frmContactEditor::LoadContact(wxString Filename){ int XTokenCount = 0; //int intValueSeek = 1; - // Process the Gender (GENDER). + // 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); @@ -271,11 +279,11 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadNickname(wxSPropertySeg1, wxSPropertySeg2, &NicknameCount, &ContactData); - } else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ + }/* else if (wxSProperty == wxT("GENDER") && GenderProcessed == FALSE){ // See frmContactEditor-LoadGender.cpp - //LoadGender(wxSPropertySeg1, wxSPropertySeg2, &GenderProcessed, &ContactData); + LoadGender(wxSPropertySeg1, wxSPropertySeg2, &GenderProcessed, &ContactData); } else if (wxSProperty == wxT("BDAY") && BirthdayProcessed == FALSE){ @@ -289,7 +297,7 @@ bool frmContactEditor::LoadContact(wxString Filename){ LoadAnniversary(wxSPropertySeg1, wxSPropertySeg2, &AnniversaryProcessed); - } else if (wxSProperty == wxT("TZ")){ + }*/ else if (wxSProperty == wxT("TZ")){ // See frmContactEditor-LoadTimeZone.cpp diff --git a/source/contacteditor/frmContactEditor-LoadBADays.cpp b/source/contacteditor/frmContactEditor-LoadBADays.cpp index 0318762..4b3e669 100644 --- a/source/contacteditor/frmContactEditor-LoadBADays.cpp +++ b/source/contacteditor/frmContactEditor-LoadBADays.cpp @@ -18,6 +18,76 @@ #include "frmContactEditor.h" +void frmContactEditor::LoadBirthday(wxString *BirthdayData, bool *BirthdayText){ + + if (*BirthdayText == FALSE){ + + int DateYear = 0; + wxDateTime::Month DateMonth; + unsigned int DateDay; + + wxString wxSData; + + if (Birthday.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 (*AnniversaryText == FALSE){ + + int DateYear = 0; + wxDateTime::Month DateMonth; + int DateDay; + + wxString wxSData; + + if (Anniversary.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::LoadBDay(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *BirthdayProcessed){ // Process date. Preserve the remainder in the string. diff --git a/source/contacteditor/frmContactEditor.h b/source/contacteditor/frmContactEditor.h index 873fd82..8b872b3 100644 --- a/source/contacteditor/frmContactEditor.h +++ b/source/contacteditor/frmContactEditor.h @@ -640,6 +640,8 @@ class frmContactEditor : public frmContactEditorADT void LoadKey(wxString wxSPropertySeg1, wxString wxSPropertySeg2, int *KeyCount); void LoadGender(wxString *GenderComponent, wxString *GenderIdentity); + void LoadBirthday(wxString *BirthdayData, bool *BirthdayText); + void LoadAnniversary(wxString *AnniversaryData, bool *AnniversaryText); int intValueSeek = 1; bool IsGroup = FALSE;