Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Close all windows when opening preferences
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 4 Sep 2017 19:47:26 +0000 (20:47 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 4 Sep 2017 19:47:26 +0000 (20:47 +0100)
source/frmMain.cpp
source/frmMain.h

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
index ae5c3d0..b9e564b 100644 (file)
@@ -287,6 +287,7 @@ class frmMain : public frmMainADT
 #else
                void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollectionString SSLCertInc);
 #endif
+               bool CloseAllWindows();
                DECLARE_EVENT_TABLE()
 
        //// end generated class members
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