From 7fc98de12c0a69bae6d847697da6d8a0e03f80be Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 26 Jun 2013 21:14:11 -0700 Subject: ACME-621 : Add autoconnect to FBC in the social floater, disable Post buttons when not connected. --- indra/newview/llfloatersocial.cpp | 13 +++++++++---- indra/newview/llfloatersocial.h | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9e7b131abf..b717dc0f40 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -79,7 +79,7 @@ void LLSocialStatusPanel::draw() if (mMessageTextEditor && mPostStatusButton) { std::string message = mMessageTextEditor->getValue().asString(); - mPostStatusButton->setEnabled(!message.empty()); + mPostStatusButton->setEnabled(!message.empty() && LLFacebookConnect::instance().isConnected()); } LLPanel::draw(); @@ -123,6 +123,7 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel() BOOL LLSocialPhotoPanel::postBuild() { + mPostButton = getChild("post_btn"); mResolutionComboBox = getChild("resolution_combobox"); mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::onResolutionComboCommit, this)); mRefreshBtn = getChild("new_snapshot_btn"); @@ -256,11 +257,8 @@ LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() return previewp; } - void LLSocialPhotoPanel::updateControls() { - - LLSnapshotLivePreview* previewp = getPreviewView(); BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); @@ -363,6 +361,8 @@ void LLSocialPhotoPanel::draw() mThumbnailPlaceholder->draw(); gGL.popUIMatrix(); } + + mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); } void LLSocialPhotoPanel::onSend() @@ -404,6 +404,7 @@ LLSocialCheckinPanel::LLSocialCheckinPanel() : BOOL LLSocialCheckinPanel::postBuild() { // Keep pointers to widgets so we don't traverse the UI hierarchy too often + mPostButton = getChild("post_place_btn"); mMapLoadingIndicator = getChild("map_loading_indicator"); mMapPlaceholder = getChild("map_placeholder"); mMapCheckBox = getChild("add_place_view_cb"); @@ -445,6 +446,7 @@ void LLSocialCheckinPanel::draw() mMapCheckBox->setEnabled(true); mMapCheckBox->set(mMapCheckBoxValue); } + mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); LLPanel::draw(); } @@ -495,6 +497,9 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { + // Initiate a connection to Facebook (getConnectionToFacebook() handles the already connected state) + LLFacebookConnect::instance().getConnectionToFacebook(); + // Keep tab of the Photo Panel mSocialPhotoPanel = static_cast(getChild("social_photo_tab")); return LLFloater::postBuild(); } diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index b7792e10c1..1848481084 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -75,6 +75,9 @@ class LLSocialPhotoPanel : public LLPanel LLUICtrl* mThumbnailPlaceholder; bool mNeedRefresh; + +private: + LLUICtrl* mPostButton; }; class LLSocialCheckinPanel : public LLPanel @@ -87,6 +90,7 @@ public: private: std::string mMapUrl; LLPointer mMapTexture; + LLUICtrl* mPostButton; LLUICtrl* mMapLoadingIndicator; LLIconCtrl* mMapPlaceholder; LLCheckBoxCtrl* mMapCheckBox; -- cgit v1.2.3