From c48332202b4ece08316a7a8784b214365b88694b Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 27 Apr 2013 23:04:15 +0200 Subject: [PATCH] FIRE-10034: Fix filter being shared between places panel and standalone TP history --- indra/newview/fsfloaterteleporthistory.cpp | 4 +- indra/newview/llpanelteleporthistory.cpp | 52 +++++++++++++++++++--- indra/newview/llpanelteleporthistory.h | 10 +++++ 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/indra/newview/fsfloaterteleporthistory.cpp b/indra/newview/fsfloaterteleporthistory.cpp index da836793fc..50fd250e82 100644 --- a/indra/newview/fsfloaterteleporthistory.cpp +++ b/indra/newview/fsfloaterteleporthistory.cpp @@ -51,6 +51,8 @@ BOOL FSFloaterTeleportHistory::postBuild() if (mHistoryPanel) { + mHistoryPanel->setIsStandAlone(true); + mHistoryPanel->mTeleportBtn = getChild("teleport_btn"); mHistoryPanel->mShowOnMapBtn = getChild("map_btn"); mHistoryPanel->mShowProfile = getChild("profile_btn"); @@ -88,7 +90,7 @@ void FSFloaterTeleportHistory::onFilterEdit(const std::string& search_string, bo return; } - if (force_filter || mHistoryPanel->getFilterSubString() != search_string) + if (force_filter || mHistoryPanel->getFilterString() != search_string) { std::string string = search_string; diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index f021f28f1e..3825eb88c7 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -464,7 +464,11 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel() mHistoryAccordion(NULL), mAccordionTabMenu(NULL), mLastSelectedFlatlList(NULL), - mLastSelectedItemIndex(-1) + // Separate search filter for standalone TP history + //mLastSelectedItemIndex(-1) + mLastSelectedItemIndex(-1), + mIsStandAlone(false) + // { buildFromFile( "panel_teleport_history.xml"); } @@ -563,7 +567,17 @@ void LLTeleportHistoryPanel::draw() // virtual void LLTeleportHistoryPanel::onSearchEdit(const std::string& string) { - sFilterSubString = string; + // Separate search filter for standalone TP history + //sFilterSubString = string; + if (mIsStandAlone) + { + mFilterString = string; + } + else + { + sFilterSubString = string; + } + // showTeleportHistory(); } @@ -740,6 +754,13 @@ void LLTeleportHistoryPanel::refresh() LLFlatListView* curr_flat_view = NULL; std::string filter_string = sFilterSubString; + // Separate search filter for standalone TP history + if (mIsStandAlone) + { + filter_string = mFilterString; + } + // + LLStringUtil::toUpper(filter_string); U32 added_items = 0; @@ -774,7 +795,15 @@ void LLTeleportHistoryPanel::refresh() tab->setVisible(true); // Expand all accordion tabs when filtering - if(!sFilterSubString.empty()) + // Separate search filter for standalone TP history + //if(!sFilterSubString.empty()) + std::string str_filter = sFilterSubString; + if (mIsStandAlone) + { + str_filter = mFilterString; + } + if (!str_filter.empty()) + // { //store accordion tab state when filter is not empty tab->notifyChildren(LLSD().with("action","store_state")); @@ -825,7 +854,17 @@ void LLTeleportHistoryPanel::refresh() } } - mHistoryAccordion->setFilterSubString(sFilterSubString); + // Separate search filter for standalone TP history + //mHistoryAccordion->setFilterSubString(sFilterSubString); + if (mIsStandAlone) + { + mHistoryAccordion->setFilterSubString(mFilterString); + } + else + { + mHistoryAccordion->setFilterSubString(sFilterSubString); + } + // mHistoryAccordion->arrange(); @@ -871,7 +910,10 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) .getFlatItemForPersistentItem(&mContextMenu, history_items[history_items.size() - 1], // Most recent item, it was added instead of removed history_items.size(), // index will be decremented inside loop below - sFilterSubString); + // Separate search filter for standalone TP history + //sFilterSubString); + (mIsStandAlone ? mFilterString : sFilterSubString)); + // fv->addItem(item, LLUUID::null, ADD_TOP); diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index 17d22f1101..6a1ba62742 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -78,6 +78,11 @@ public: /*virtual*/ void updateVerbs(); /*virtual*/ bool isSingleItemSelected(); + // Separate search filter for standalone TP history + void setIsStandAlone(bool standalone) { mIsStandAlone = standalone; } + std::string getFilterString() { return mFilterString; } + // + private: void onDoubleClickItem(); @@ -123,6 +128,11 @@ private: LLHandle mGearMenuHandle; boost::signals2::connection mTeleportHistoryChangedConnection; + + // Separate search filter for standalone TP history + bool mIsStandAlone; + std::string mFilterString; + // };