From 06b079a24b743088ca51eea1a627f0b4e1722458 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 20 Aug 2009 00:21:14 +0000
Subject: [PATCH] EXT-580 Add Friend button in the IM floater not disabled if
 already friends EXT-579 Add Friend from the Im floater opens multiple
 invitation dialogs sidebar should be up above bottom tray reviewed by richard

---
 indra/llui/llpanel.cpp                  | 12 +++++++++---
 indra/llui/llpanel.h                    |  5 +++++
 indra/newview/llfloaterpreference.cpp   |  6 +++---
 indra/newview/llimpanel.cpp             |  6 ++----
 indra/newview/llpanelimcontrolpanel.cpp |  1 +
 indra/newview/llsidetray.cpp            |  3 ++-
 indra/newview/llviewerwindow.cpp        |  2 +-
 7 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 1a948fdd00..da55ababab 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -94,7 +94,8 @@ LLPanel::LLPanel(const LLPanel::Params& p)
 	mBorder(NULL),
 	mLabel(p.label),
 	mCommitCallbackRegistrar(false),
-	mEnableCallbackRegistrar(false)
+	mEnableCallbackRegistrar(false),
+	mXMLFilename("")
 {
 	setIsChrome(FALSE);
 
@@ -486,8 +487,13 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
 		LLFastTimer timer(FTM_PANEL_SETUP);
 
 		LLXMLNodePtr referenced_xml;
-		std::string xml_filename;
-		node->getAttributeString("filename", xml_filename);
+		std::string xml_filename = mXMLFilename;
+		
+		// if the panel didn't provide a filename, check the node
+		if (xml_filename.empty())
+		{
+			node->getAttributeString("filename", xml_filename);
+		}
 
 		if (!xml_filename.empty())
 		{
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 552a621a8e..2a70467ffc 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -249,6 +249,8 @@ public:
 
 	//call onOpen to let panel know when it's about to be shown or activated
 	virtual void	onOpen(const LLSD& key) {}
+
+	void setXMLFilename(std::string filename) { mXMLFilename = filename; };
 	
 protected:
 	// Override to set not found list
@@ -278,6 +280,9 @@ private:
 	ui_string_map_t	mUIStrings;
 
 	std::string		mRequirementsError;
+
+	// for setting the xml filename when building panel in context dependent cases
+	std::string		mXMLFilename;
 	
 }; // end class LLPanel
 
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 6050fbfa5d..1a7f72d49c 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -422,7 +422,7 @@ void LLFloaterPreference::apply()
 			panel->apply();
 	}
 	// hardware menu apply
-	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::findTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
+	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
 	if (hardware_settings)
 	{
 		hardware_settings->apply();
@@ -514,7 +514,7 @@ void LLFloaterPreference::cancel()
 	LLFloaterReg::hideInstance("pref_joystick");
 	
 	// cancel hardware menu
-	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::findTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
+	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
 	if (hardware_settings)
 	{
 		hardware_settings->cancel();
@@ -649,7 +649,7 @@ void LLFloaterPreference::refreshEnabledGraphics()
 	{
 		instance->refreshEnabledState();
 	}
-	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::findTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
+	LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
 	if (hardware_settings)
 	{
 		hardware_settings->refreshEnabledState();
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 954da8abd7..0b4e0f9317 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -2151,8 +2151,7 @@ void* LLIMFloater::createPanelIMControl(void* userdata)
 {
 	LLIMFloater *self = (LLIMFloater*)userdata;
 	self->mControlPanel = new LLPanelIMControlPanel();
-	LLUICtrlFactory::getInstance()->buildPanel(self->mControlPanel, "panel_im_control_panel.xml");
-	self->mControlPanel->setVisible(FALSE);
+	self->mControlPanel->setXMLFilename("panel_im_control_panel.xml");
 	return self->mControlPanel;
 }
 
@@ -2162,8 +2161,7 @@ void* LLIMFloater::createPanelGroupControl(void* userdata)
 {
 	LLIMFloater *self = (LLIMFloater*)userdata;
 	self->mControlPanel = new LLPanelGroupControlPanel();
-	LLUICtrlFactory::getInstance()->buildPanel(self->mControlPanel, "panel_group_control_panel.xml");
-	self->mControlPanel->setVisible(FALSE);
+	self->mControlPanel->setXMLFilename("panel_group_control_panel.xml");
 	return self->mControlPanel;
 }
 
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 1d50bb26f6..51cdc5af93 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -53,6 +53,7 @@ BOOL LLPanelIMControlPanel::postBuild()
 	childSetAction("add_friend_btn", boost::bind(&LLPanelIMControlPanel::onAddFriendButtonClicked, this));
 	childSetAction("call_btn", boost::bind(&LLPanelIMControlPanel::onCallButtonClicked, this));
 	childSetAction("share_btn", boost::bind(&LLPanelIMControlPanel::onShareButtonClicked, this));
+	childSetEnabled("add_friend_btn", !LLAvatarActions::isFriend(getChild<LLAvatarIconCtrl>("avatar_icon")->getAvatarId()));
 
 	return TRUE;
 }
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 0558cc3488..9990c22dac 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -34,6 +34,7 @@
 
 #include "lltextbox.h"
 
+#include "llbottomtray.h"
 #include "llsidetray.h"
 #include "llviewerwindow.h"
 #include "llaccordionctrl.h"
@@ -650,7 +651,7 @@ void	LLSideTray::setPanelRect	()
 	if(!mCollapsed)
 		panel_width+=mMaxBarWidth;
 
-	S32 panel_height = parent_rect.getHeight()-fake_top_offset;
+	S32 panel_height = parent_rect.getHeight() - fake_top_offset - LLBottomTray::getInstance()->getRect().getHeight();
 	LLRect panel_rect;
 	panel_rect.setLeftTopAndSize( parent_rect.mRight-panel_width, parent_rect.mTop-fake_top_offset, panel_width, panel_height);
 	setRect(panel_rect);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index e757090da8..2b1dbf8e84 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2440,7 +2440,7 @@ void LLViewerWindow::updateUI()
 
 	updateWorldViewRect();
 
-	updateBottomTrayRect();
+	//updateBottomTrayRect();
 
 	LLView::sMouseHandlerMessage.clear();
 
-- 
GitLab