ACME-677 Make the 'Connect...', 'Disconnect' and 'Use another account...' buttons disabled upon clicking

meow-7.2.2
Gilbert Gonzales 2013-07-23 13:31:41 -07:00
parent fdb8c2fcdb
commit 66522bb6bd
5 changed files with 39 additions and 3 deletions

View File

@ -181,7 +181,12 @@ class LLFacebookDisconnectResponder : public LLHTTPClient::Responder
{
LOG_CLASS(LLFacebookDisconnectResponder);
public:
LLFacebookDisconnectResponder()
{
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECTING);
}
virtual void completed(U32 status, const std::string& reason, const LLSD& content)
{
if (isGoodStatus(status))
@ -252,6 +257,11 @@ class LLFacebookDisconnectThenConnectResponder : public LLHTTPClient::Responder
LOG_CLASS(LLFacebookDisconnectThenConnectResponder);
public:
LLFacebookDisconnectThenConnectResponder()
{
LLFacebookConnect::instance().setConnectionState(LLFacebookConnect::FB_DISCONNECTING);
}
virtual void completed(U32 status, const std::string& reason, const LLSD& content)
{
if (isGoodStatus(status))

View File

@ -51,7 +51,8 @@ public:
FB_CONNECTION_FAILED = 3,
FB_POSTING = 4,
FB_POSTED = 5,
FB_POST_FAILED = 6
FB_POST_FAILED = 6,
FB_DISCONNECTING = 7
};
void connectToFacebook(const std::string& auth_code = "", const std::string& auth_state = ""); // Initiate the complete FB connection. Please use checkConnectionToFacebook() in normal use.
@ -73,7 +74,7 @@ public:
const LLSD& getContent() const;
void setConnectionState(EConnectionState connection_state);
bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_POSTING) || (mConnectionState == FB_POSTED)); }
bool isConnected() { return ((mConnectionState == FB_CONNECTED) || (mConnectionState == FB_DISCONNECTING) || (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; }

View File

@ -641,6 +641,22 @@ BOOL LLSocialAccountPanel::postBuild()
return LLPanel::postBuild();
}
void LLSocialAccountPanel::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);
mUseAnotherAccountButton->setEnabled(!disconnecting);
//Disable the 'connect' button when a connection is in progress
bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS;
mConnectButton->setEnabled(!connecting);
LLPanel::draw();
}
void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility)
{
bool visible = new_visibility.asBoolean();
@ -862,6 +878,13 @@ void LLFloaterSocial::draw()
status_text = LLTrans::getString("SocialFacebookErrorPosting");
mStatusErrorText->setValue(status_text);
break;
case LLFacebookConnect::FB_DISCONNECTING:
// Disconnecting loading indicator
mStatusLoadingText->setVisible(true);
status_text = LLTrans::getString("SocialFacebookDisconnecting");
mStatusLoadingText->setValue(status_text);
mStatusLoadingIndicator->setVisible(true);
break;
}
}
LLFloater::draw();

View File

@ -120,6 +120,7 @@ class LLSocialAccountPanel : public LLPanel
public:
LLSocialAccountPanel();
BOOL postBuild();
void draw();
private:
void onVisibilityChange(const LLSD& new_visibility);

View File

@ -153,6 +153,7 @@ Please try logging in again in a minute.</string>
<string name="SocialFacebookPosting">Posting...</string>
<string name="SocialFacebookErrorConnecting">Problem connecting to Facebook</string>
<string name="SocialFacebookErrorPosting">Problem posting to Facebook</string>
<string name="SocialFacebookDisconnecting">Disconnecting from Facebook...</string>
<!-- Tooltip -->
<string name="TooltipPerson">Person</string><!-- Object under mouse pointer is an avatar -->