From 710b75b3a96c7e962e6a1cf435ff5e1d8d0603e9 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 5 Feb 2016 23:38:58 -0500 Subject: [PATCH] Fix "Save As doesn't enable if File Menu is torn off" SV-2005 #close Fixfixed --- indra/newview/llviewermenufile.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 46f942402..f99b3c7be 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -95,9 +95,26 @@ class LLFileEnableSaveAs : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gFloaterView->getFrontmost() && - gFloaterView->getFrontmost()->canSaveAs(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + LLFloater* frontmost = gFloaterView->getFrontmost(); + if (frontmost && frontmost->hasChild("Save Preview As...", true)) // If we're the tearoff. + { + // Get the next frontmost sibling. + const LLView::child_list_const_iter_t kids_end = gFloaterView->endChild(); + LLView::child_list_const_iter_t kid = std::find(gFloaterView->beginChild(), kids_end, frontmost); + if (kids_end != kid) + { + for (++kid; kid != kids_end; ++kid) + { + LLView* viewp = *kid; + if (viewp->getVisible() && !viewp->isDead()) + { + frontmost = static_cast(viewp); + break; + } + } + } + } + gMenuHolder->findControl(userdata["control"].asString())->setValue(frontmost && frontmost->canSaveAs()); return true; } };