Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
XCCalendarList: Look at internal_updatedata checksum before updating controls
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 29 Dec 2016 19:54:27 +0000 (19:54 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 29 Dec 2016 19:54:27 +0000 (19:54 +0000)
source/widgets/XCCalendarList.cpp
source/widgets/XCCalendarList.h

index 62efb9c..6fc7f7a 100644 (file)
@@ -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<XCCalendarListAccountCtrl*>::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
index 7dbb093..e05f697 100644 (file)
@@ -41,8 +41,8 @@ class XCCalendarList: public wxPopupTransientWindow
                wxScrolledWindow *scwMain = nullptr;
                wxBoxSizer *szrScrolled = nullptr;
                std::vector<XCCalendarListAccountCtrl*> accountControlList;
+               std::string checksumUpdate = "";
        protected:
-               
        public:
                XCCalendarList(wxWindow *parent);
                void UpdateCalendarList(CalendarDataStorage *dataStorage);
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy