From 942bbf943d74b8804c4d3fee98a14c8618a4e031 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 5 Jan 2017 11:45:17 +0200
Subject: [PATCH] MAINT-7029 Pop-up menu isn't shown in Place profile if all
 menu items are disabled

---
 indra/llui/llmenugl.cpp         | 28 ++++++++++++++++------------
 indra/llui/llmenugl.h           |  5 +++++
 indra/newview/llpanelplaces.cpp |  6 +++++-
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 848367f8a8d..8425774d465 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1736,6 +1736,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p)
 	mJumpKey(p.jump_key),
 	mCreateJumpKeys(p.create_jump_keys),
 	mNeedsArrange(FALSE),
+	mAlwaysShowMenu(FALSE),
 	mResetScrollPositionOnShow(true),
 	mShortcutPad(p.shortcut_pad)
 {
@@ -3223,20 +3224,23 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
 
 	menu->setVisible( TRUE );
 
-	//Do not show menu if all menu items are disabled
-	BOOL item_enabled = false;
-	for (LLView::child_list_t::const_iterator itor = menu->getChildList()->begin();
-			 itor != menu->getChildList()->end();
-			 ++itor)
+	if(!menu->getAlwaysShowMenu())
 	{
-		LLView *menu_item = (*itor);
-		item_enabled = item_enabled || menu_item->getEnabled();
-	}
+		//Do not show menu if all menu items are disabled
+		BOOL item_enabled = false;
+		for (LLView::child_list_t::const_iterator itor = menu->getChildList()->begin();
+				itor != menu->getChildList()->end();
+				++itor)
+		{
+			LLView *menu_item = (*itor);
+			item_enabled = item_enabled || menu_item->getEnabled();
+		}
 
-	if(!item_enabled)
-	{
-		menu->setVisible( FALSE );
-		return;
+		if(!item_enabled)
+		{
+			menu->setVisible( FALSE );
+			return;
+		}
 	}
 
 	// Save click point for detecting cursor moves before mouse-up.
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index c7f7f6848cd..69f7d215134 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -531,6 +531,9 @@ class LLMenuGL
 	void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; }
 	bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; }
 
+	void setAlwaysShowMenu(BOOL show) { mAlwaysShowMenu = show; }
+	BOOL getAlwaysShowMenu() { return mAlwaysShowMenu; }
+
 	// add a context menu branch
 	BOOL appendContextSubMenu(LLMenuGL *menu);
 
@@ -572,6 +575,8 @@ class LLMenuGL
 	static LLColor4 sDefaultBackgroundColor;
 	static BOOL		sKeyboardMode;
 
+	BOOL			mAlwaysShowMenu;
+
 	LLUIColor		mBackgroundColor;
 	BOOL			mBgVisible;
 	LLHandle<LLView> mParentMenuItem;
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 0507d6db867..ed942fc7fc5 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -304,7 +304,11 @@ BOOL LLPanelPlaces::postBuild()
 	enable_registrar.add("Places.OverflowMenu.Enable",  boost::bind(&LLPanelPlaces::onOverflowMenuItemEnable, this, _2));
 
 	mPlaceMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	if (!mPlaceMenu)
+	if (mPlaceMenu)
+	{
+		mPlaceMenu->setAlwaysShowMenu(TRUE);
+	}
+	else
 	{
 		LL_WARNS() << "Error loading Place menu" << LL_ENDL;
 	}
-- 
GitLab