From: Steve Brokenshire Date: Thu, 29 Dec 2016 19:54:27 +0000 (+0000) Subject: XCCalendarList: Look at internal_updatedata checksum before updating controls X-Git-Tag: release-0.02~48 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=172322316537049f6ced59877a3b5bd3d2f64f2c XCCalendarList: Look at internal_updatedata checksum before updating controls --- diff --git a/source/widgets/XCCalendarList.cpp b/source/widgets/XCCalendarList.cpp index 62efb9c..6fc7f7a 100644 --- a/source/widgets/XCCalendarList.cpp +++ b/source/widgets/XCCalendarList.cpp @@ -44,7 +44,27 @@ XCCalendarList::~XCCalendarList(){ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){ - // TODO: Verify if the generated code has changed. + // Verify if the generated code has changed. Return if not. + + CDSGetChecksumResult currentChecksum = dataStorage->GetChecksum("internal_updatedata"); + + if (checksumUpdate == currentChecksum.checksumValue){ + + // Checksum matches so return. + return; + + } + + // TODO: Delete the old controls. + + for (vector::iterator accountCtrlIter = accountControlList.begin(); + accountCtrlIter != accountControlList.end(); accountCtrlIter++){ + + delete *accountCtrlIter; + + } + + accountControlList.clear(); // Get the list of accounts and create them one by one. @@ -78,4 +98,8 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){ } + // Set the updated checksum. + + checksumUpdate = currentChecksum.checksumValue; + } \ No newline at end of file diff --git a/source/widgets/XCCalendarList.h b/source/widgets/XCCalendarList.h index 7dbb093..e05f697 100644 --- a/source/widgets/XCCalendarList.h +++ b/source/widgets/XCCalendarList.h @@ -41,8 +41,8 @@ class XCCalendarList: public wxPopupTransientWindow wxScrolledWindow *scwMain = nullptr; wxBoxSizer *szrScrolled = nullptr; std::vector accountControlList; + std::string checksumUpdate = ""; protected: - public: XCCalendarList(wxWindow *parent); void UpdateCalendarList(CalendarDataStorage *dataStorage);