summaryrefslogtreecommitdiff
path: root/indra/newview/llnavigationbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnavigationbar.cpp')
-rw-r--r--indra/newview/llnavigationbar.cpp57
1 files changed, 33 insertions, 24 deletions
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 7a9012429b..7e9ccfc578 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -448,8 +448,14 @@ void LLNavigationBar::onLocationSelection()
// Will not teleport to empty location.
if (typed_location.empty())
return;
-
+ //get selected item from combobox item
LLSD value = mCmbLocation->getSelectedValue();
+ /* since navbar list support autocompletion it contains several types of item: landmark, teleport hystory item,
+ * typed by user slurl or region name. Let's find out which type of item the user has selected
+ * to make decision about adding this location into typed history. see mSaveToLocationHistory
+ * Note:
+ * Only TYPED_REGION_SLURL item will be added into LLLocationHistory
+ */
if(value.has("item_type"))
{
@@ -479,7 +485,7 @@ void LLNavigationBar::onLocationSelection()
case TELEPORT_HISTORY:
//in case of teleport item was selected, teleport by position too.
- case TYPED_REGION_SURL:
+ case TYPED_REGION_SLURL:
if(value.has("global_pos"))
{
gAgent.teleportViaLocation(LLVector3d(value["global_pos"]));
@@ -491,7 +497,7 @@ void LLNavigationBar::onLocationSelection()
break;
}
}
- //Let's parse surl or region name
+ //Let's parse slurl or region name
std::string region_name;
LLVector3 local_coords(128, 128, 0);
@@ -499,14 +505,30 @@ void LLNavigationBar::onLocationSelection()
LLSLURL slurl = LLSLURL(typed_location);
if (slurl.getType() == LLSLURL::LOCATION)
{
- // Yes. Extract region name and local coordinates from it.
- region_name = slurl.getRegion();
- local_coords = slurl.getPosition();
+ region_name = slurl.getRegion();
+ local_coords = slurl.getPosition();
+ }
+ else if(!slurl.isValid())
+ {
+ // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too
+ // but we need to know whether typed_location is a simple http url.
+ if (LLUrlRegistry::instance().isUrl(typed_location))
+ {
+ // display http:// URLs in the media browser, or
+ // anything else is sent to the search floater
+ LLWeb::loadURL(typed_location);
+ return;
+ }
+ else
+ {
+ // assume that an user has typed the {region name} or possible {region_name, parcel}
+ region_name = typed_location.substr(0,typed_location.find(','));
+ }
}
else
{
- // assume that an user has typed the {region name} or possible {region_name, parcel}
- region_name = typed_location.substr(0,typed_location.find(','));
+ // was an app slurl, home, whatever. Bail
+ return;
}
// Resolve the region name to its global coordinates.
@@ -529,7 +551,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
return;
LLLocationHistory* lh = LLLocationHistory::getInstance();
- //TODO*: do we need convert surl into readable format?
+ //TODO*: do we need convert slurl into readable format?
std::string location;
/*NOTE:
* We can't use gAgent.getPositionAgent() in case of local teleport to build location.
@@ -541,7 +563,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
LLLocationHistoryItem item (location,
- global_agent_pos, tooltip,TYPED_REGION_SURL);// we can add into history only TYPED location
+ global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
//Touch it, if it is at list already, add new location otherwise
if ( !lh->touchItem(item) ) {
lh->addItem(item);
@@ -619,20 +641,7 @@ void LLNavigationBar::onRegionNameResponse(
// Invalid location?
if (!region_handle)
{
- // 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);
- }
+ invokeSearch(typed_location);
return;
}