Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Close all windows when opening preferences
[xestiaab/.git] / source / frmMain.cpp
index 63f0015..aeffdba 100644 (file)
@@ -477,6 +477,13 @@ void frmMain::ShowAboutWindow( wxCommandEvent& event )
 void frmMain::OpenPreferences( wxCommandEvent& event)
 {
 
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+
        // Open the preferences window.
     
        ReloadAccounts = FALSE;
@@ -3192,4 +3199,29 @@ void frmMain::ResetContactInfo(){
        htmContactData->SetPage(EmptyPage);
        AccCtrl->SetValue("");
        
+}
+
+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
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