From fd4262541946770515ce8a486dd3a69245365def Mon Sep 17 00:00:00 2001
From: Cho <cho@lindenlab.com>
Date: Thu, 4 Jul 2013 02:01:51 +0100
Subject: Close floater and clear text upon FB_POSTED for ACME-668

---
 indra/newview/llfloatersocial.cpp | 38 ++++++++++++++++++++++++++++++++++++++
 indra/newview/llfloatersocial.h   |  3 +++
 2 files changed, 41 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index eb3ceaf96e..2ecadcfaf6 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -120,6 +120,7 @@ bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data)
 
 		case LLFacebookConnect::FB_POSTED:
 			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel");
+			clearAndClose();
 			break;
 	}
 
@@ -135,6 +136,17 @@ void LLSocialStatusPanel::sendStatus()
 	}
 }
 
+void LLSocialStatusPanel::clearAndClose()
+{
+	mMessageTextEditor->setValue("");
+
+	LLFloater* floater = getParentByType<LLFloater>();
+	if (floater)
+	{
+		floater->closeFloater();
+	}
+}
+
 ///////////////////////////
 //LLSocialPhotoPanel///////
 ///////////////////////////
@@ -333,6 +345,7 @@ bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data)
 
 		case LLFacebookConnect::FB_POSTED:
 			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel");
+			clearAndClose();
 			break;
 	}
 
@@ -365,6 +378,17 @@ void LLSocialPhotoPanel::sendPhoto()
 	updateControls();
 }
 
+void LLSocialPhotoPanel::clearAndClose()
+{
+	mCaptionTextBox->setValue("");
+
+	LLFloater* floater = getParentByType<LLFloater>();
+	if (floater)
+	{
+		floater->closeFloater();
+	}
+}
+
 void LLSocialPhotoPanel::updateControls()
 {
 	LLSnapshotLivePreview* previewp = getPreviewView();
@@ -564,6 +588,7 @@ bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data)
 
 		case LLFacebookConnect::FB_POSTED:
 			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel");
+			clearAndClose();
 			break;
 	}
 
@@ -595,6 +620,17 @@ void LLSocialCheckinPanel::sendCheckin()
 	LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);
 }
 
+void LLSocialCheckinPanel::clearAndClose()
+{
+	getChild<LLUICtrl>("place_caption")->setValue("");
+
+	LLFloater* floater = getParentByType<LLFloater>();
+	if (floater)
+	{
+		floater->closeFloater();
+	}
+}
+
 ////////////////////////
 //LLFloaterSocial///////
 ////////////////////////
@@ -680,6 +716,8 @@ void LLFloaterSocial::draw()
             mStatusLoadingIndicator->setVisible(true);
             break;
         case LLFacebookConnect::FB_CONNECTED:
+			break;
+        case LLFacebookConnect::FB_POSTED:
             break;
         case LLFacebookConnect::FB_CONNECTION_FAILED:
         case LLFacebookConnect::FB_POST_FAILED:
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index e37facbbce..5e1ee6be0e 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -45,6 +45,7 @@ public:
 	bool onFacebookConnectStateChange(const LLSD& data);
 
 	void sendStatus();
+	void clearAndClose();
 
 private:
 	LLUICtrl* mMessageTextEditor;
@@ -67,6 +68,7 @@ public:
 	bool onFacebookConnectStateChange(const LLSD& data);
 
 	void sendPhoto();
+	void clearAndClose();
 
 	void updateControls();
 	void updateResolution(BOOL do_update);
@@ -101,6 +103,7 @@ public:
 	bool onFacebookConnectStateChange(const LLSD& data);
 
 	void sendCheckin();
+	void clearAndClose();
 
 private:
     std::string mMapUrl;
-- 
cgit v1.2.3