Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
CalDAV: WIP CalDAV support
[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 icons.
86         
87         SetupFormIcons();
88         SetupStatusBar();
89         
90         // Setup the form control.
91         
92         mainCalendarCtrl = new XCCalendarCtrl(this, &calendarData);
93         szrMain->Add(mainCalendarCtrl, 1, wxEXPAND, 5);
94         szrMain->Layout();
96         // Bind events to the control.
97         
98         Bind(XCMAIN_PROCESSCALENDAR, &frmMain::ProcessCalendar, this, ID_PROCESSCALENDAR);
99         Bind(XCMAIN_EDITCALENDAR, &frmMain::EditCalendar, this, ID_EDITCALENDAR);
100         Bind(XCMAIN_DELETECALENDAR, &frmMain::DeleteCalendar, this, ID_DELETECALENDAR);
101         Bind(XCMAIN_ADDEVENT, &frmMain::AddEvent, this, ID_ADDENTRY);
102         Bind(XCMAIN_UPDATEEVENT, &frmMain::UpdateEvent, this, ID_UPDATEENTRY);
103         Bind(XCMAIN_EDITEVENT, &frmMain::EditEvent, this, ID_EDITEVENT);
104         Bind(XCMAIN_DELETEEVENT, &frmMain::DeleteEvent, this, ID_DELETEEVENT);
105         
106         Bind(XCMAIN_ADDWINDOWINFO, &frmMain::WindowAdd, this, ID_ADDWINDOW);
107         Bind(XCMAIN_UPDATEWINDOWINFO, &frmMain::WindowUpdate, this, ID_UPDATEWINDOW);
108         Bind(XCMAIN_DELETEWINDOWINFO, &frmMain::WindowDelete, this, ID_DELETEWINDOW);
111 void frmMain::QuitApp( wxCloseEvent& event )
114         // Run the QuitApp function.
116         QuitApp();
120 void frmMain::QuitApp( wxCommandEvent& event )
122     
123         // Run the QuitApp function.
124     
125         QuitApp();
126     
129 void frmMain::QuitApp()
132         // Function to run when quitting.
134         //Go through the windows and close each one (be it search
135         //or contact editor). Abort if user wants to cancel.
137         // Close the contact editor windows.
139         // Close the contact windows.
141         // Close the search windows.
143         // Write out the ETag databases.
145         // Save Preferences: Save the window position if that option is enabled.
147         wxString SetFilename = GetUserPrefDir();
149 #if defined(__HAIKU__)
153 #elif defined(__WIN32__)
155         SetFilename.Append(wxT("settings"));
157 #else
159         // *nix OSes
161         SetFilename.Append(wxT("settings"));
163 #endif
165         wxFileConfig *cfgfile = new wxFileConfig("", "", SetFilename);
167         bool SaveWindowPos = false;
168         wxString SaveWindowInc;
169         cfgfile->Read(wxT("SaveWindowPosition"), &SaveWindowInc);
171         if (SaveWindowInc == wxT("true")){
172         
173                 SaveWindowPos = true;
174         
175         }
177         if (SaveWindowPos == true){
178         
179                 wxRect frmMainPos = this->GetRect();
180         
181                 cfgfile->Write(wxT("WindowPositionX"), frmMainPos.GetX());
182                 cfgfile->Write(wxT("WindowPositionY"), frmMainPos.GetY());
183                 cfgfile->Write(wxT("WindowPositionHeight"), frmMainPos.GetHeight());
184                 cfgfile->Write(wxT("WindowPositionWidth"), frmMainPos.GetWidth());
185         
186         }
188         delete cfgfile;
189         cfgfile = nullptr;
191         //Everything closed... exit.
193         std::exit(0);
195         Close();
199 void frmMain::LoadAccountData()
201         
202         // Get the list of accounts and put into the calendar data storage.
203         
204         int accountCount = preferences->accounts.GetCount();
205         
206         for (int accountSeek = 0; accountSeek < accountCount; accountSeek++){
207                 
208                 CDSAccountResult addResult = calendarData.AddAccount(string(preferences->accounts.GetAccountName(accountSeek).mb_str()), accountSeek);
209                 
210         }
211         
212         // Get the list of calendars and put them into the calendar data storage.
213         
214         for (int accountSeek = 0; accountSeek < accountCount; accountSeek++){
215         
216                 CDSGetAccountInfo accountInfo = calendarData.GetAccount(string(preferences->accounts.GetAccountName(accountSeek).mb_str()));
217         
218                 // Build the path.
219                 
220                 string calendarListFilename = string(GetUserDir().mb_str());
221                 calendarListFilename += "accounts/";
222                 calendarListFilename += string(preferences->accounts.GetAccountDirectory(accountSeek).mb_str());
223                 calendarListFilename += ".";
224                 calendarListFilename += string(preferences->accounts.GetAccountType(accountSeek).mb_str());
225                 
226                 // Get the list of calendars.
227                 
228                 XCAccountCalendarList calendarList(calendarListFilename);
229                 
230                 // Add the calendar and set the calendar ID for it.
231                 
232                 for (int calendarSeek = 0; calendarSeek < calendarList.calendarShortName.size(); calendarSeek++){
233                         
234                         // Add the calendar.
235                         
236                         CDSCalendarResult calendarAddResult = calendarData.AddCalendar(accountInfo.accountID, 
237                                 calendarList.calendarName[calendarSeek], 
238                                 calendarList.calendarShortName[calendarSeek],
239                                 calendarList.calendarColour[calendarSeek],
240                                 calendarList.calendarDescription[calendarSeek]);
241                         
242                         // Set the calendar ID.
243                         
244                         CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(string(preferences->accounts.GetAccountName(accountSeek).mb_str()), calendarList.calendarShortName[calendarSeek]);
245                         calendarList.calendarStorageID[calendarSeek] = calendarInfo.calendarID;
246                         
247                         // Find the entries and load each entry.
248                         
249                         string calendarListDirectory = calendarListFilename;
250                         calendarListDirectory += "/";
251                         calendarListDirectory += calendarList.calendarShortName[calendarSeek];
252                         calendarListDirectory += "/";
253                         
254                         wxDir entryListDirectory(calendarListDirectory);
255                         wxString entryListFilename;
256                         
257                         bool continueProcessing = entryListDirectory.GetFirst(&entryListFilename, "*.ics", wxDIR_NO_FOLLOW|wxDIR_FILES);
258                         
259                         while (continueProcessing){
260                                 
261                                 string entryListFullFilename;
262                                 entryListFullFilename += calendarListDirectory;
263                                 entryListFullFilename += string(entryListFilename.mb_str());
264                                 
265                                 continueProcessing = entryListDirectory.GetNext(&entryListFilename);
266                                 CDSAddEntryResult addEventResult = calendarData.AddEvent(calendarInfo.calendarID, entryListFullFilename);
267                                 
268                         }                       
269                         
270                 }
271                 
272         }
273         
276 void frmMain::ShowPreferencesWindow( wxCommandEvent& event )
279         // Close all windows first.
280         
281         if (CloseAllWindows() == false)
282         {
283                 return;
284         }
285         
286         // Open the preferences window.
287     
288         reloadAccounts = FALSE;
289     
290         frmPreferences *framePreferences = new frmPreferences ( this );
291         framePreferences->SetupPointers(&reloadAccounts);
292         framePreferences->ShowModal();
293         delete framePreferences;
294         framePreferences = NULL;
295     
296         // Reload the preferences.
297         
298         if (reloadAccounts == true){
299             
300                 // Reload the accounts as a change has been made within
301                 // the application.
302         
303                 wxString prefDirectory = GetUserPrefDir();
304                 XCALPreferences *oldPreferences = preferences;
305                 preferences = new XCALPreferences(prefDirectory);
306                 
307                 delete oldPreferences;
308                 oldPreferences = nullptr;
309                 
310                 // Clear all of the data from the calendar data storage.
311                 
312                 calendarData.Clear();
313                 LoadAccountData();
314                 
315                 // Politely ask the calendar control to reload it's view.
317                 wxCommandEvent updateGrid(XCCALENDARCTRL_CHANGEGRID);
318                 updateGrid.SetId(ID_CHANGEGRID);
319                 wxPostEvent(mainCalendarCtrl, updateGrid);
320                 
321         }
322     
325 void frmMain::ShowAboutWindow( wxCommandEvent& event )
328         // Show the about window.
329     
330         frmAbout *frameAbout = new frmAbout ( this );
331         frameAbout->SetupAboutWindow();
332         frameAbout->ShowModal();
333         delete frameAbout;
334         frameAbout = NULL;
335     
338 void frmMain::ShowUpdateWindow( wxCommandEvent& event )
341         frmUpdate *frameUpdate = new frmUpdate ( this );
342         frameUpdate->FetchData();
343         frameUpdate->ShowModal();
344         delete frameUpdate;
345         frameUpdate = NULL;
346         
349 void frmMain::OpenNewAccountDialog( wxCommandEvent& event )
351         
352         // Open the new account dialog.
353     
354         reloadAccounts = false;
355     
356         frmNewAccount *frameNewAccount = new frmNewAccount ( this );
357         frameNewAccount->SetupPointers(&reloadAccounts, &calendarData);
358         frameNewAccount->ShowModal();
359         delete frameNewAccount;
360         frameNewAccount = NULL;
361         
362         // Reload the preferences.
363         
364         if (reloadAccounts == true){
365             
366                 // Reload the accounts as a change has been made within
367                 // the application.
368         
369                 wxString prefDirectory = GetUserPrefDir();
370                 XCALPreferences *oldPreferences = preferences;
371                 preferences = new XCALPreferences(prefDirectory);
372                 
373                 delete oldPreferences;
374                 oldPreferences = nullptr;
375                 
376                 // Clear all of the data from the calendar data storage.
377                 
378                 calendarData.Clear();
379                 LoadAccountData();
380                 
381                 // Politely ask the calendar control to reload it's view.
383                 wxCommandEvent updateGrid(XCCALENDARCTRL_CHANGEGRID);
384                 updateGrid.SetId(ID_CHANGEGRID);
385                 wxPostEvent(mainCalendarCtrl, updateGrid);
386                 
387         }
388         
391 void frmMain::CreateNewCalendar( wxCommandEvent& event )
393         
394         frmCalendarEditor *frameNewCalendar = new frmCalendarEditor ( this );
395         frameNewCalendar->SetMode(false);
396         frameNewCalendar->SetupAccounts(preferences);
397         frameNewCalendar->ShowModal();
398         delete frameNewCalendar;
399         frameNewCalendar = nullptr;
400         
403 void frmMain::EditCalendar( wxCommandEvent& event )
405         
406         // Close all windows first.
407         
408         if (CloseAllWindows() == false)
409         {
410                 return;
411         }
412         
413         // Get the calendar data.
414         
415         CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(event.GetInt());
416         
417         frmCalendarEditor *frameNewCalendar = new frmCalendarEditor ( this );
418         frameNewCalendar->SetMode(true);
419         frameNewCalendar->SetupAccounts(preferences);
420         frameNewCalendar->SetData(event.GetInt(), calendarInfo.accountName, calendarInfo.calendarName, calendarInfo.calendarDescription, calendarInfo.calendarColour);
421         frameNewCalendar->ShowModal();
422         delete frameNewCalendar;
423         frameNewCalendar = nullptr;
424         
427 void frmMain::DeleteCalendar( wxCommandEvent& event )
430         // Close all windows first.
431         
432         if (CloseAllWindows() == false)
433         {
434                 return;
435         }
436         
437         CalendarProperties *calendarEventInfo = (CalendarProperties*)event.GetClientData();
438         
439         // Get the calendar data.
440         
441         CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(calendarEventInfo->calendarID);
442         
443         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){
444                 return;
445         }
446         
447         // Go through the grid and delete each calendar entry widget that 
448         // is associated with the calendar.
449         
450         wxCommandEvent deleteCalendar(XCCALENDARCTRL_DELETECALENDARENTRIES);
451         deleteCalendar.SetId(ID_DELETECALENDARENTRIES);
452         deleteCalendar.SetInt(calendarInfo.calendarID);
453         wxPostEvent(mainCalendarCtrl, deleteCalendar);
454         
455         // Get the account configuration file and delete the calendar information.
456         
457         CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo.accountName);
458         
459         string accountDirectoryPath = string(GetUserDir().mb_str());    
460         accountDirectoryPath += "accounts/";
461         accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarEventInfo->accountPreferencesID).mb_str());
462         accountDirectoryPath += ".";
463         accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarEventInfo->accountPreferencesID).mb_str());
464         accountDirectoryPath += "/";
465         
466         string calendarListFilenameFull = accountDirectoryPath;
467         calendarListFilenameFull += "calendarlist.db";
468         
469         string calendarDirectoryPath = accountDirectoryPath;
470         calendarDirectoryPath += calendarInfo.calendarTextID;
471         
472         wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull));
473         
474         //calendarListFile->SetPath(wxString(calendarInfo.calendarTextID));
475         calendarListFile->DeleteGroup(wxString(calendarInfo.calendarTextID));
476         
477         // Delete the calendar directory.
479         wxDir entryListDirectory((wxString)calendarDirectoryPath.c_str());
480         wxString entryListFilename;
481         
482         bool continueProcessing = entryListDirectory.GetFirst(&entryListFilename, "*", wxDIR_NO_FOLLOW|wxDIR_FILES);
483                         
484         while (continueProcessing){
485                                 
486                 string entryListFullFilename;
487                 entryListFullFilename += calendarDirectoryPath;
488                 entryListFullFilename += "/";
489                 entryListFullFilename += string(entryListFilename.mb_str());
490                 
491                 wxRemoveFile(wxString(entryListFullFilename.c_str()));
492                 
493                 continueProcessing = entryListDirectory.GetNext(&entryListFilename);
494                                 
495         }
497         wxRmdir(calendarDirectoryPath);
498         
499         // Delete the calendar from the calendar data storage.
500         
501         calendarData.DeleteCalendar(calendarEventInfo->calendarID);
502         
503         delete calendarListFile;
504         calendarListFile = nullptr;
505         
506         delete calendarEventInfo;
507         calendarEventInfo = nullptr;
508         
511 void frmMain::CreateNewEvent( wxCommandEvent& event )
513         
514         frmEventEditor *frameNewEvent = new frmEventEditor ( this );
515         frameNewEvent->SetupForm(&calendarData, preferences);
516         frameNewEvent->SetWindowMenuItemID(++WindowMenuItemID);
517         
518         // Add the window to the window list.
519         
520         WindowData *newWindowData = new WindowData;
521     
522         newWindowData->DataType = 1;
523         newWindowData->WindowPointer = (void*)frameNewEvent;
524         newWindowData->WindowID = WindowMenuItemID;
525         
526         wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
527         addevent.SetId(ID_ADDWINDOW);
528         addevent.SetClientData(newWindowData);
529         wxPostEvent(this, addevent);
530         
531         frameNewEvent->Show();
532         
535 void frmMain::EditEvent( wxCommandEvent& event )
537         
538         frmEventEditor *frameEditEvent = new frmEventEditor ( this );
539         frameEditEvent->SetEventID(event.GetInt());
540         frameEditEvent->SetEditMode(true);
541         frameEditEvent->SetWindowMenuItemID(++WindowMenuItemID);
542         frameEditEvent->SetupForm(&calendarData, preferences);
543         
544         // Add the window to the window list.
545         
546         WindowData *newWindowData = new WindowData;
547     
548         newWindowData->DataType = 1;
549         newWindowData->WindowPointer = (void*)frameEditEvent;
550         newWindowData->WindowID = WindowMenuItemID;
551         
552         wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
553         addevent.SetId(ID_ADDWINDOW);
554         addevent.SetClientData(newWindowData);
555         wxPostEvent(this, addevent);
557         // Setup the form and display it.
558         
559         frameEditEvent->Show();
560         
563 void frmMain::DeleteEvent( wxCommandEvent& event )
565         
566         EventProperties *eventInfo = (EventProperties*)event.GetClientData();
567         
568         // Get the event information.
569         
570         CDSGetCalendarEntryInfo eventDeleteData = calendarData.GetEvent(eventInfo->eventID);
571         CDSGetCalendarInfo calendarDeleteData = calendarData.GetCalendar(eventInfo->calendarID);
572         
573         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){
574                 return;
575         }
576         
577         // Go through the grid and delete the entry from the GUI.
578         
579         wxCommandEvent deleteEvent(XCCALENDARCTRL_DELETEENTRY);
580         deleteEvent.SetId(ID_DELETEENTRY);
581         deleteEvent.SetInt(eventInfo->eventID);
582         wxPostEvent(mainCalendarCtrl, deleteEvent);
583         
584         // Get the filename and delete the entry.
585         
586         wxRemoveFile(wxString(eventDeleteData.entryFilename.c_str()));
587         
588         // Delete the entry from the calendar data storage.
589         
590         calendarData.DeleteEvent(eventInfo->eventID);
591         
592         delete eventInfo;
593         eventInfo = nullptr;
594         
597 void frmMain::AddEvent( wxCommandEvent& event )
599         
600         EventProperties *eventInfo = (EventProperties*)event.GetClientData();
601         
602         wxCommandEvent addEvent(XCCALENDARCTRL_ADDENTRY);
603         addEvent.SetId(ID_ADDENTRY);
604         addEvent.SetClientData(eventInfo);
605         wxPostEvent(mainCalendarCtrl, addEvent);
606         
609 void frmMain::UpdateEvent( wxCommandEvent& event )
611         
612         EventProperties *eventInfo = (EventProperties*)event.GetClientData();
613         
614         wxCommandEvent updateEvent(XCCALENDARCTRL_UPDATEENTRY);
615         updateEvent.SetId(ID_UPDATEENTRY);
616         updateEvent.SetClientData(eventInfo);
617         wxPostEvent(mainCalendarCtrl, updateEvent);
618         
621 void frmMain::ProcessCalendar( wxCommandEvent& event )
623         
624         CalendarProperties *calendarInfo = (CalendarProperties*)event.GetClientData();
625         
626         // Get the account name.
627         
628         CDSGetAccountInfo accountInfo = calendarData.GetAccount(calendarInfo->accountName);
629         
630         // Build the account directory path.
631         
632         string accountDirectoryPath = string(GetUserDir().mb_str());
633         accountDirectoryPath += "accounts/";
634         accountDirectoryPath += string(preferences->accounts.GetAccountDirectory(calendarInfo->accountPreferencesID).mb_str());
635         accountDirectoryPath += ".";
636         accountDirectoryPath += string(preferences->accounts.GetAccountType(calendarInfo->accountPreferencesID).mb_str());
637         accountDirectoryPath += "/";
638         
639         // Generate a UUID for the new calendar.
640         
641         string calendarPath = accountDirectoryPath;
643         string calendarUUID = "";
645         if (calendarInfo->editMode == false){
647                 calendarUUID = GenerateUUID();
648                 calendarPath += calendarUUID;
649                 
650         } else {
651         
652                 calendarUUID = calendarData.GetCalendar(calendarInfo->calendarID).calendarTextID;
653                 calendarPath += calendarPath;
654                 
655         }
656         
657         calendarPath += "/";
658         
659         // Open the account's calendar file and add to the list of calendars.
660         
661         string calendarListFilenameFull = accountDirectoryPath;
662         calendarListFilenameFull += "calendarlist.db";
663         
664         wxFileConfig *calendarListFile = new wxFileConfig("", "", wxString(calendarListFilenameFull));
665         
666         wxString calendarDescription = wxString(calendarInfo->calendarDescription);
667         
668         calendarDescription.Replace("\n", "\\n", true);
669         
670         // Create the directory for the calendar entries if 
671         // not editing a calendar.
672         
673         calendarListFile->SetPath(wxString(calendarUUID));
674         calendarListFile->Write(wxT("name"), wxString(calendarInfo->calendarName));
675         calendarListFile->Write(wxT("description"), calendarDescription);
676         calendarListFile->Write(wxT("colour"), wxString(calendarInfo->calendarColour));
677         
678         if (calendarInfo->editMode == false){
679         
680                 wxMkDir(wxString(calendarPath), wxS_DIR_DEFAULT);
681                 calendarData.AddCalendar(accountInfo.accountID, calendarInfo->calendarName, calendarUUID, calendarInfo->calendarColour, calendarInfo->calendarDescription);
682                 
683         } else {
684                 
685                 calendarData.UpdateCalendar(calendarInfo->calendarID, calendarInfo->calendarName, calendarInfo->calendarColour, calendarInfo->calendarDescription);
686                 
687                 // Post event to update the colour in the calendar entries.
688                 
689                 updateColourData.calendarID = calendarInfo->calendarID;
690                 updateColourData.newColour.red = calendarInfo->calendarColour.red;
691                 updateColourData.newColour.green = calendarInfo->calendarColour.green;
692                 updateColourData.newColour.blue = calendarInfo->calendarColour.blue;
693                 updateColourData.newColour.alpha = calendarInfo->calendarColour.alpha;
694                 
695                 wxCommandEvent updateColour(XCCALENDARCTRL_UPDATECALENDARCOLOUR);
696                 updateColour.SetClientData(&updateColourData);
697                 updateColour.SetId(ID_UPDATECOLOUR);
698                 wxPostEvent(mainCalendarCtrl, updateColour);
699                 
700         }
701         
702         // Add the calendar to the calendar data storage.
703         
704         delete calendarListFile;
705         calendarListFile = nullptr;
706         
707         delete calendarInfo;
708         calendarInfo = nullptr;
709         
712 void frmMain::ShowHelp( wxCommandEvent& event )
714         
715         wxMessageBox(_("The help documentation will be implemented in a future version of Xestia Calendar."), _("Unimplemented"));
716         
719 void frmMain::ShowActivityManager( wxCommandEvent &event )
722         activityManager->Show();
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