diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-08-02 09:45:59 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-08-02 09:45:59 -0700 |
commit | a87b27c41ddef15fa4027549c38b0129107ff9f6 (patch) | |
tree | 980583c52a68f94742abe157a3947e1a0a1d343c /indra/llui/llfolderview.cpp | |
parent | 1d6957ce09f92df6c0766162de1a84547f40e3bd (diff) | |
parent | 4cb1e766fcfcaba702c2638f4c7daa9dd17bcbd8 (diff) |
merging of latest code
Diffstat (limited to 'indra/llui/llfolderview.cpp')
-rw-r--r-- | indra/llui/llfolderview.cpp | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 0c1ed2aab9..5c421976b5 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -717,33 +717,6 @@ void LLFolderView::closeRenamer( void ) } } -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::removeSelectedItems() { if(getVisible() && getEnabled()) @@ -815,7 +788,7 @@ void LLFolderView::removeSelectedItems() if (!new_selection) { new_selection = last_item->getPreviousOpenNode(FALSE); - while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items))) + while (new_selection && (new_selection->isInSelection())) { new_selection = new_selection->getPreviousOpenNode(FALSE); } @@ -1060,16 +1033,42 @@ void LLFolderView::cut() if(getVisible() && getEnabled() && (count > 0)) { LLFolderViewModelItem* listener = NULL; + + LLFolderViewItem* last_item = *mSelectedItems.rbegin();; + LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); + while(new_selection && new_selection->isSelected()) + { + new_selection = new_selection->getNextOpenNode(FALSE); + } + if (!new_selection) + { + new_selection = last_item->getPreviousOpenNode(FALSE); + while (new_selection && (new_selection->isInSelection())) + { + new_selection = new_selection->getPreviousOpenNode(FALSE); + } + } + selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { - listener = (*item_it)->getViewModelItem(); + LLFolderViewItem* item_to_cut = *item_it; + listener = item_to_cut->getViewModelItem(); if(listener) { listener->cutToClipboard(); listener->removeItem(); } } + + if (new_selection) + { + setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); + } + else + { + setSelection(NULL, mParentPanel->hasFocus()); + } } mSearchString.clear(); } |