summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-07-12 11:28:48 -0700
committerMonroe Linden <monroe@lindenlab.com>2010-07-12 11:28:48 -0700
commitb80ee71bed341b6c2f316e37537f01043726e816 (patch)
treeee70d7f3bb539368fc81416025ac46d8692dd26e /indra/llui
parenta59f159281a0ede70a7cc6ed5687af8b9b08ef7b (diff)
Fix for reopened EXT-8025
Fixed an issue in LLFlatListView where calling setCommitOnSelectionChange(true) wasn't always causing the commit signal to be sent when the selection changed. Reviewed by Richard at http://codereview.lindenlab.com/2579010
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llflatlistview.cpp11
-rw-r--r--indra/llui/llflatlistview.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index b313f8c950..3c79da64f9 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -327,6 +327,9 @@ U32 LLFlatListView::size(const bool only_visible_items) const
void LLFlatListView::clear()
{
+ // This will clear mSelectedItemPairs, calling all appropriate callbacks.
+ resetSelection();
+
// do not use LLView::deleteAllChildren to avoid removing nonvisible items. drag-n-drop for ex.
for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
{
@@ -335,7 +338,6 @@ void LLFlatListView::clear()
delete *it;
}
mItemPairs.clear();
- mSelectedItemPairs.clear();
// also set items panel height to zero. Reshape it to allow reshaping of non-item children
LLRect rc = mItemsPanel->getRect();
@@ -975,6 +977,7 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
llassert(item_pair);
bool deleted = false;
+ bool selection_changed = false;
for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
{
item_pair_t* _item_pair = *it;
@@ -994,6 +997,7 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
if (selected_item_pair == item_pair)
{
it = mSelectedItemPairs.erase(it);
+ selection_changed = true;
break;
}
}
@@ -1008,6 +1012,11 @@ bool LLFlatListView::removeItemPair(item_pair_t* item_pair, bool rearrange)
notifyParentItemsRectChanged();
}
+ if (selection_changed && mCommitOnSelectionChange)
+ {
+ onCommit();
+ }
+
return true;
}
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 29b6b718af..50d06fbc94 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -265,6 +265,7 @@ public:
void setAllowSelection(bool can_select) { mAllowSelection = can_select; }
/** Sets flag whether onCommit should be fired if selection was changed */
+ // FIXME: this should really be a separate signal, since "Commit" implies explicit user action, and selection changes can happen more indirectly.
void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; }
/** Get number of selected items in the list */