summaryrefslogtreecommitdiff
path: root/indra/newview/llblocklist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llblocklist.cpp')
-rwxr-xr-xindra/newview/llblocklist.cpp110
1 files changed, 16 insertions, 94 deletions
diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp
index ac41b26a34..066cb71677 100755
--- a/indra/newview/llblocklist.cpp
+++ b/indra/newview/llblocklist.cpp
@@ -41,14 +41,10 @@ static const LLBlockListNameTypeComparator NAME_TYPE_COMPARATOR;
LLBlockList::LLBlockList(const Params& p)
: LLFlatListViewEx(p),
mSelectedItem(NULL),
- mDirty(true),
- mShouldAddAll(true),
- mActionType(NONE),
- mMuteListSize(0)
+ mDirty(true)
{
LLMuteList::getInstance()->addObserver(this);
- mMuteListSize = LLMuteList::getInstance()->getMutes().size();
// Set up context menu.
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
@@ -77,41 +73,6 @@ LLBlockList::~LLBlockList()
LLMuteList::getInstance()->removeObserver(this);
}
-void LLBlockList::createList()
-{
- std::vector<LLMute> mutes = LLMuteList::instance().getMutes();
- std::vector<LLMute>::const_iterator mute_it = mutes.begin();
-
- for (; mute_it != mutes.end(); ++mute_it)
- {
- addNewItem(&*mute_it);
- }
-}
-
-BlockListActionType LLBlockList::getCurrentMuteListActionType()
-{
- BlockListActionType type = NONE;
- U32 curSize = LLMuteList::getInstance()->getMutes().size();
- if( curSize > mMuteListSize)
- type = ADD;
- else if(curSize < mMuteListSize)
- type = REMOVE;
-
- return type;
-}
-
-void LLBlockList::onChangeDetailed(const LLMute &mute)
-{
- mActionType = getCurrentMuteListActionType();
-
- mCurItemId = mute.mID;
- mCurItemName = mute.mName;
- mCurItemType = mute.mType;
- mCurItemFlags = mute.mFlags;
-
- refresh();
-}
-
BOOL LLBlockList::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
@@ -127,16 +88,6 @@ BOOL LLBlockList::handleRightMouseDown(S32 x, S32 y, MASK mask)
return handled;
}
-void LLBlockList::removeListItem(const LLMute* mute)
-{
- removeItemByUUID(mute->mID);
-}
-
-void LLBlockList::hideListItem(LLBlockedListItem* item, bool show)
-{
- item->setVisible(show);
-}
-
void LLBlockList::setNameFilter(const std::string& filter)
{
std::string filter_upper = filter;
@@ -185,56 +136,28 @@ void LLBlockList::refresh()
bool have_filter = !mNameFilter.empty();
// save selection to restore it after list rebuilt
- LLUUID selected = getSelectedUUID(), next_selected;
+ LLUUID selected = getSelectedUUID();
- if(mShouldAddAll) // creating list of blockers
+ // calling refresh may be initiated by removing currently selected item
+ // so select next item and save the selection to restore it after list rebuilt
+ if (!selectNextItemPair(false, true))
{
- clear();
- createList();
- mShouldAddAll = false;
- }
- else
- {
- // handle remove/add functionality
- LLMute mute(mCurItemId, mCurItemName, mCurItemType, mCurItemFlags);
- if(mActionType == ADD)
- {
- addNewItem(&mute);
- }
- else if(mActionType == REMOVE)
- {
- if(selected == mute.mID)
- {
- // we are going to remove currently selected item, so select next item and save the selection to restore it
- if (!selectNextItemPair(false, true))
- {
- selectNextItemPair(true, true);
- }
- next_selected = getSelectedUUID();
- }
- removeListItem(&mute);
- }
- mActionType = NONE;
+ selectNextItemPair(true, true);
}
+ LLUUID next_selected = getSelectedUUID();
+
+ clear();
+
+ std::vector<LLMute> mutes = LLMuteList::instance().getMutes();
+ std::vector<LLMute>::const_iterator mute_it = mutes.begin();
- // handle filter functionality
- if(have_filter || (!have_filter && !mPrevNameFilter.empty()))
+ for (; mute_it != mutes.end(); ++mute_it)
{
- // we should update visibility of our items if previous filter was not empty
- std::vector < LLPanel* > allItems;
- getItems(allItems);
- std::vector < LLPanel* >::iterator it = allItems.begin();
+ if (have_filter && !findInsensitive(mute_it->mName, mNameFilter))
+ continue;
- for(; it != allItems.end() ; ++it)
- {
- LLBlockedListItem * curItem = dynamic_cast<LLBlockedListItem *> (*it);
- if(curItem)
- {
- hideListItem(curItem, findInsensitive(curItem->getName(), mNameFilter));
- }
- }
+ addNewItem(&*mute_it);
}
- mPrevNameFilter = mNameFilter;
if (getItemPair(selected))
{
@@ -246,7 +169,6 @@ void LLBlockList::refresh()
// previously selected item was removed, so select next item
selectItemPair(getItemPair(next_selected), true);
}
- mMuteListSize = LLMuteList::getInstance()->getMutes().size();
// Sort the list.
sort();