diff options
Diffstat (limited to 'indra/newview/lllocationhistory.cpp')
-rw-r--r-- | indra/newview/lllocationhistory.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index 179eca2532..68143fd1e3 100644 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -39,8 +39,7 @@ #include "llui.h" LLLocationHistory::LLLocationHistory() : - mFilename("typed_locations.txt"), - mLoadedCallback(NULL) + mFilename("typed_locations.txt") { } @@ -48,6 +47,12 @@ void LLLocationHistory::addItem(std::string item) { static LLUICachedControl<S32> max_items("LocationHistoryMaxSize", 100); + std::vector<std::string>::iterator item_iter = std::find(mItems.begin(), mItems.end(), item); + + if (item_iter != mItems.end()) { + mItems.erase(item_iter); + } + mItems.push_back(item); // If the vector size exceeds the maximum, purge the oldest items. @@ -55,6 +60,11 @@ void LLLocationHistory::addItem(std::string item) mItems.erase(mItems.begin(), mItems.end()-max_items); } +void LLLocationHistory::removeItems() +{ + mItems.clear(); +} + bool LLLocationHistory::getMatchingItems(std::string substring, location_list_t& result) const { @@ -129,6 +139,5 @@ void LLLocationHistory::load() file.close(); - if (mLoadedCallback) - mLoadedCallback(); + mLoadedSignal(); } |