From daf696986aea17544f892f22a7e27a6cff989b75 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 3 Jul 2016 22:31:29 +0100 Subject: [PATCH] Added BDAY to the SaveString function of ContactDataObject --- .../cdo/ContactDataObject-Save.cpp | 44 ++++++++++++++++++- source/tests/xestiaab_contactsave.h | 1 + 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/source/contacteditor/cdo/ContactDataObject-Save.cpp b/source/contacteditor/cdo/ContactDataObject-Save.cpp index 9a45e46..72dad84 100644 --- a/source/contacteditor/cdo/ContactDataObject-Save.cpp +++ b/source/contacteditor/cdo/ContactDataObject-Save.cpp @@ -408,9 +408,49 @@ ContactSaveStatus ContactDataObject::SaveString(wxString *SaveData){ } - // TODO: Process BDAY. + // Process BDAY. - // TODO: Process ANNIVERSARY. + if (Birthday.size() > 0){ + + ProcessData.Append("BDAY"); + + // Check if there is a value for ALTID. + + if (BirthdayAltID.size() > 0){ + + ProcessData.Append(";ALTID="); + ProcessData.Append(BirthdayAltID); + + } + + // Check if there is a value for CALSCALE. + + if (BirthdayAltID.size() > 0){ + + ProcessData.Append(";CALSCALE="); + ProcessData.Append(BirthdayCalScale); + + } + + // Check if there is a value for tokens. + + if (BirthdayTokens.size() > 0){ + + ProcessData.Append(";"); + ProcessData.Append(BirthdayTokens); + + } + + ProcessData.Append(":"); + ProcessData.Append(Birthday); + ProcessData.Append("\n"); + + ProcessData = OutputText(&ProcessData); + + SaveData->Append(ProcessData); + ProcessData.clear(); + + } // Process TITLE. diff --git a/source/tests/xestiaab_contactsave.h b/source/tests/xestiaab_contactsave.h index ad719f5..810322c 100644 --- a/source/tests/xestiaab_contactsave.h +++ b/source/tests/xestiaab_contactsave.h @@ -90,6 +90,7 @@ TEST(ContactSave, ContactSaveTests){ "NICKNAME;TYPE=work;ALTID=99;LANGUAGE=en-GB;PID=10;PREF=1;YAY=Maybe;Boop=Boing\n" " :The Testing One\n" "GENDER;BEEP=Boop:F;Example Text\n" + "BDAY;ALTID=35;CALSCALE=georgian;HAPPY=Days:20040101\n" "TITLE;ALTID=20;LANGUAGE=text/plain;PID=21;PREF=22;EEP=LIGHT:Lord of Light\n" "TITLE;TYPE=home;ALTID=30;LANGUAGE=grass/dry;PID=31;PREF=32;EEP=DARK:Lord of D\n" " arkness\n" -- 2.39.5