summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrad kittenbrink <brad@lindenlab.com>2009-08-05 18:39:02 -0700
committerbrad kittenbrink <brad@lindenlab.com>2009-08-05 18:39:02 -0700
commit0bf8a15cc03b48432a5b9e0011a01908ef903960 (patch)
treebe3fc02ea9ee7fcbcab6d427756e35bd3441ba65
parent47ae794060833eedcdae4e9f41085315f490581a (diff)
Fixups after the latest merge with viewer-2.0.0-3. Updated LLLoginInstance to use the new LLFloaterReg way of getting hold of floaters.
-rw-r--r--indra/newview/llfloatertos.cpp7
-rw-r--r--indra/newview/llfloatertos.h3
-rw-r--r--indra/newview/lllogininstance.cpp18
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp24
4 files changed, 35 insertions, 17 deletions
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index 40bd6360ed..9859d34284 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(callback)
+ mCallback()
{
}
@@ -240,3 +240,8 @@ 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 0be440d92b..0b15c24bc8 100644
--- a/indra/newview/llfloatertos.h
+++ b/indra/newview/llfloatertos.h
@@ -66,6 +66,9 @@ 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 f967fcaf97..3c59cb83cd 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -49,6 +49,7 @@
#include "llviewernetwork.h"
#include "llviewercontrol.h"
#include "llurlsimstring.h"
+#include "llfloaterreg.h"
#include "llfloatertos.h"
#include "llwindow.h"
#if LL_LINUX || LL_SOLARIS
@@ -221,18 +222,19 @@ bool LLLoginInstance::handleLoginFailure(const LLSD& event)
// to reconnect or to end the attempt in failure.
if(reason_response == "tos")
{
- LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,
- message_response,
- boost::bind(&LLLoginInstance::handleTOSResponse,
+ LLFloaterTOS * tos =
+ LLFloaterReg::showTypedInstance<LLFloaterTOS>("message_tos", LLSD(message_response));
+
+ tos->setTOSCallback(boost::bind(&LLLoginInstance::handleTOSResponse,
this, _1, "agree_to_tos"));
}
else if(reason_response == "critical")
{
- LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE,
- message_response,
- boost::bind(&LLLoginInstance::handleTOSResponse,
- this, _1, "read_critical")
- );
+ LLFloaterTOS * tos =
+ LLFloaterReg::showTypedInstance<LLFloaterTOS>("message_critical",LLSD(message_response));
+
+ tos->setTOSCallback(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 5af8acebaf..d3080d6e4a 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -91,15 +91,23 @@ LLURLSimString LLURLSimString::sInstance;
bool LLURLSimString::parse() { return true; }
//-----------------------------------------------------------------------------
+#include "llfloaterreg.h"
#include "../llfloatertos.h"
-static LLFloaterTOS::ETOSType gTOSType;
+static std::string gTOSType;
static LLFloaterTOS::YesNoCallback gTOSCallback;
-LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type,
- const std::string & message,
- const YesNoCallback& callback)
+
+void LLFloaterTOS::setTOSCallback(YesNoCallback const & 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;
}
@@ -182,7 +190,7 @@ namespace tut
gLoginCreds.clear();
gDisconnectCalled = false;
- // gTOSType = -1; // Set to invalid value.
+ gTOSType = ""; // Set to invalid value.
gTOSCallback = 0; // clear the callback.
@@ -271,7 +279,7 @@ namespace tut
response["data"]["reason"] = "tos";
gTestPump.post(response);
- ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS);
+ ensure_equals("TOS Dialog type", gTOSType, "message_tos");
ensure("TOS callback given", gTOSCallback != 0);
gTOSCallback(false); // Call callback denying TOS.
ensure("No TOS, failed auth", logininstance->authFailure());
@@ -297,7 +305,7 @@ namespace tut
response["data"]["reason"] = "critical"; // Change response to "critical message"
gTestPump.post(response);
- ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE);
+ ensure_equals("TOS Dialog type", gTOSType, "message_critical");
ensure("TOS callback given", gTOSCallback != 0);
gTOSCallback(true);
ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true);