Skip to content
Snippets Groups Projects
Commit bf749401 authored by Lynx Linden's avatar Lynx Linden
Browse files

EXT-3486: Support SLapps and URLs in the nav bar.

If the user enters a string into the navigation bar that is not
recognized as an SL location, the behavior is now:

- handle any secondlife:// SLapps, or
- open any http: or https: URLs in the media browser, or
- otherwise, send the text to the search floater
parent d1eb2948
No related branches found
No related tags found
No related merge requests found
...@@ -223,3 +223,23 @@ bool LLUrlRegistry::hasUrl(const LLWString &text) ...@@ -223,3 +223,23 @@ bool LLUrlRegistry::hasUrl(const LLWString &text)
LLUrlMatch match; LLUrlMatch match;
return findUrl(text, 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;
}
...@@ -85,6 +85,10 @@ class LLUrlRegistry : public LLSingleton<LLUrlRegistry> ...@@ -85,6 +85,10 @@ class LLUrlRegistry : public LLSingleton<LLUrlRegistry>
bool hasUrl(const std::string &text); bool hasUrl(const std::string &text);
bool hasUrl(const LLWString &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: private:
LLUrlRegistry(); LLUrlRegistry();
friend class LLSingleton<LLUrlRegistry>; friend class LLSingleton<LLUrlRegistry>;
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include "llsidetray.h" #include "llsidetray.h"
#include "llslurl.h" #include "llslurl.h"
#include "llurlsimstring.h" #include "llurlsimstring.h"
#include "llurlregistry.h"
#include "llurldispatcher.h"
#include "llviewerinventory.h" #include "llviewerinventory.h"
#include "llviewermenu.h" #include "llviewermenu.h"
#include "llviewerparcelmgr.h" #include "llviewerparcelmgr.h"
...@@ -58,6 +60,7 @@ ...@@ -58,6 +60,7 @@
#include "llappviewer.h" #include "llappviewer.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llfloatermediabrowser.h" #include "llfloatermediabrowser.h"
#include "llweb.h"
#include "llinventorymodel.h" #include "llinventorymodel.h"
#include "lllandmarkactions.h" #include "lllandmarkactions.h"
...@@ -543,7 +546,20 @@ void LLNavigationBar::onRegionNameResponse( ...@@ -543,7 +546,20 @@ void LLNavigationBar::onRegionNameResponse(
// Invalid location? // Invalid location?
if (!region_handle) 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; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment