summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersocial.cpp
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-07-18 16:13:14 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2013-07-18 16:13:14 -0700
commitb2e2282e988ab8c7d989d8554a41fda8b8c6e691 (patch)
tree8405894fc4c4e531d067e60c0799ccf3ffcc0536 /indra/newview/llfloatersocial.cpp
parent883fca9d5a7c5db10f100b05b5312818233e342c (diff)
ACME-727 Display 'Not connected to Facebook' when the user does not have a FB token
Diffstat (limited to 'indra/newview/llfloatersocial.cpp')
-rw-r--r--indra/newview/llfloatersocial.cpp60
1 files changed, 57 insertions, 3 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index 66624f6355..d64e4273f4 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -625,6 +625,8 @@ mDisconnectButton(NULL)
mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLSocialAccountPanel::onConnect, this));
mCommitCallbackRegistrar.add("SocialSharing.UseAnotherAccount", boost::bind(&LLSocialAccountPanel::onUseAnotherAccount, this));
mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLSocialAccountPanel::onDisconnect, this));
+
+ setVisibleCallback(boost::bind(&LLSocialAccountPanel::onVisibilityChange, this, _2));
}
BOOL LLSocialAccountPanel::postBuild()
@@ -636,9 +638,61 @@ BOOL LLSocialAccountPanel::postBuild()
mUseAnotherAccountButton = getChild<LLUICtrl>("use_another_account_btn");
mDisconnectButton = getChild<LLUICtrl>("disconnect_btn");
+ return LLPanel::postBuild();
+}
+
+void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility)
+{
+ bool visible = new_visibility.asBoolean();
+
+ if(visible)
+ {
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel");
+ LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectStateChange, this, _1));
+
+ if(LLFacebookConnect::instance().isConnected())
+ {
hideConnectButton();
+ mAccountCaptionLabel->setText(getString("facebook_connected"));
+ mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]"));
- return LLPanel::postBuild();
+ }
+ else
+ {
+ mAccountCaptionLabel->setText(getString("facebook_disconnected"));
+ mAccountNameLabel->setText(std::string(""));
+ LLFacebookConnect::instance().checkConnectionToFacebook();
+ }
+ }
+ else
+ {
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel");
+ }
+}
+
+bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data)
+{
+
+ switch (data.get("enum").asInteger())
+ {
+ case LLFacebookConnect::FB_CONNECTED:
+ case LLFacebookConnect::FB_POSTING:
+ case LLFacebookConnect::FB_POSTED:
+ case LLFacebookConnect::FB_POST_FAILED:
+ mAccountCaptionLabel->setText(getString("facebook_connected"));
+ mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]"));
+ hideConnectButton();
+ break;
+ case LLFacebookConnect::FB_NOT_CONNECTED:
+ case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS:
+ case LLFacebookConnect::FB_CONNECTION_FAILED:
+ mAccountCaptionLabel->setText(getString("facebook_disconnected"));
+ mAccountNameLabel->setText(std::string(""));
+ showConnectButton();
+ break;
+ }
+
+ return false;
}
void LLSocialAccountPanel::showConnectButton()
@@ -673,7 +727,7 @@ void LLSocialAccountPanel::hideConnectButton()
void LLSocialAccountPanel::onConnect()
{
- hideConnectButton();
+ LLFacebookConnect::instance().checkConnectionToFacebook(true);
}
void LLSocialAccountPanel::onUseAnotherAccount()
@@ -683,7 +737,7 @@ void LLSocialAccountPanel::onUseAnotherAccount()
void LLSocialAccountPanel::onDisconnect()
{
- showConnectButton();
+ LLFacebookConnect::instance().disconnectFromFacebook();
}
////////////////////////