summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatertos.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatertos.cpp')
-rw-r--r--indra/newview/llfloatertos.cpp63
1 files changed, 16 insertions, 47 deletions
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index d75640ccb4..9859d34284 100644
--- a/indra/newview/llfloatertos.cpp
+++ b/indra/newview/llfloatertos.cpp
@@ -52,43 +52,12 @@
#include "message.h"
-// static
-LLFloaterTOS* LLFloaterTOS::sInstance = NULL;
-
-// static
-LLFloaterTOS* LLFloaterTOS::show(ETOSType type,
- const std::string & message,
- const YesNoCallback& callback)
-{
- if( !LLFloaterTOS::sInstance )
- {
- LLFloaterTOS::sInstance = new LLFloaterTOS(type, message, callback);
- }
-
- if (type == TOS_TOS)
- {
- LLUICtrlFactory::getInstance()->buildFloater(LLFloaterTOS::sInstance, "floater_tos.xml");
- }
- else
- {
- LLUICtrlFactory::getInstance()->buildFloater(LLFloaterTOS::sInstance, "floater_critical.xml");
- }
-
- sInstance->startModal();
-
- return LLFloaterTOS::sInstance;
-}
-
-
-LLFloaterTOS::LLFloaterTOS(ETOSType type,
- const std::string & message,
- const YesNoCallback& callback)
-: LLModalDialog( std::string(" "), 100, 100 ),
- mType(type),
- mMessage(message),
+LLFloaterTOS::LLFloaterTOS(const LLSD& message)
+: LLModalDialog( message, 100, 100 ),
+ mMessage(message.asString()),
mWebBrowserWindowId( 0 ),
mLoadCompleteCount( 0 ),
- mCallback(callback)
+ mCallback()
{
}
@@ -144,8 +113,8 @@ BOOL LLFloaterTOS::postBuild()
childSetAction("Continue", onContinue, this);
childSetAction("Cancel", onCancel, this);
childSetCommitCallback("agree_chk", updateAgree, this);
-
- if ( mType != TOS_TOS )
+
+ if (hasChild("tos_text"))
{
// this displays the critical message
LLTextEditor *editor = getChild<LLTextEditor>("tos_text");
@@ -182,17 +151,14 @@ BOOL LLFloaterTOS::postBuild()
void LLFloaterTOS::setSiteIsAlive( bool alive )
{
// only do this for TOS pages
- if ( mType == TOS_TOS )
+ if (hasChild("tos_html"))
{
LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html");
// if the contents of the site was retrieved
if ( alive )
{
- if ( web_browser )
- {
- // navigate to the "real" page
- web_browser->navigateTo( getString( "real_url" ) );
- };
+ // navigate to the "real" page
+ web_browser->navigateTo( getString( "real_url" ) );
}
else
{
@@ -200,8 +166,8 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
// but if the page is unavailable, we need to do this now
LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
tos_agreement->setEnabled( true );
- };
- };
+ }
+ }
}
LLFloaterTOS::~LLFloaterTOS()
@@ -216,8 +182,6 @@ LLFloaterTOS::~LLFloaterTOS()
// tell the responder we're not here anymore
if ( gResponsePtr )
gResponsePtr->setParent( 0 );
-
- LLFloaterTOS::sInstance = NULL;
}
// virtual
@@ -276,3 +240,8 @@ void LLFloaterTOS::onNavigateComplete( const EventType& eventIn )
tos_agreement->setEnabled( true );
};
}
+
+void LLFloaterTOS::setTOSCallback(LLFloaterTOS::YesNoCallback const & callback)
+{
+ mCallback = callback;
+}