summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatersocial.cpp60
-rw-r--r--indra/newview/llfloatersocial.h2
-rw-r--r--indra/newview/skins/default/xui/en/panel_social_account.xml15
3 files changed, 70 insertions, 7 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();
}
////////////////////////
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index cdd8a71b79..48245e34ea 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -122,6 +122,8 @@ public:
BOOL postBuild();
private:
+ void onVisibilityChange(const LLSD& new_visibility);
+ bool onFacebookConnectStateChange(const LLSD& data);
void onConnect();
void onUseAnotherAccount();
void onDisconnect();
diff --git a/indra/newview/skins/default/xui/en/panel_social_account.xml b/indra/newview/skins/default/xui/en/panel_social_account.xml
index 838a9ba064..470e0848d2 100644
--- a/indra/newview/skins/default/xui/en/panel_social_account.xml
+++ b/indra/newview/skins/default/xui/en/panel_social_account.xml
@@ -3,7 +3,12 @@
width="304"
layout="topleft"
name="panel_social_account">
-
+ <string
+ name="facebook_connected"
+ value="You are connected to Facebook as:" />
+ <string
+ name="facebook_disconnected"
+ value="Not connected to Facebook" />
<text
layout="topleft"
length="1"
@@ -14,7 +19,7 @@
name="account_caption_label"
top="21"
type="string">
- You are connected to Facebook as:
+ Not connected to Facebook.
</text>
<text
layout="topleft"
@@ -53,7 +58,8 @@
height="23"
label="Use another account..."
name="use_another_account_btn"
- width="210">
+ width="210"
+ visible="false">
<commit_callback function="SocialSharing.UseAnotherAccount"/>
</button>
@@ -64,7 +70,8 @@
height="23"
label="Disconnect"
name="disconnect_btn"
- width="210">
+ width="210"
+ visible="false">
<commit_callback function="SocialSharing.Disconnect"/>
</button>
</panel>