summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2009-11-23 14:44:07 +0200
committerAndrew Dyukov <adyukov@productengine.com>2009-11-23 14:44:07 +0200
commitd2cee29e8a039e3cac5c851b4e770b9c7e1095f0 (patch)
tree8b04a01f7ecf4e441a6086208055d2be6131bed4
parent1b07c1d7fb5b6d3ce15083bc3dbb65a3f0ac8006 (diff)
Fixed normal bug ETX-2651 (Locations from teleport history are added to location history).
--HG-- branch : product-engine
-rw-r--r--indra/newview/lllocationinputctrl.cpp1
-rw-r--r--indra/newview/llnavigationbar.cpp27
-rw-r--r--indra/newview/llnavigationbar.h6
3 files changed, 24 insertions, 10 deletions
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 7e35cfa04c..9aefbcbbb0 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -188,7 +188,6 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
params.rect(text_entry_rect);
params.default_text(LLStringUtil::null);
params.max_length_bytes(p.max_chars);
- params.commit_callback.function(boost::bind(&LLComboBox::onTextCommit, this, _2));
params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1));
params.handle_edit_keys_directly(true);
params.commit_on_focus_lost(false);
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 114d26af8a..c032d01d2f 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -172,7 +172,8 @@ LLNavigationBar::LLNavigationBar()
mBtnHome(NULL),
mCmbLocation(NULL),
mSearchComboBox(NULL),
- mPurgeTPHistoryItems(false)
+ mPurgeTPHistoryItems(false),
+ mSaveToLocationHistory(false)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_navigation_bar.xml");
@@ -186,6 +187,7 @@ LLNavigationBar::LLNavigationBar()
LLNavigationBar::~LLNavigationBar()
{
mTeleportFinishConnection.disconnect();
+ mTeleportFailedConnection.disconnect();
}
BOOL LLNavigationBar::postBuild()
@@ -220,6 +222,12 @@ BOOL LLNavigationBar::postBuild()
mSearchComboBox->setCommitCallback(boost::bind(&LLNavigationBar::onSearchCommit, this));
+ mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1));
+
+ mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFailedCallback(boost::bind(&LLNavigationBar::onTeleportFailed, this));
+
mDefaultNbRect = getRect();
mDefaultFpRect = getChild<LLFavoritesBarCtrl>("favorite")->getRect();
@@ -395,15 +403,19 @@ void LLNavigationBar::onLocationSelection()
LLWorldMapMessage::url_callback_t cb = boost::bind(
&LLNavigationBar::onRegionNameResponse, this,
typed_location, region_name, local_coords, _1, _2, _3, _4);
- // connect the callback each time, when user enter new location to get real location of agent after teleport
- mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
- setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1,typed_location));
+ mSaveToLocationHistory = true;
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false);
}
-void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos, const std::string& typed_location)
+void LLNavigationBar::onTeleportFailed()
{
- // Location is valid. Add it to the typed locations history.
+ mSaveToLocationHistory = false;
+}
+
+void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
+{
+ if (!mSaveToLocationHistory)
+ return;
LLLocationHistory* lh = LLLocationHistory::getInstance();
//TODO*: do we need convert surl into readable format?
@@ -426,8 +438,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos, con
lh->save();
- if(mTeleportFinishConnection.connected())
- mTeleportFinishConnection.disconnect();
+ mSaveToLocationHistory = false;
}
diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h
index 52f5a827e4..cd3ba08db3 100644
--- a/indra/newview/llnavigationbar.h
+++ b/indra/newview/llnavigationbar.h
@@ -81,7 +81,8 @@ private:
void onLocationSelection();
void onLocationPrearrange(const LLSD& data);
void onSearchCommit();
- void onTeleportFinished(const LLVector3d& global_agent_pos, const std::string& typed_location);
+ void onTeleportFinished(const LLVector3d& global_agent_pos);
+ void onTeleportFailed();
void onRegionNameResponse(
std::string typed_location,
std::string region_name,
@@ -99,8 +100,11 @@ private:
LLLocationInputCtrl* mCmbLocation;
LLRect mDefaultNbRect;
LLRect mDefaultFpRect;
+ boost::signals2::connection mTeleportFailedConnection;
boost::signals2::connection mTeleportFinishConnection;
bool mPurgeTPHistoryItems;
+ // if true, save location to location history when teleport finishes
+ bool mSaveToLocationHistory;
};
#endif