X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2FfrmMain.cpp;h=aeffdbaa0f2843b96464cea0d59fb7442022da7d;hp=63f0015035476b7526ca342c36a5a41497394e21;hb=540e667a9fdae2213756c164185e4d7f78f33e2b;hpb=1cd99f1d6252ccfd70cea70a86f6977e4f2d6e6d 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