Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Rearranged order of loading and get list of entries
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 29 Dec 2016 19:44:50 +0000 (19:44 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 29 Dec 2016 19:44:50 +0000 (19:44 +0000)
source/forms/main/frmMain.cpp
source/forms/main/frmMain.h

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
index 32017cc..ca8fd1d 100644 (file)
@@ -7,8 +7,14 @@ Subclass of frmMainADT, which is generated by wxFormBuilder.
 */
 
 #include <map>
+#include <sys/types.h>
+#include <dirent.h>
+#include <wx/dir.h>
 
 #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();
 
        
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