Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
bitmaps: Added icons (using existing ones from Xestia Address Book)
[xestiacalendar/.git] / source / forms / main / frmMain.cpp
1 // frmMain.h - frmMain form functions
2 //
3 // (c) 2016-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "frmMain.h"
21 wxDEFINE_EVENT(XCMAIN_PROCESSCALENDAR, wxCommandEvent);
22 wxDEFINE_EVENT(XCMAIN_EDITCALENDAR, wxCommandEvent);
23 wxDEFINE_EVENT(XCMAIN_DELETECALENDAR, wxCommandEvent);
24 wxDEFINE_EVENT(XCMAIN_ADDEVENT, wxCommandEvent);
25 wxDEFINE_EVENT(XCMAIN_UPDATEEVENT, wxCommandEvent);
26 wxDEFINE_EVENT(XCMAIN_EDITEVENT, wxCommandEvent);
27 wxDEFINE_EVENT(XCMAIN_DELETEEVENT, wxCommandEvent);
29 wxDEFINE_EVENT(XCMAIN_ADDWINDOWINFO, wxCommandEvent);
30 wxDEFINE_EVENT(XCMAIN_UPDATEWINDOWINFO, wxCommandEvent);
31 wxDEFINE_EVENT(XCMAIN_DELETEWINDOWINFO, wxCommandEvent);
33 frmMain::frmMain( wxWindow* parent )
34 :
35 frmMainADT( parent )
36 {
37         // Setup the default settings if they don't
38         // exist.
39         
40         // Setup the preferences.
41         wxString prefDirectory = GetUserPrefDir();
42         preferences = new XCALPreferences(prefDirectory);
43         
44         // Load the settings.
45         
46         wxString fullPrefPath;
47         
48         fullPrefPath.Append(prefDirectory);
49         fullPrefPath.Append(wxT("settings"));
51         wxFileConfig *settingfile = new wxFileConfig("", "", fullPrefPath);
52     
53         wxString ValueInc;
54         settingfile->Read(wxT("SaveWindowPosition"), &ValueInc);
55     
56         if (ValueInc == wxT("true")){
57                 
58                 wxRect windowPosition;
59         
60                 long posX, posY, posH, posW = 0;
62                 bool posXValid, posYValid, posHValid, posWValid = false;
64                 posXValid = settingfile->Read(wxT("WindowPositionX"), &posX);
65                 posYValid = settingfile->Read(wxT("WindowPositionY"), &posY);
66                 posHValid = settingfile->Read(wxT("WindowPositionHeight"), &posH);
67                 posWValid = settingfile->Read(wxT("WindowPositionWidth"), &posW);
69                 if (posXValid == true && posYValid == true && posHValid == true && posWValid == true){
71                         this->SetSize(posX, posY, posH, posW);
73                 } else {
75                         this->SetSize(-1, -1, 800, 600);
76                         
77                 }
78         
79         }
81         // Load the account data.
82         
83         LoadAccountData();
84         
85         // Setup the form control.
86         
87         mainCalendarCtrl = new XCCalendarCtrl(this, &calendarData);
88         szrMain->Add(mainCalendarCtrl, 1, wxEXPAND, 5);
89         szrMain->Layout();
91         // Bind events to the control.
92         
93         Bind(XCMAIN_PROCESSCALENDAR, &frmMain::ProcessCalendar, this, ID_PROCESSCALENDAR);
94         Bind(XCMAIN_EDITCALENDAR, &frmMain::EditCalendar, this, ID_EDITCALENDAR);
95         Bind(XCMAIN_DELETECALENDAR, &frmMain::DeleteCalendar, this, ID_DELETECALENDAR);
96         Bind(XCMAIN_ADDEVENT, &frmMain::AddEvent, this, ID_ADDENTRY);
97         Bind(XCMAIN_UPDATEEVENT, &frmMain::UpdateEvent, this, ID_UPDATEENTRY);
98         Bind(XCMAIN_EDITEVENT, &frmMain::EditEvent, this, ID_EDITEVENT);
99         Bind(XCMAIN_DELETEEVENT, &frmMain::DeleteEvent, this, ID_DELETEEVENT);
100         
101         Bind(XCMAIN_ADDWINDOWINFO, &frmMain::WindowAdd, this, ID_ADDWINDOW);
102         Bind(XCMAIN_UPDATEWINDOWINFO, &frmMain::WindowUpdate, this, ID_UPDATEWINDOW);
103         Bind(XCMAIN_DELETEWINDOWINFO, &frmMain::WindowDelete, this, ID_DELETEWINDOW);
106 void frmMain::QuitApp( wxCloseEvent& event )
109         // Run the QuitApp function.
111         QuitApp();
115 void frmMain::QuitApp( wxCommandEvent& event )
117     
118         // Run the QuitApp function.
119     
120         QuitApp();
121     
124 void frmMain::QuitApp()
127         // Function to run when quitting.
129         //Go through the windows and close each one (be it search
130         //or contact editor). Abort if user wants to cancel.
132         // Close the contact editor windows.
134         // Close the contact windows.
136         // Close the search windows.
138         // Write out the ETag databases.
140         // Save Preferences: Save the window position if that option is enabled.
142         wxString SetFilename = GetUserPrefDir();
144 #if defined(__HAIKU__)
148 #elif defined(__WIN32__)
150         SetFilename.Append(wxT("settings"));
152 #else
154         // *nix OSes
156         SetFilename.Append(wxT("settings"));
158 #endif
160         wxFileConfig *cfgfile = new wxFileConfig("", "", SetFilename);
162         bool SaveWindowPos = false;
163         wxString SaveWindowInc;
164         cfgfile->Read(wxT("SaveWindowPosition"), &SaveWindowInc);
166         if (SaveWindowInc == wxT("true")){
167         
168                 SaveWindowPos = true;
169         
170         }
172         if (SaveWindowPos == true){
173         
174                 wxRect frmMainPos = this->GetRect();
175         
176                 cfgfile->Write(wxT("WindowPositionX"), frmMainPos.GetX());
177                 cfgfile->Write(wxT("WindowPositionY"), frmMainPos.GetY());
178                 cfgfile->Write(wxT("WindowPositionHeight"), frmMainPos.GetHeight());
179                 cfgfile->Write(wxT("WindowPositionWidth"), frmMainPos.GetWidth());
180         
181         }
183         delete cfgfile;
184         cfgfile = nullptr;
186         //Everything closed... exit.
188         std::exit(0);
190         Close();
194 void frmMain::LoadAccountData(){
195         
196         // Get the list of accounts and put into the calendar data storage.
197         
198         int accountCount = preferences->accounts.GetCount();
199         
200         for (int accountSeek = 0; accountSeek < accountCount; accountSeek++){
201                 
202                 CDSAccountResult addResult = calendarData.AddAccount(string(preferences->accounts.GetAccountName(accountSeek).mb_str()), accountSeek);
203                 
204         }
205         
206         // Get the list of calendars and put them into the calendar data storage.
207         
208         for (int accountSeek = 0; accountSeek < accountCount; accountSeek++){
209         
210                 CDSGetAccountInfo accountInfo = calendarData.GetAccount(string(preferences->accounts.GetAccountName(accountSeek).mb_str()));
211         
212                 // Build the path.
213                 
214                 string calendarListFilename = string(GetUserDir().mb_str());
215                 calendarListFilename += "accounts/";
216                 calendarListFilename += string(preferences->accounts.GetAccountDirectory(accountSeek).mb_str());
217                 calendarListFilename += ".";
218                 calendarListFilename += string(preferences->accounts.GetAccountType(accountSeek).mb_str());
219                 
220                 // Get the list of calendars.
221                 
222                 XCAccountCalendarList calendarList(calendarListFilename);
223                 
224                 // Add the calendar and set the calendar ID for it.
225                 
226                 for (int calendarSeek = 0; calendarSeek < calendarList.calendarShortName.size(); calendarSeek++){
227                         
228                         // Add the calendar.
229                         
230                         CDSCalendarResult calendarAddResult = calendarData.AddCalendar(accountInfo.accountID, 
231                                 calendarList.calendarName[calendarSeek], 
232                                 calendarList.calendarShortName[calendarSeek],
233                                 calendarList.calendarColour[calendarSeek],
234                                 calendarList.calendarDescription[calendarSeek]);
235                         
236                         // Set the calendar ID.
237                         
238                         CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(string(preferences->accounts.GetAccountName(accountSeek).mb_str()), calendarList.calendarShortName[calendarSeek]);
239                         calendarList.calendarStorageID[calendarSeek] = calendarInfo.calendarID;
240                         
241                         // Find the entries and load each entry.
242                         
243                         string calendarListDirectory = calendarListFilename;
244                         calendarListDirectory += "/";
245                         calendarListDirectory += calendarList.calendarShortName[calendarSeek];
246                         calendarListDirectory += "/";
247                         
248                         wxDir entryListDirectory(calendarListDirectory);
249                         wxString entryListFilename;
250                         
251                         bool continueProcessing = entryListDirectory.GetFirst(&entryListFilename, "*.ics", wxDIR_NO_FOLLOW|wxDIR_FILES);
252                         
253                         while (continueProcessing){
254                                 
255                                 string entryListFullFilename;
256                                 entryListFullFilename += calendarListDirectory;
257                                 entryListFullFilename += string(entryListFilename.mb_str());
258                                 
259                                 continueProcessing = entryListDirectory.GetNext(&entryListFilename);
260                                 CDSAddEntryResult addEventResult = calendarData.AddEvent(calendarInfo.calendarID, entryListFullFilename);
261                                 
262                         }                       
263                         
264                 }
265                 
266         }
267         
270 void frmMain::ShowPreferencesWindow( wxCommandEvent& event )
273         // Close all windows first.
274         
275         if (CloseAllWindows() == false)
276         {
277                 return;
278         }
279         
280         // Open the preferences window.
281     
282         reloadAccounts = FALSE;
283     
284         frmPreferences *framePreferences = new frmPreferences ( this );
285         framePreferences->SetupPointers(&reloadAccounts);
286         framePreferences->ShowModal();
287         delete framePreferences;
288         framePreferences = NULL;
289     
290         // Reload the preferences.
291         
292         if (reloadAccounts == true){
293             
294                 // Reload the accounts as a change has been made within
295                 // the application.
296         
297                 wxString prefDirectory = GetUserPrefDir();
298                 XCALPreferences *oldPreferences = preferences;
299                 preferences = new XCALPreferences(prefDirectory);
300                 
301                 delete oldPreferences;
302                 oldPreferences = nullptr;
303                 
304                 // Clear all of the data from the calendar data storage.
305                 
306                 calendarData.Clear();
307                 LoadAccountData();
308                 
309                 // Politely ask the calendar control to reload it's view.
311                 wxCommandEvent updateGrid(XCCALENDARCTRL_CHANGEGRID);
312                 updateGrid.SetId(ID_CHANGEGRID);
313                 wxPostEvent(mainCalendarCtrl, updateGrid);
314                 
315         }
316     
319 void frmMain::ShowAboutWindow( wxCommandEvent& event )
322         // Show the about window.
323     
324         frmAbout *frameAbout = new frmAbout ( this );
325         frameAbout->SetupAboutWindow();
326         frameAbout->ShowModal();
327         delete frameAbout;
328         frameAbout = NULL;
329     
332 void frmMain::ShowUpdateWindow( wxCommandEvent& event )
335         frmUpdate *frameUpdate = new frmUpdate ( this );
336         frameUpdate->FetchData();
337         frameUpdate->ShowModal();
338         delete frameUpdate;
339         frameUpdate = NULL;
340         
343 void frmMain::OpenNewAccountDialog( wxCommandEvent& event )
345         
346         // Open the new account dialog.
347     
348         reloadAccounts = false;
349     
350         frmNewAccount *frameNewAccount = new frmNewAccount ( this );
351         frameNewAccount->SetupPointers(&reloadAccounts, &calendarData);
352         frameNewAccount->ShowModal();
353         delete frameNewAccount;
354         frameNewAccount = NULL;
355         
356         // Reload the preferences.
357         
358         if (reloadAccounts == true){
359             
360                 // Reload the accounts as a change has been made within
361                 // the application.
362         
363                 wxString prefDirectory = GetUserPrefDir();
364                 XCALPreferences *oldPreferences = preferences;
365                 preferences = new XCALPreferences(prefDirectory);
366                 
367                 delete oldPreferences;
368                 oldPreferences = nullptr;
369                 
370                 // Clear all of the data from the calendar data storage.
371                 
372                 calendarData.Clear();
373                 LoadAccountData();
374                 
375                 // Politely ask the calendar control to reload it's view.
377                 wxCommandEvent updateGrid(XCCALENDARCTRL_CHANGEGRID);
378                 updateGrid.SetId(ID_CHANGEGRID);
379                 wxPostEvent(mainCalendarCtrl, updateGrid);
380                 
381         }
382         
385 void frmMain::CreateNewCalendar( wxCommandEvent& event )
387         
388         frmCalendarEditor *frameNewCalendar = new frmCalendarEditor ( this );
389         frameNewCalendar->SetMode(false);
390         frameNewCalendar->SetupAccounts(preferences);
391         frameNewCalendar->ShowModal();
392         delete frameNewCalendar;
393         frameNewCalendar = nullptr;
394         
397 void frmMain::EditCalendar( wxCommandEvent& event )
399         
400         // Close all windows first.
401         
402         if (CloseAllWindows() == false)
403         {
404                 return;
405         }
406         
407         // Get the calendar data.
408         
409         CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(event.GetInt());
410         
411         frmCalendarEditor *frameNewCalendar = new frmCalendarEditor ( this );
412         frameNewCalendar->SetMode(true);
413         frameNewCalendar->SetupAccounts(preferences);
414         frameNewCalendar->SetData(event.GetInt(), calendarInfo.accountName, calendarInfo.calendarName, calendarInfo.calendarDescription, calendarInfo.calendarColour);
415         frameNewCalendar->ShowModal();
416         delete frameNewCalendar;
417         frameNewCalendar = nullptr;
418         
421 void frmMain::DeleteCalendar( wxCommandEvent& event )
424         // Close all windows first.
425         
426         if (CloseAllWindows() == false)
427         {
428                 return;
429         }
430         
431         CalendarProperties *calendarEventInfo = (CalendarProperties*)event.GetClientData();
432         
433         // Get the calendar data.
434         
435         CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(calendarEventInfo->calendarID);
436         
437         if (wxMessageBox(wxString::Format("Are you sure you want to delete the calendar %s from the %s account?", calendarInfo.calendarName, calendarInfo.accountName), "Delete calendar", wxYES_NO|wxICON_QUESTION) == wxNO){
438                 return;
439         }
440         
441         // Go through the grid and delete each calendar entry widget that 
442         // is associated with the calendar.
443         
444         wxCommandEvent deleteCalendar(XCCALENDARCTRL_DELETECALENDARENTRIES);
445         deleteCalendar.SetId(ID_DELETECALENDARENTRIES);
446         deleteCalendar.SetInt(calendarInfo.calendarID);
447         wxPostEvent(mainCalendarCtrl, deleteCalendar);
448         
449         // Get the account configuration file and delete the calendar information.
450         
451         CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo.accountName);
452         
453         string accountDirectoryPath = string(GetUserDir().mb_str());    
454         accountDirectoryPath += "accounts/";
455         accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarEventInfo->accountPreferencesID).mb_str());
456         accountDirectoryPath += ".";
457         accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarEventInfo->accountPreferencesID).mb_str());
458         accountDirectoryPath += "/";
459         
460         string calendarListFilenameFull = accountDirectoryPath;
461         calendarListFilenameFull += "calendarlist.db";
462         
463         string calendarDirectoryPath = accountDirectoryPath;
464         calendarDirectoryPath += calendarInfo.calendarTextID;
465         
466         wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull));
467         
468         //calendarListFile->SetPath(wxString(calendarInfo.calendarTextID));
469         calendarListFile->DeleteGroup(wxString(calendarInfo.calendarTextID));
470         
471         // Delete the calendar directory.
473         wxDir entryListDirectory((wxString)calendarDirectoryPath.c_str());
474         wxString entryListFilename;
475         
476         bool continueProcessing = entryListDirectory.GetFirst(&entryListFilename, "*", wxDIR_NO_FOLLOW|wxDIR_FILES);
477                         
478         while (continueProcessing){
479                                 
480                 string entryListFullFilename;
481                 entryListFullFilename += calendarDirectoryPath;
482                 entryListFullFilename += "/";
483                 entryListFullFilename += string(entryListFilename.mb_str());
484                 
485                 wxRemoveFile(wxString(entryListFullFilename.c_str()));
486                 
487                 continueProcessing = entryListDirectory.GetNext(&entryListFilename);
488                                 
489         }
491         wxRmdir(calendarDirectoryPath);
492         
493         // Delete the calendar from the calendar data storage.
494         
495         calendarData.DeleteCalendar(calendarEventInfo->calendarID);
496         
497         delete calendarListFile;
498         calendarListFile = nullptr;
499         
500         delete calendarEventInfo;
501         calendarEventInfo = nullptr;
502         
505 void frmMain::CreateNewEvent( wxCommandEvent& event ){
506         
507         frmEventEditor *frameNewEvent = new frmEventEditor ( this );
508         frameNewEvent->SetupForm(&calendarData, preferences);
509         frameNewEvent->SetWindowMenuItemID(++WindowMenuItemID);
510         
511         // Add the window to the window list.
512         
513         WindowData *newWindowData = new WindowData;
514     
515         newWindowData->DataType = 1;
516         newWindowData->WindowPointer = (void*)frameNewEvent;
517         newWindowData->WindowID = WindowMenuItemID;
518         
519         wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
520         addevent.SetId(ID_ADDWINDOW);
521         addevent.SetClientData(newWindowData);
522         wxPostEvent(this, addevent);
523         
524         frameNewEvent->Show();
525         
528 void frmMain::EditEvent( wxCommandEvent& event ){
529         
530         frmEventEditor *frameEditEvent = new frmEventEditor ( this );
531         frameEditEvent->SetEventID(event.GetInt());
532         frameEditEvent->SetEditMode(true);
533         frameEditEvent->SetWindowMenuItemID(++WindowMenuItemID);
534         frameEditEvent->SetupForm(&calendarData, preferences);
535         
536         // Add the window to the window list.
537         
538         WindowData *newWindowData = new WindowData;
539     
540         newWindowData->DataType = 1;
541         newWindowData->WindowPointer = (void*)frameEditEvent;
542         newWindowData->WindowID = WindowMenuItemID;
543         
544         wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
545         addevent.SetId(ID_ADDWINDOW);
546         addevent.SetClientData(newWindowData);
547         wxPostEvent(this, addevent);
549         // Setup the form and display it.
550         
551         frameEditEvent->Show();
552         
555 void frmMain::DeleteEvent( wxCommandEvent& event ){
556         
557         EventProperties *eventInfo = (EventProperties*)event.GetClientData();
558         
559         // Get the event information.
560         
561         CDSGetCalendarEntryInfo eventDeleteData = calendarData.GetEvent(eventInfo->eventID);
562         CDSGetCalendarInfo calendarDeleteData = calendarData.GetCalendar(eventInfo->calendarID);
563         
564         if (wxMessageBox(wxString::Format("Are you sure you want to delete the event %s from the %s calendar?", eventDeleteData.entryName, calendarDeleteData.calendarName), "Delete event", wxYES_NO|wxICON_QUESTION) == wxNO){
565                 return;
566         }
567         
568         // Go through the grid and delete the entry from the GUI.
569         
570         wxCommandEvent deleteEvent(XCCALENDARCTRL_DELETEENTRY);
571         deleteEvent.SetId(ID_DELETEENTRY);
572         deleteEvent.SetInt(eventInfo->eventID);
573         wxPostEvent(mainCalendarCtrl, deleteEvent);
574         
575         // Get the filename and delete the entry.
576         
577         wxRemoveFile(wxString(eventDeleteData.entryFilename.c_str()));
578         
579         // Delete the entry from the calendar data storage.
580         
581         calendarData.DeleteEvent(eventInfo->eventID);
582         
583         delete eventInfo;
584         eventInfo = nullptr;
585         
588 void frmMain::AddEvent( wxCommandEvent& event )
590         
591         EventProperties *eventInfo = (EventProperties*)event.GetClientData();
592         
593         wxCommandEvent addEvent(XCCALENDARCTRL_ADDENTRY);
594         addEvent.SetId(ID_ADDENTRY);
595         addEvent.SetClientData(eventInfo);
596         wxPostEvent(mainCalendarCtrl, addEvent);
597         
600 void frmMain::UpdateEvent( wxCommandEvent& event )
602         
603         EventProperties *eventInfo = (EventProperties*)event.GetClientData();
604         
605         wxCommandEvent updateEvent(XCCALENDARCTRL_UPDATEENTRY);
606         updateEvent.SetId(ID_UPDATEENTRY);
607         updateEvent.SetClientData(eventInfo);
608         wxPostEvent(mainCalendarCtrl, updateEvent);
609         
612 void frmMain::ProcessCalendar( wxCommandEvent& event )
614         
615         CalendarProperties *calendarInfo = (CalendarProperties*)event.GetClientData();
616         
617         // Get the account name.
618         
619         CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo->accountName);
620         
621         // Build the account directory path.
622         
623         string accountDirectoryPath = string(GetUserDir().mb_str());
624         accountDirectoryPath += "accounts/";
625         accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarInfo->accountPreferencesID).mb_str());
626         accountDirectoryPath += ".";
627         accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarInfo->accountPreferencesID).mb_str());
628         accountDirectoryPath += "/";
629         
630         // Generate a UUID for the new calendar.
631         
632         string calendarPath = accountDirectoryPath;
634         string calendarUUID = "";
636         if (calendarInfo->editMode == false){
638                 calendarUUID = GenerateUUID();
639                 calendarPath += calendarUUID;
640                 
641         } else {
642         
643                 calendarUUID = calendarData.GetCalendar(calendarInfo->calendarID).calendarTextID;
644                 calendarPath += calendarPath;
645                 
646         }
647         
648         calendarPath += "/";
649         
650         // Open the account's calendar file and add to the list of calendars.
651         
652         string calendarListFilenameFull = accountDirectoryPath;
653         calendarListFilenameFull += "calendarlist.db";
654         
655         wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull));
656         
657         wxString calendarDescription = wxString(calendarInfo->calendarDescription);
658         
659         calendarDescription.Replace("\n", "\\n", true);
660         
661         // Create the directory for the calendar entries if 
662         // not editing a calendar.
663         
664         calendarListFile->SetPath(wxString(calendarUUID));
665         calendarListFile->Write(wxT("name"), wxString(calendarInfo->calendarName));
666         calendarListFile->Write(wxT("description"), calendarDescription);
667         calendarListFile->Write(wxT("colour"), wxString(calendarInfo->calendarColour));
668         
669         if (calendarInfo->editMode == false){
670         
671                 wxMkDir(wxString(calendarPath), wxS_DIR_DEFAULT);
672                 calendarData.AddCalendar(accountInfo.accountID, calendarInfo->calendarName, calendarUUID, calendarInfo->calendarColour, calendarInfo->calendarDescription);
673                 
674         } else {
675                 
676                 calendarData.UpdateCalendar(calendarInfo->calendarID, calendarInfo->calendarName, calendarInfo->calendarColour, calendarInfo->calendarDescription);
677                 
678                 // Post event to update the colour in the calendar entries.
679                 
680                 updateColourData.calendarID = calendarInfo->calendarID;
681                 updateColourData.newColour.red = calendarInfo->calendarColour.red;
682                 updateColourData.newColour.green = calendarInfo->calendarColour.green;
683                 updateColourData.newColour.blue = calendarInfo->calendarColour.blue;
684                 updateColourData.newColour.alpha = calendarInfo->calendarColour.alpha;
685                 
686                 wxCommandEvent updateColour(XCCALENDARCTRL_UPDATECALENDARCOLOUR);
687                 updateColour.SetClientData(&updateColourData);
688                 updateColour.SetId(ID_UPDATECOLOUR);
689                 wxPostEvent(mainCalendarCtrl, updateColour);
690                 
691         }
692         
693         // Add the calendar to the calendar data storage.
694         
695         delete calendarListFile;
696         calendarListFile = nullptr;
697         
698         delete calendarInfo;
699         calendarInfo = nullptr;
700         
703 void frmMain::ShowHelp( wxCommandEvent& event )
705         
706         wxMessageBox(_("The help documentation will be implemented in a future version of Xestia Calendar."), _("Unimplemented"));
707         
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