Fixed normal bug ETX-2651 (Locations from teleport history are added to location history).

--HG--
branch : product-engine
master
Andrew Dyukov 2009-11-23 14:44:07 +02:00
parent 1b07c1d7fb
commit d2cee29e8a
3 changed files with 24 additions and 10 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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