From: Steve Brokenshire Date: Thu, 29 Dec 2016 19:44:50 +0000 (+0000) Subject: frmMain: Rearranged order of loading and get list of entries X-Git-Tag: release-0.02~55 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=d6e213d116fd284a20c8863991d32730773026df;p=xestiacalendar%2F.git frmMain: Rearranged order of loading and get list of entries --- 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 diff --git a/source/forms/main/frmMain.h b/source/forms/main/frmMain.h index 32017cc..ca8fd1d 100644 --- a/source/forms/main/frmMain.h +++ b/source/forms/main/frmMain.h @@ -7,8 +7,14 @@ Subclass of frmMainADT, which is generated by wxFormBuilder. */ #include +#include +#include +#include #include "../../AppXestiaCalendar.h" + +#include "../about/frmAbout.h" + #include "../../widgets/XCCalendarCtrl.h" #include "../../libraries/CalendarDataStorage/CalendarDataStorage.h" #include "../../objects/calendarlist/CalendarList.h" @@ -32,6 +38,7 @@ class frmMain : public frmMainADT void QuitApp( wxCloseEvent& event ); void QuitApp( wxCommandEvent& event ); void QuitApp(); + void ShowAboutWindow( wxCommandEvent& event ); void LoadAccountData();