Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Close all windows on preferences, edit & delete calendar
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 16 Apr 2017 16:12:19 +0000 (17:12 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 16 Apr 2017 16:17:38 +0000 (17:17 +0100)
source/forms/main/frmMain-Window.cpp
source/forms/main/frmMain.cpp
source/forms/main/frmMain.h

index 401eead..ab1c7cb 100644 (file)
@@ -98,4 +98,28 @@ void frmMain::ShowEventWindow( wxCommandEvent &event ){
        frmEventEditorPtr->Raise();
     
 }
+
+bool frmMain::CloseAllWindows()
+{
+       // Attempt to close all windows.
+       
+       if (WindowListPointersMenu.size() == 0)
+       {
+               return true;
+       }
+       
+       if (wxMessageBox(_("Before preforming the action, all windows that are open will need to close. Do you wish to continue?"), _("Close All Windowss"), wxYES_NO) == wxYES)
+       {
+               for(std::map<int, void*>::iterator windowIter = WindowListPointers.begin();
+                       windowIter != WindowListPointers.end(); windowIter++)
+               {
+                       wxWindow *windowPointer = static_cast<wxWindow*>(windowIter->second);
+                       windowPointer->Close();
+               }
+               return true;
+       }
+       else
+       {
+               return false;
+       }
 }
\ No newline at end of file
index 835118b..8d6a4f8 100644 (file)
@@ -258,6 +258,13 @@ void frmMain::LoadAccountData(){
 void frmMain::ShowPreferencesWindow( wxCommandEvent& event )
 {
 
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+       
        // Open the preferences window.
     
        reloadAccounts = FALSE;
@@ -378,6 +385,13 @@ void frmMain::CreateNewCalendar( wxCommandEvent& event )
 void frmMain::EditCalendar( wxCommandEvent& event )
 {
        
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+       
        // Get the calendar data.
        
        CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(event.GetInt());
@@ -395,6 +409,13 @@ void frmMain::EditCalendar( wxCommandEvent& event )
 void frmMain::DeleteCalendar( wxCommandEvent& event )
 {
 
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+       
        CalendarProperties *calendarEventInfo = (CalendarProperties*)event.GetClientData();
        
        // Get the calendar data.
index 23b9079..37930ae 100644 (file)
@@ -90,6 +90,8 @@ class frmMain : public frmMainADT
                void WindowUpdate( wxCommandEvent& event );
                void WindowDelete( wxCommandEvent& event );
                void ShowEventWindow( wxCommandEvent &event );
+               bool CloseAllWindows();
+       
        public:
                /** Constructor */
                frmMain( wxWindow* parent );
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