diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-09-14 14:54:20 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-09-14 14:54:20 -0400 |
commit | 4b269f67ea8d053b4c05a9c002811901c8ec8a49 (patch) | |
tree | 401f44f1c339fc8fa847c355129d91cacd2bd22a /indra/newview/llfolderview.cpp | |
parent | df40eca093b1a238daea9cd23c44f6e39719bf51 (diff) | |
parent | b2d20f5a989bde2c4db90091bec37d310cc346fc (diff) |
merge
Diffstat (limited to 'indra/newview/llfolderview.cpp')
-rw-r--r-- | indra/newview/llfolderview.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index e4bd2049fa..8b72d83830 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -1010,6 +1010,33 @@ void LLFolderView::removeSelectedItems( void ) LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLFolderView::onItemsRemovalConfirmation, this, _1, _2)); } +bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFolderViewItem*>& selectedItems) +{ + LLFolderViewItem* item_parent = dynamic_cast<LLFolderViewItem*>(item->getParent()); + + if (item_parent) + { + for(std::vector<LLFolderViewItem*>::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it) + { + const LLFolderViewItem* const selected_item = (*it); + + LLFolderViewItem* parent = item_parent; + + while (parent) + { + if (selected_item == parent) + { + return true; + } + + parent = dynamic_cast<LLFolderViewItem*>(parent->getParent()); + } + } + } + + return false; +} + void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -1084,7 +1111,7 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL if (!new_selection) { new_selection = last_item->getPreviousOpenNode(FALSE); - while (new_selection && new_selection->isSelected()) + while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items))) { new_selection = new_selection->getPreviousOpenNode(FALSE); } @@ -1919,7 +1946,7 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { if (getListener()->getUUID().notNull()) { - LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } else { |