Fixed search bar not functional (FIRE-5065)

Ansariel 2012-02-23 19:54:32 +01:00
parent 4bd201398e
commit 8bd6e5e659
2 changed files with 41 additions and 1 deletions

View File

@ -270,6 +270,7 @@ LLNavigationBar::LLNavigationBar()
mBtnForward(NULL),
mBtnHome(NULL),
mCmbLocation(NULL),
mSearchComboBox(NULL),
mPurgeTPHistoryItems(false),
mSaveToLocationHistory(false)
{
@ -291,7 +292,10 @@ BOOL LLNavigationBar::postBuild()
mBtnForward = getChild<LLPullButton>("forward_btn");
mBtnHome = getChild<LLButton>("home_btn");
mCmbLocation= getChild<LLLocationInputCtrl>("location_combo");
mCmbLocation= getChild<LLLocationInputCtrl>("location_combo");
mSearchComboBox = getChild<LLSearchComboBox>("search_combo_box");
fillSearchComboBox();
mBtnBack->setEnabled(FALSE);
mBtnBack->setClickedCallback(boost::bind(&LLNavigationBar::onBackButtonClicked, this));
@ -306,6 +310,8 @@ BOOL LLNavigationBar::postBuild()
mBtnHome->setClickedCallback(boost::bind(&LLNavigationBar::onHomeButtonClicked, this));
mCmbLocation->setCommitCallback(boost::bind(&LLNavigationBar::onLocationSelection, this));
mSearchComboBox->setCommitCallback(boost::bind(&LLNavigationBar::onSearchCommit, this));
mTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1));
@ -351,6 +357,26 @@ void LLNavigationBar::setVisible(BOOL visible)
}
}
void LLNavigationBar::fillSearchComboBox()
{
if(!mSearchComboBox)
{
return;
}
LLSearchHistory::getInstance()->load();
LLSearchHistory::search_history_list_t search_list =
LLSearchHistory::getInstance()->getSearchHistoryList();
LLSearchHistory::search_history_list_t::const_iterator it = search_list.begin();
for( ; search_list.end() != it; ++it)
{
LLSearchHistory::LLSearchHistoryItem item = *it;
mSearchComboBox->add(item.search_query);
}
}
void LLNavigationBar::draw()
{
if(mPurgeTPHistoryItems)
@ -403,6 +429,16 @@ void LLNavigationBar::onHomeButtonClicked()
gAgent.teleportHome();
}
void LLNavigationBar::onSearchCommit()
{
std::string search_query = mSearchComboBox->getSimple();
if(!search_query.empty())
{
LLSearchHistory::getInstance()->addEntry(search_query);
}
invokeSearch(search_query);
}
void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata)
{
int idx = userdata.asInteger();

View File

@ -118,6 +118,7 @@ private:
void onHomeButtonClicked();
void onLocationSelection();
void onLocationPrearrange(const LLSD& data);
void onSearchCommit();
void onTeleportFinished(const LLVector3d& global_agent_pos);
void onTeleportFailed();
void onRegionNameResponse(
@ -127,6 +128,8 @@ private:
U64 region_handle, const std::string& url,
const LLUUID& snapshot_id, bool teleport);
void fillSearchComboBox();
static void destroyClass()
{
if (LLNavigationBar::instanceExists())
@ -139,6 +142,7 @@ private:
LLPullButton* mBtnBack;
LLPullButton* mBtnForward;
LLButton* mBtnHome;
LLSearchComboBox* mSearchComboBox;
LLLocationInputCtrl* mCmbLocation;
LLRect mDefaultNpRect;
LLRect mDefaultNavContainerRect;