diff options
-rw-r--r-- | indra/newview/llfloaterfacebook.cpp | 260 | ||||
-rw-r--r-- | indra/newview/llfloaterfacebook.h | 34 |
2 files changed, 147 insertions, 147 deletions
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp index d8cc070fd0..33422fb5fd 100644 --- a/indra/newview/llfloaterfacebook.cpp +++ b/indra/newview/llfloaterfacebook.cpp @@ -98,27 +98,27 @@ S32 compute_jpeg_quality(S32 width, S32 height) LLFacebookStatusPanel::LLFacebookStatusPanel() : mMessageTextEditor(NULL), mPostButton(NULL), - mCancelButton(NULL),
- mAccountCaptionLabel(NULL),
- mAccountNameLabel(NULL),
- mPanelButtons(NULL),
- mConnectButton(NULL),
+ mCancelButton(NULL), + mAccountCaptionLabel(NULL), + mAccountNameLabel(NULL), + mPanelButtons(NULL), + mConnectButton(NULL), mDisconnectButton(NULL) { - mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLFacebookStatusPanel::onConnect, this));
- mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLFacebookStatusPanel::onDisconnect, this));
-
- setVisibleCallback(boost::bind(&LLFacebookStatusPanel::onVisibilityChange, this, _2));
+ mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLFacebookStatusPanel::onConnect, this)); + mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLFacebookStatusPanel::onDisconnect, this)); + + setVisibleCallback(boost::bind(&LLFacebookStatusPanel::onVisibilityChange, this, _2)); mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLFacebookStatusPanel::onSend, this)); } BOOL LLFacebookStatusPanel::postBuild() { - mAccountCaptionLabel = getChild<LLTextBox>("account_caption_label");
- mAccountNameLabel = getChild<LLTextBox>("account_name_label");
- mPanelButtons = getChild<LLUICtrl>("panel_buttons");
- mConnectButton = getChild<LLUICtrl>("connect_btn");
+ mAccountCaptionLabel = getChild<LLTextBox>("account_caption_label"); + mAccountNameLabel = getChild<LLTextBox>("account_name_label"); + mPanelButtons = getChild<LLUICtrl>("panel_buttons"); + mConnectButton = getChild<LLUICtrl>("connect_btn"); mDisconnectButton = getChild<LLUICtrl>("disconnect_btn"); mMessageTextEditor = getChild<LLUICtrl>("status_message"); @@ -130,15 +130,15 @@ BOOL LLFacebookStatusPanel::postBuild() void LLFacebookStatusPanel::draw() { - LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState();
-
- //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress
- bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING;
- mDisconnectButton->setEnabled(!disconnecting);
-
- //Disable the 'connect' button when a connection is in progress
- bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS;
- mConnectButton->setEnabled(!connecting);
+ LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); + + //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress + bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; + mDisconnectButton->setEnabled(!disconnecting); + + //Disable the 'connect' button when a connection is in progress + bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; + mConnectButton->setEnabled(!connecting); if (mMessageTextEditor && mPostButton && mCancelButton) { @@ -171,18 +171,18 @@ void LLFacebookStatusPanel::onSend() bool LLFacebookStatusPanel::onFacebookConnectStateChange(const LLSD& data) { - if(LLFacebookConnect::instance().isConnected())
- {
- //In process of disconnecting so leave the layout as is
- if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING)
- {
- showConnectedLayout();
- }
- }
- else
- {
- showDisconnectedLayout();
- }
+ if(LLFacebookConnect::instance().isConnected()) + { + //In process of disconnecting so leave the layout as is + if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) + { + showConnectedLayout(); + } + } + else + { + showDisconnectedLayout(); + } switch (data.get("enum").asInteger()) { @@ -209,102 +209,102 @@ void LLFacebookStatusPanel::sendStatus() } } -void LLFacebookStatusPanel::onVisibilityChange(BOOL visible)
-{
- if(visible)
- {
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel");
- LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1));
-
- LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel");
- LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectInfoChange, this));
-
- //Connected
- if(LLFacebookConnect::instance().isConnected())
- {
- showConnectedLayout();
- }
- //Check if connected (show disconnected layout in meantime)
- else
- {
- showDisconnectedLayout();
- }
- if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) ||
- (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED))
- {
- LLFacebookConnect::instance().checkConnectionToFacebook();
- }
- }
- else
- {
- LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel");
- LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel");
- }
-}
-
-bool LLFacebookStatusPanel::onFacebookConnectInfoChange()
-{
- LLSD info = LLFacebookConnect::instance().getInfo();
- std::string clickable_name;
-
- //Strings of format [http://www.somewebsite.com Click Me] become clickable text
- if(info.has("link") && info.has("name"))
- {
- clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]";
- }
-
- mAccountNameLabel->setText(clickable_name);
-
- return false;
-}
-
-void LLFacebookStatusPanel::showConnectButton()
-{
- if(!mConnectButton->getVisible())
- {
- mConnectButton->setVisible(TRUE);
- mDisconnectButton->setVisible(FALSE);
- }
-}
-
-void LLFacebookStatusPanel::hideConnectButton()
-{
- if(mConnectButton->getVisible())
- {
- mConnectButton->setVisible(FALSE);
- mDisconnectButton->setVisible(TRUE);
- }
-}
-
-void LLFacebookStatusPanel::showDisconnectedLayout()
-{
- mAccountCaptionLabel->setText(getString("facebook_disconnected"));
- mAccountNameLabel->setText(std::string(""));
- showConnectButton();
-}
-
-void LLFacebookStatusPanel::showConnectedLayout()
-{
- LLFacebookConnect::instance().loadFacebookInfo();
-
- mAccountCaptionLabel->setText(getString("facebook_connected"));
- hideConnectButton();
-}
-
-void LLFacebookStatusPanel::onConnect()
-{
- LLFacebookConnect::instance().checkConnectionToFacebook(true);
-
- pressedConnect = TRUE;
- //Clear only the facebook browser cookies so that the facebook login screen appears
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");
-}
-
-void LLFacebookStatusPanel::onDisconnect()
-{
- LLFacebookConnect::instance().disconnectFromFacebook();
-
- LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");
+void LLFacebookStatusPanel::onVisibilityChange(BOOL visible) +{ + if(visible) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1)); + + LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectInfoChange, this)); + + //Connected + if(LLFacebookConnect::instance().isConnected()) + { + showConnectedLayout(); + } + //Check if connected (show disconnected layout in meantime) + else + { + showDisconnectedLayout(); + } + if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) || + (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED)) + { + LLFacebookConnect::instance().checkConnectionToFacebook(); + } + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); + } +} + +bool LLFacebookStatusPanel::onFacebookConnectInfoChange() +{ + LLSD info = LLFacebookConnect::instance().getInfo(); + std::string clickable_name; + + //Strings of format [http://www.somewebsite.com Click Me] become clickable text + if(info.has("link") && info.has("name")) + { + clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; + } + + mAccountNameLabel->setText(clickable_name); + + return false; +} + +void LLFacebookStatusPanel::showConnectButton() +{ + if(!mConnectButton->getVisible()) + { + mConnectButton->setVisible(TRUE); + mDisconnectButton->setVisible(FALSE); + } +} + +void LLFacebookStatusPanel::hideConnectButton() +{ + if(mConnectButton->getVisible()) + { + mConnectButton->setVisible(FALSE); + mDisconnectButton->setVisible(TRUE); + } +} + +void LLFacebookStatusPanel::showDisconnectedLayout() +{ + mAccountCaptionLabel->setText(getString("facebook_disconnected")); + mAccountNameLabel->setText(std::string("")); + showConnectButton(); +} + +void LLFacebookStatusPanel::showConnectedLayout() +{ + LLFacebookConnect::instance().loadFacebookInfo(); + + mAccountCaptionLabel->setText(getString("facebook_connected")); + hideConnectButton(); +} + +void LLFacebookStatusPanel::onConnect() +{ + LLFacebookConnect::instance().checkConnectionToFacebook(true); + + pressedConnect = TRUE; + //Clear only the facebook browser cookies so that the facebook login screen appears + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); +} + +void LLFacebookStatusPanel::onDisconnect() +{ + LLFacebookConnect::instance().disconnectFromFacebook(); + + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); } void LLFacebookStatusPanel::clearAndClose() diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h index e1526db18d..6fe7a6541b 100644 --- a/indra/newview/llfloaterfacebook.h +++ b/indra/newview/llfloaterfacebook.h @@ -51,23 +51,23 @@ public: void clearAndClose(); private: - void onVisibilityChange(BOOL new_visibility);
- bool onFacebookConnectInfoChange();
- void onConnect();
- void onUseAnotherAccount();
- void onDisconnect();
-
- void showConnectButton();
- void hideConnectButton();
- void showDisconnectedLayout();
- void showConnectedLayout();
-
- bool pressedConnect;
-
- LLTextBox * mAccountCaptionLabel;
- LLTextBox * mAccountNameLabel;
- LLUICtrl * mPanelButtons;
- LLUICtrl * mConnectButton;
+ void onVisibilityChange(BOOL new_visibility); + bool onFacebookConnectInfoChange(); + void onConnect(); + void onUseAnotherAccount(); + void onDisconnect(); + + void showConnectButton(); + void hideConnectButton(); + void showDisconnectedLayout(); + void showConnectedLayout(); + + bool pressedConnect; + + LLTextBox * mAccountCaptionLabel; + LLTextBox * mAccountNameLabel; + LLUICtrl * mPanelButtons; + LLUICtrl * mConnectButton; LLUICtrl * mDisconnectButton; LLUICtrl* mMessageTextEditor; LLUICtrl* mPostButton; |