diff options
-rw-r--r-- | indra/newview/llfacebookconnect.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.h | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_social_photo.xml | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_social_place.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_social_status.xml | 2 |
6 files changed, 44 insertions, 18 deletions
diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index 7b6eb3644f..0f828cf43e 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -70,6 +70,7 @@ public: void setConnectionState(EConnectionState connection_state); bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_POSTED)); } + bool isTransactionOngoing() { return ((mConnectionState == FB_CONNECTION_IN_PROGRESS) || (mConnectionState == FB_POSTING)); } EConnectionState getConnectionState() { return mConnectionState; } S32 generation() { return mGeneration; } diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index d8eb7c5e59..4c384efae1 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -71,7 +71,8 @@ std::string get_map_url() LLSocialStatusPanel::LLSocialStatusPanel() : mMessageTextEditor(NULL), - mPostStatusButton(NULL) + mPostButton(NULL), + mCancelButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLSocialStatusPanel::onSend, this)); } @@ -79,18 +80,22 @@ LLSocialStatusPanel::LLSocialStatusPanel() : BOOL LLSocialStatusPanel::postBuild() { mMessageTextEditor = getChild<LLUICtrl>("status_message"); - mPostStatusButton = getChild<LLUICtrl>("post_status_btn"); + mPostButton = getChild<LLUICtrl>("post_status_btn"); + mCancelButton = getChild<LLUICtrl>("cancel_status_btn"); return LLPanel::postBuild(); } void LLSocialStatusPanel::draw() { - if (mMessageTextEditor && mPostStatusButton) + if (mMessageTextEditor && mPostButton && mCancelButton) { - std::string message = mMessageTextEditor->getValue().asString(); - mPostStatusButton->setEnabled(!message.empty()); - } + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + std::string message = mMessageTextEditor->getValue().asString(); + mMessageTextEditor->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mPostButton->setEnabled(no_ongoing_connection && !message.empty()); + } LLPanel::draw(); } @@ -184,9 +189,10 @@ BOOL LLSocialPhotoPanel::postBuild() childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); mWorkingLabel = getChild<LLUICtrl>("working_lbl"); mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); - mCaptionTextBox = getChild<LLUICtrl>("caption"); + mCaptionTextBox = getChild<LLUICtrl>("photo_caption"); mLocationCheckbox = getChild<LLUICtrl>("add_location_cb"); - mPostButton = getChild<LLUICtrl>("post_btn"); + mPostButton = getChild<LLUICtrl>("post_photo_btn"); + mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); return LLPanel::postBuild(); } @@ -195,6 +201,14 @@ void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get()); + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + mPostButton->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mCaptionTextBox->setEnabled(no_ongoing_connection); + mResolutionComboBox->setEnabled(no_ongoing_connection); + mRefreshBtn->setEnabled(no_ongoing_connection); + mLocationCheckbox->setEnabled(no_ongoing_connection); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { @@ -471,6 +485,8 @@ BOOL LLSocialCheckinPanel::postBuild() { // Keep pointers to widgets so we don't traverse the UI hierarchy too often mPostButton = getChild<LLUICtrl>("post_place_btn"); + mCancelButton = getChild<LLUICtrl>("cancel_place_btn"); + mMessageTextEditor = getChild<LLUICtrl>("place_caption"); mMapLoadingIndicator = getChild<LLUICtrl>("map_loading_indicator"); mMapPlaceholder = getChild<LLIconCtrl>("map_placeholder"); mMapCheckBox = getChild<LLCheckBoxCtrl>("add_place_view_cb"); @@ -481,6 +497,11 @@ BOOL LLSocialCheckinPanel::postBuild() void LLSocialCheckinPanel::draw() { + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + mPostButton->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mMessageTextEditor->setEnabled(no_ongoing_connection); + std::string map_url = get_map_url(); // Did we change location? if (map_url != mMapUrl) @@ -509,7 +530,7 @@ void LLSocialCheckinPanel::draw() // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value mMapLoadingIndicator->setVisible(false); mMapPlaceholder->setVisible(true); - mMapCheckBox->setEnabled(true); + mMapCheckBox->setEnabled(no_ongoing_connection); mMapCheckBox->set(mMapCheckBoxValue); } @@ -564,11 +585,11 @@ void LLSocialCheckinPanel::sendCheckin() LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); // Optionally add the region map view - bool add_map_view = getChild<LLUICtrl>("add_place_view_cb")->getValue().asBoolean(); + bool add_map_view = mMapCheckBox->getValue().asBoolean(); std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); // Get the caption - std::string caption = getChild<LLUICtrl>("place_caption")->getValue().asString(); + std::string caption = mMessageTextEditor->getValue().asString(); // Post to Facebook LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); @@ -576,7 +597,7 @@ void LLSocialCheckinPanel::sendCheckin() void LLSocialCheckinPanel::clearAndClose() { - getChild<LLUICtrl>("place_caption")->setValue(""); + mMessageTextEditor->setValue(""); LLFloater* floater = getParentByType<LLFloater>(); if (floater) diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index 0fc5ea520a..f1deeb423d 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -49,7 +49,8 @@ public: private: LLUICtrl* mMessageTextEditor; - LLUICtrl* mPostStatusButton; + LLUICtrl* mPostButton; + LLUICtrl* mCancelButton; }; class LLSocialPhotoPanel : public LLPanel @@ -86,6 +87,7 @@ private: LLUICtrl * mCaptionTextBox; LLUICtrl * mLocationCheckbox; LLUICtrl * mPostButton; + LLUICtrl* mCancelButton; }; class LLSocialCheckinPanel : public LLPanel @@ -104,6 +106,8 @@ private: std::string mMapUrl; LLPointer<LLViewerFetchedTexture> mMapTexture; LLUICtrl* mPostButton; + LLUICtrl* mCancelButton; + LLUICtrl* mMessageTextEditor; LLUICtrl* mMapLoadingIndicator; LLIconCtrl* mMapPlaceholder; LLCheckBoxCtrl* mMapCheckBox; diff --git a/indra/newview/skins/default/xui/en/panel_social_photo.xml b/indra/newview/skins/default/xui/en/panel_social_photo.xml index b4d2e4246e..ad901db748 100644 --- a/indra/newview/skins/default/xui/en/panel_social_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_social_photo.xml @@ -105,7 +105,7 @@ left="9" length="1" max_length="700" - name="caption" + name="photo_caption" type="string" word_wrap="true"> </text_editor> @@ -127,7 +127,7 @@ left="9" height="23" label="Post" - name="post_btn" + name="post_photo_btn" width="100"> <button.commit_callback function="SocialSharing.SendPhoto" /> @@ -136,7 +136,7 @@ follows="left|top" height="23" label="Cancel" - name="cancel_btn" + name="cancel_photo_btn" left_pad="15" top_delta="0" width="100"> diff --git a/indra/newview/skins/default/xui/en/panel_social_place.xml b/indra/newview/skins/default/xui/en/panel_social_place.xml index 856f94d88b..c0fc9ada75 100644 --- a/indra/newview/skins/default/xui/en/panel_social_place.xml +++ b/indra/newview/skins/default/xui/en/panel_social_place.xml @@ -97,7 +97,7 @@ follows="left|top" height="23" label="Cancel" - name="cancel_btn" + name="cancel_place_btn" left_pad="15" top_delta="0" width="100"> diff --git a/indra/newview/skins/default/xui/en/panel_social_status.xml b/indra/newview/skins/default/xui/en/panel_social_status.xml index b6f3f00cd4..975f8cd29c 100644 --- a/indra/newview/skins/default/xui/en/panel_social_status.xml +++ b/indra/newview/skins/default/xui/en/panel_social_status.xml @@ -55,7 +55,7 @@ follows="left|top" height="23" label="Cancel" - name="cancel_btn" + name="cancel_status_btn" left_pad="15" top_delta="0" width="100"> |