From: Steve Brokenshire Date: Tue, 14 Feb 2017 01:33:54 +0000 (+0000) Subject: frmEventEditor: Set calendar ID when editing event X-Git-Tag: release-0.03~4 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=e5e8bdcfe81d4184b57623167b55cd6bdab9fe90;p=xestiacalendar%2F.git frmEventEditor: Set calendar ID when editing event --- diff --git a/source/forms/eventeditor/frmEventEditor.cpp b/source/forms/eventeditor/frmEventEditor.cpp index 79f5831..4c95dc3 100644 --- a/source/forms/eventeditor/frmEventEditor.cpp +++ b/source/forms/eventeditor/frmEventEditor.cpp @@ -66,13 +66,17 @@ void frmEventEditor::SetupForm(CalendarDataStorage *dataStorage, XCALPreferences CDSGetCalendarEntryInfo eventInfo = dataStorage->GetEvent(eventID); + // Set the calendar ID. + + calendarID = eventInfo.calendarID; + // Load the calendar info. cmbCalendar->Show(false); lblCalendar->Show(false); szrDetails->Layout(); - szrList->Layout(); + szrList->Layout(); // Load the data into the form. @@ -295,6 +299,7 @@ void frmEventEditor::SaveContact(){ eventFilePath = eventFile; editMode = true; + calendarID = eventInfo->calendarID; eventID = addEventResult.calendarEntryID; @@ -325,7 +330,7 @@ void frmEventEditor::SaveContact(){ EventProperties *eventInfo = new EventProperties; eventInfo->eventName = txtEventName->GetValue().ToStdString(); - eventInfo->calendarID = calendarIDList[cmbCalendar->GetSelection()]; + eventInfo->calendarID = calendarID; eventInfo->eventID = eventID; eventInfo->eventYear = dapStartDate->GetValue().GetYear(); eventInfo->eventMonth = dapStartDate->GetValue().GetMonth(); diff --git a/source/forms/eventeditor/frmEventEditor.h b/source/forms/eventeditor/frmEventEditor.h index 6673505..a1b5f0e 100644 --- a/source/forms/eventeditor/frmEventEditor.h +++ b/source/forms/eventeditor/frmEventEditor.h @@ -51,6 +51,7 @@ class frmEventEditor : public frmEventEditorADT vector calendarIDList; bool editMode = false; int eventID = 0; + int calendarID = 0; string eventFilePath; void SaveContact(); XCALPreferences *preferences;