Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
XCCalendarList: Layout control after updating the calendar list.
[xestiacalendar/.git] / source / widgets / XCCalendarList.cpp
index 84662bd..9dae3fc 100644 (file)
@@ -25,16 +25,7 @@ XCCalendarList::XCCalendarList(wxWindow *parent)
                
        szrMain = new wxBoxSizer( wxVERTICAL );
        this->SetSizer(szrMain);
-       this->SetSize(wxSize(350, 500));
-
-       //scwMain = new wxScrolledWindow();
-       
-       //szrScrolled = new wxBoxSizer( wxHORIZONTAL );
-       //scwMain->SetSizer(szrScrolled);
-               
-       //szrMain->Add(scwMain, 0, wxEXPAND, 5);
-       //szrMain->Layout();
-       
+       this->SetSize(wxSize(350, 500));        
                
 }
 
@@ -55,7 +46,11 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
                
        }
        
-       // TODO: Delete the old controls.
+       // Delete the old controls. Remember which setting the checkboxes were hidden so they
+       // can be restored later on.
+
+       vector<int> calendarHiddenAccountsList = GetHiddenAccountsList();       
+       vector<int> calendarHiddenCalendarsList = GetHiddenCalendarsList();
        
        for (vector<XCCalendarListAccountCtrl*>::iterator accountCtrlIter = accountControlList.begin();
                accountCtrlIter != accountControlList.end(); accountCtrlIter++){
@@ -76,9 +71,16 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
                
                XCCalendarListAccountCtrl *newAccountCtrl = new XCCalendarListAccountCtrl(this, accountListData.accountList[AccountSeek].accountName);
                newAccountCtrl->SetAccountID(accountListData.accountList[AccountSeek].accountID);
+               newAccountCtrl->SetAccountPreferencesID(accountListData.accountList[AccountSeek].accountPreferencesID);
                
                szrMain->Add(newAccountCtrl, 0, wxEXPAND, 5);
                
+               if (find(calendarHiddenAccountsList.begin(), calendarHiddenAccountsList.end(), accountListData.accountList[AccountSeek].accountID) != calendarHiddenAccountsList.end()){
+                       
+                       newAccountCtrl->SetCheckBoxValue(wxCHK_UNCHECKED);
+                       
+               }
+               
                accountControlList.push_back(newAccountCtrl);
                
                // Get the list of calendars and create controls.
@@ -92,6 +94,14 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
                        XCCalendarListCalendarCtrl *newCalendarCtrl = new XCCalendarListCalendarCtrl(this, calendarInfo.calendarName, calendarInfo.calendarColour);
                        newCalendarCtrl->SetCalendarID(accountCalendarList.calendarList[calendarSeek]);
                        
+                       newCalendarCtrl->SetAccountPreferencesID(accountListData.accountList[AccountSeek].accountPreferencesID);
+
+                       if (find(calendarHiddenCalendarsList.begin(), calendarHiddenCalendarsList.end(), accountCalendarList.calendarList[calendarSeek]) != calendarHiddenCalendarsList.end()){
+                       
+                               newCalendarCtrl->SetCheckBoxValue(wxCHK_UNCHECKED);
+                       
+                       }
+                       
                        newAccountCtrl->AddCalendar(newCalendarCtrl);
 
                        szrMain->Add(newCalendarCtrl, 0, wxEXPAND, 5);
@@ -103,6 +113,8 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
        // Set the updated checksum.
        
        checksumUpdate = currentChecksum.checksumValue;
+
+       this->Layout();
        
 }
 
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