Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Rearranged order of loading and get list of entries
[xestiacalendar/.git] / source / forms / main / frmMain.cpp
index c46a8ae..a674367 100644 (file)
@@ -5,8 +5,6 @@ frmMain::frmMain( wxWindow* parent )
 frmMainADT( parent )
 {
        
-       mainCalendarCtrl = new XCCalendarCtrl(this, &calendarData);
-       
        // Setup the default settings if they don't
        // exist.
        
@@ -14,9 +12,6 @@ frmMainADT( parent )
        wxString prefDirectory = GetUserPrefDir();
        preferences = new XCALPreferences(prefDirectory);
        
-       szrMain->Add(mainCalendarCtrl, 1, wxEXPAND, 5);
-       szrMain->Layout();
-       
        // Load the settings.
        
        wxString fullPrefPath;
@@ -53,9 +48,17 @@ frmMainADT( parent )
                }
        
        }
+
+       // Load the account data.
        
        LoadAccountData();
        
+       // Setup the form control.
+       
+       mainCalendarCtrl = new XCCalendarCtrl(this, &calendarData);
+       szrMain->Add(mainCalendarCtrl, 1, wxEXPAND, 5);
+       szrMain->Layout();
+       
 }
 
 void frmMain::QuitApp( wxCloseEvent& event )
@@ -192,8 +195,44 @@ void frmMain::LoadAccountData(){
                        CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(string(preferences->accounts.GetAccountName(accountSeek).mb_str()), calendarList.calendarShortName[calendarSeek]);
                        calendarList.calendarStorageID[calendarSeek] = calendarInfo.calendarID;
                        
+                       // Find the entries and load each entry.
+                       
+                       string calendarListDirectory = calendarListFilename;
+                       calendarListDirectory += "/";
+                       calendarListDirectory += calendarList.calendarShortName[calendarSeek];
+                       calendarListDirectory += "/";
+                       
+                       wxDir entryListDirectory(calendarListDirectory);
+                       wxString entryListFilename;
+                       
+                       bool continueProcessing = entryListDirectory.GetFirst(&entryListFilename, "*.ics", wxDIR_NO_FOLLOW|wxDIR_FILES);
+                       
+                       while (continueProcessing){
+                               
+                               string entryListFullFilename;
+                               entryListFullFilename += calendarListDirectory;
+                               entryListFullFilename += string(entryListFilename.mb_str());
+                               
+                               continueProcessing = entryListDirectory.GetNext(&entryListFilename);
+                               CDSAddEntryResult addEventResult = calendarData.AddEvent(calendarInfo.calendarID, entryListFullFilename);
+                               
+                       }                       
+                       
                }
                
        }
        
+}
+
+void frmMain::ShowAboutWindow( wxCommandEvent& event )
+{
+
+       // Show the about window.
+    
+       frmAbout *frameAbout = new frmAbout ( this );
+       frameAbout->SetupAboutWindow();
+       frameAbout->ShowModal();
+       delete frameAbout;
+       frameAbout = NULL;
+    
 }
\ No newline at end of file
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