diff options
| -rw-r--r-- | indra/llui/llurlregistry.cpp | 20 | ||||
| -rw-r--r-- | indra/llui/llurlregistry.h | 4 | ||||
| -rw-r--r-- | indra/newview/llnavigationbar.cpp | 18 | 
3 files changed, 41 insertions, 1 deletions
| diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index afcff0d409..ad5c0911f8 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -223,3 +223,23 @@ bool LLUrlRegistry::hasUrl(const LLWString &text)  	LLUrlMatch match;  	return findUrl(text, match);  } + +bool LLUrlRegistry::isUrl(const std::string &text) +{ +	LLUrlMatch match; +	if (findUrl(text, match)) +	{ +		return (match.getStart() == 0 && match.getEnd() >= text.size()-1); +	} +	return false; +} + +bool LLUrlRegistry::isUrl(const LLWString &text) +{ +	LLUrlMatch match; +	if (findUrl(text, match)) +	{ +		return (match.getStart() == 0 && match.getEnd() >= text.size()-1); +	} +	return false; +} diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index d7800d8cfc..399ee0a988 100644 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h @@ -85,6 +85,10 @@ public:  	bool hasUrl(const std::string &text);  	bool hasUrl(const LLWString &text); +	// return true if the given string is a URL that findUrl would match +	bool isUrl(const std::string &text); +	bool isUrl(const LLWString &text); +  private:  	LLUrlRegistry();  	friend class LLSingleton<LLUrlRegistry>; diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 6210151d1b..71dc0f9011 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -51,6 +51,8 @@  #include "llsidetray.h"  #include "llslurl.h"  #include "llurlsimstring.h" +#include "llurlregistry.h" +#include "llurldispatcher.h"  #include "llviewerinventory.h"  #include "llviewermenu.h"  #include "llviewerparcelmgr.h" @@ -58,6 +60,7 @@  #include "llappviewer.h"  #include "llviewercontrol.h"  #include "llfloatermediabrowser.h" +#include "llweb.h"  #include "llinventorymodel.h"  #include "lllandmarkactions.h" @@ -543,7 +546,20 @@ void LLNavigationBar::onRegionNameResponse(  	// Invalid location?  	if (!region_handle)  	{ -		invokeSearch(typed_location); +		// handle any secondlife:// SLapps, or +		// display http:// URLs in the media browser, or +		// anything else is sent to the search floater +		if (LLUrlRegistry::instance().isUrl(typed_location)) +		{ +			if (! LLURLDispatcher::dispatchFromTextEditor(typed_location)) +			{ +				LLWeb::loadURL(typed_location); +			} +		} +		else +		{ +			invokeSearch(typed_location); +		}  		return;  	} | 
