From: Steve Brokenshire Date: Tue, 14 Feb 2017 01:34:45 +0000 (+0000) Subject: XCCalendarDay/XCCalendarMonthView: Fixed browse after deleting event X-Git-Tag: release-0.03~3 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=a245ca84f8c7aacc34c966c4b8c6ca34a0fa0c1c;p=xestiacalendar%2F.git XCCalendarDay/XCCalendarMonthView: Fixed browse after deleting event --- diff --git a/source/widgets/XCCalendarDay.cpp b/source/widgets/XCCalendarDay.cpp index 5d48472..54e1196 100644 --- a/source/widgets/XCCalendarDay.cpp +++ b/source/widgets/XCCalendarDay.cpp @@ -105,14 +105,21 @@ XCCalendarDay::~XCCalendarDay(){ for (vector::iterator calendarEntryIter = calendarEntryList.begin(); calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){ - + delete((*calendarEntryIter)); } + + delete alertIcon; + alertIcon = nullptr; - calendarEntryList.clear(); + delete highPriorityIcon; + highPriorityIcon = nullptr; - this->Refresh(); + delete eventListFrame; + eventListFrame = nullptr; + + calendarEntryList.clear(); } @@ -490,12 +497,12 @@ void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){ // Get the spacing and hide it as well. - wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); + /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); afterSpacer->Show(false); afterSpacer->DetachSizer(); delete afterSpacer; - afterSpacer = nullptr; + afterSpacer = nullptr;*/ delete (*calendarEntryIter); deleteEntriesList.push_back(calendarEntryIter); @@ -527,12 +534,12 @@ void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){ // Get the spacing and hide it as well. - wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); + /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); afterSpacer->Show(false); afterSpacer->DetachSizer(); delete afterSpacer; - afterSpacer = nullptr; + afterSpacer = nullptr;*/ delete (*calendarEntryIter); deleteEntriesList.push_back(calendarEntryIter); diff --git a/source/widgets/XCCalendarMonthView.cpp b/source/widgets/XCCalendarMonthView.cpp index a7443e9..dbe1fdb 100644 --- a/source/widgets/XCCalendarMonthView.cpp +++ b/source/widgets/XCCalendarMonthView.cpp @@ -130,7 +130,20 @@ XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid, Calendar XCCalendarMonthView::~XCCalendarMonthView(){ + delete mondayText; + delete tuesdayText; + delete wednesdayText; + delete thursdayText; + delete fridayText; + delete saturdayText; + delete sundayText; + for (vector::iterator dayIter = calendarDayList.begin(); + dayIter != calendarDayList.end(); dayIter++){ + + delete ((*dayIter)); + + } } @@ -341,6 +354,16 @@ void XCCalendarMonthView::UpdateCalendarEntry(wxCommandEvent &eventData){ EventProperties *eventInfo = (EventProperties*)eventData.GetClientData(); bool foundDate = false; + for (vector::iterator dayIter = calendarDayList.begin(); + dayIter != calendarDayList.end(); dayIter++){ + + wxCommandEvent addEvent(XCCALENDARDAY_DELETEENTRY); + addEvent.SetId(ID_DELETEENTRY); + addEvent.SetInt(eventInfo->eventID); + wxPostEvent((*dayIter), addEvent); + + } + for (vector::iterator dayIter = calendarDayList.begin(); dayIter != calendarDayList.end(); dayIter++){ @@ -351,8 +374,8 @@ void XCCalendarMonthView::UpdateCalendarEntry(wxCommandEvent &eventData){ (*dayIter)->GetCalendarMonth() == (eventInfo->eventMonth + 1) && (*dayIter)->GetCalendarDay() == eventInfo->eventDay){ - wxCommandEvent addEvent(XCCALENDARDAY_UPDATEENTRY); - addEvent.SetId(ID_UPDATEENTRY); + wxCommandEvent addEvent(XCCALENDARDAY_ADDENTRY); + addEvent.SetId(ID_ADDENTRY); addEvent.SetClientData(eventInfo); wxPostEvent((*dayIter), addEvent); foundDate = true;