From e5e8bdcfe81d4184b57623167b55cd6bdab9fe90 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 14 Feb 2017 01:33:54 +0000 Subject: [PATCH] frmEventEditor: Set calendar ID when editing event --- source/forms/eventeditor/frmEventEditor.cpp | 9 +++++++-- source/forms/eventeditor/frmEventEditor.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) 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; -- 2.39.2