diff options
-rw-r--r-- | indra/newview/llfloatertos.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llfloatertos.h | 3 | ||||
-rw-r--r-- | indra/newview/lllogininstance.cpp | 18 | ||||
-rw-r--r-- | indra/newview/tests/lllogininstance_test.cpp | 24 |
4 files changed, 17 insertions, 35 deletions
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 9859d34284..40bd6360ed 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -57,7 +57,7 @@ LLFloaterTOS::LLFloaterTOS(const LLSD& message) mMessage(message.asString()), mWebBrowserWindowId( 0 ), mLoadCompleteCount( 0 ), - mCallback() + mCallback(callback) { } @@ -240,8 +240,3 @@ void LLFloaterTOS::onNavigateComplete( const EventType& eventIn ) tos_agreement->setEnabled( true ); }; } - -void LLFloaterTOS::setTOSCallback(LLFloaterTOS::YesNoCallback const & callback) -{ - mCallback = callback; -} diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index 0b15c24bc8..0be440d92b 100644 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -66,9 +66,6 @@ public: virtual void onNavigateComplete( const EventType& eventIn ); - // *TODO - consider getting rid of this in favor of using an event pump. -brad - void setTOSCallback(YesNoCallback const & callback); - private: std::string mMessage; int mWebBrowserWindowId; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 3c59cb83cd..f967fcaf97 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -49,7 +49,6 @@ #include "llviewernetwork.h" #include "llviewercontrol.h" #include "llurlsimstring.h" -#include "llfloaterreg.h" #include "llfloatertos.h" #include "llwindow.h" #if LL_LINUX || LL_SOLARIS @@ -222,19 +221,18 @@ bool LLLoginInstance::handleLoginFailure(const LLSD& event) // to reconnect or to end the attempt in failure. if(reason_response == "tos") { - LLFloaterTOS * tos = - LLFloaterReg::showTypedInstance<LLFloaterTOS>("message_tos", LLSD(message_response)); - - tos->setTOSCallback(boost::bind(&LLLoginInstance::handleTOSResponse, + LLFloaterTOS::show(LLFloaterTOS::TOS_TOS, + message_response, + boost::bind(&LLLoginInstance::handleTOSResponse, this, _1, "agree_to_tos")); } else if(reason_response == "critical") { - LLFloaterTOS * tos = - LLFloaterReg::showTypedInstance<LLFloaterTOS>("message_critical",LLSD(message_response)); - - tos->setTOSCallback(boost::bind(&LLLoginInstance::handleTOSResponse, - this, _1, "read_critical")); + LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE, + message_response, + boost::bind(&LLLoginInstance::handleTOSResponse, + this, _1, "read_critical") + ); } else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate")) { diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index d3080d6e4a..5af8acebaf 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -91,23 +91,15 @@ LLURLSimString LLURLSimString::sInstance; bool LLURLSimString::parse() { return true; }
//-----------------------------------------------------------------------------
-#include "llfloaterreg.h"
#include "../llfloatertos.h"
-static std::string gTOSType;
+static LLFloaterTOS::ETOSType gTOSType;
static LLFloaterTOS::YesNoCallback gTOSCallback;
-
-void LLFloaterTOS::setTOSCallback(YesNoCallback const & callback)
+LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type,
+ const std::string & message,
+ const YesNoCallback& callback)
{
+ gTOSType = type;
gTOSCallback = callback;
-}
-
-//static
-LLFloater* LLFloaterReg::showInstance(const std::string & name,
- const LLSD & key,
- BOOL focus)
-{
- gTOSType = name;
- gTOSCallback = LLFloaterTOS::YesNoCallback();
return NULL;
}
@@ -190,7 +182,7 @@ namespace tut gLoginCreds.clear();
gDisconnectCalled = false;
- gTOSType = ""; // Set to invalid value.
+ // gTOSType = -1; // Set to invalid value.
gTOSCallback = 0; // clear the callback.
@@ -279,7 +271,7 @@ namespace tut response["data"]["reason"] = "tos";
gTestPump.post(response);
- ensure_equals("TOS Dialog type", gTOSType, "message_tos");
+ ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS);
ensure("TOS callback given", gTOSCallback != 0);
gTOSCallback(false); // Call callback denying TOS.
ensure("No TOS, failed auth", logininstance->authFailure());
@@ -305,7 +297,7 @@ namespace tut response["data"]["reason"] = "critical"; // Change response to "critical message"
gTestPump.post(response);
- ensure_equals("TOS Dialog type", gTOSType, "message_critical");
+ ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE);
ensure("TOS callback given", gTOSCallback != 0);
gTOSCallback(true);
ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true);
|