X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fforms%2Fmain%2FfrmMain.cpp;h=a674367e7c891265c360da29d5d036724b9009cc;hp=c46a8ae915544b35963f7a513ee7d456fb0c907e;hb=d6e213d116fd284a20c8863991d32730773026df;hpb=f3478605c506ac84c3fc19b5a9635f5e7d0e4efc diff --git a/source/forms/main/frmMain.cpp b/source/forms/main/frmMain.cpp index c46a8ae..a674367 100644 --- a/source/forms/main/frmMain.cpp +++ b/source/forms/main/frmMain.cpp @@ -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