From: Steve Brokenshire Date: Mon, 4 Sep 2017 19:47:26 +0000 (+0100) Subject: frmMain: Close all windows when opening preferences X-Git-Tag: release-0.20~11 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=540e667a9fdae2213756c164185e4d7f78f33e2b;p=xestiaab%2F.git frmMain: Close all windows when opening preferences --- diff --git a/source/frmMain.cpp b/source/frmMain.cpp index 63f0015..aeffdba 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -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::iterator windowIter = WindowListPointers.begin(); + windowIter != WindowListPointers.end(); windowIter++) + { + wxWindow *windowPointer = static_cast(windowIter->second); + windowPointer->Close(); + } + return true; + } + else + { + return false; + } } \ No newline at end of file diff --git a/source/frmMain.h b/source/frmMain.h index ae5c3d0..b9e564b 100644 --- a/source/frmMain.h +++ b/source/frmMain.h @@ -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