summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-08-02 20:45:52 -0700
committerRichard Linden <none@none>2012-08-02 20:45:52 -0700
commitfaac868b682360df1bf461624667cc6e0bbdd8c6 (patch)
tree7daafcbef279754acae7d62d5a88513437e37b5d /indra
parent88e81f99293c992944787289699bf885568bf327 (diff)
CHUI-223 FIX Selecting to cut an inventory item causes all open inventory windows to refresh
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfolderview.cpp95
-rw-r--r--indra/llui/llfolderview.h10
-rw-r--r--indra/newview/llinventorypanel.cpp22
3 files changed, 56 insertions, 71 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 5d98dc9663..fb09f7f0aa 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -749,28 +749,18 @@ void LLFolderView::removeSelectedItems()
// iterate through the new container.
count = items.size();
LLUUID new_selection_id;
+ LLFolderViewItem* item_to_select = getNextUnselectedItem();
+
if(count == 1)
{
LLFolderViewItem* item_to_delete = items[0];
LLFolderViewFolder* parent = item_to_delete->getParentFolder();
- LLFolderViewItem* new_selection = item_to_delete->getNextOpenNode(FALSE);
- if (!new_selection)
- {
- new_selection = item_to_delete->getPreviousOpenNode(FALSE);
- }
if(parent)
{
if (item_to_delete->remove())
{
// change selection on successful delete
- if (new_selection)
- {
- getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
- }
- else
- {
- getRoot()->setSelection(NULL, mParentPanel->hasFocus());
- }
+ setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
}
}
arrangeAll();
@@ -779,28 +769,8 @@ void LLFolderView::removeSelectedItems()
{
LLDynamicArray<LLFolderViewModelItem*> listeners;
LLFolderViewModelItem* listener;
- LLFolderViewItem* last_item = items[count - 1];
- 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);
- }
- }
- if (new_selection)
- {
- getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
- }
- else
- {
- getRoot()->setSelection(NULL, mParentPanel->hasFocus());
- }
+
+ setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
for(S32 i = 0; i < count; ++i)
{
@@ -1032,28 +1002,13 @@ void LLFolderView::cut()
S32 count = mSelectedItems.size();
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);
- }
- }
+ LLFolderViewItem* item_to_select = getNextUnselectedItem();
selected_items_t::iterator item_it;
for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
{
LLFolderViewItem* item_to_cut = *item_it;
- listener = item_to_cut->getViewModelItem();
+ LLFolderViewModelItem* listener = item_to_cut->getViewModelItem();
if(listener)
{
listener->cutToClipboard();
@@ -1061,14 +1016,7 @@ void LLFolderView::cut()
}
}
- if (new_selection)
- {
- setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus());
- }
- else
- {
- setSelection(NULL, mParentPanel->hasFocus());
- }
+ setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
}
mSearchString.clear();
}
@@ -1274,12 +1222,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
if (next->isSelected())
{
// shrink selection
- getRoot()->changeSelection(last_selected, FALSE);
+ changeSelection(last_selected, FALSE);
}
else if (last_selected->getParentFolder() == next->getParentFolder())
{
// grow selection
- getRoot()->changeSelection(next, TRUE);
+ changeSelection(next, TRUE);
}
}
}
@@ -1338,12 +1286,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
if (prev->isSelected())
{
// shrink selection
- getRoot()->changeSelection(last_selected, FALSE);
+ changeSelection(last_selected, FALSE);
}
else if (last_selected->getParentFolder() == prev->getParentFolder())
{
// grow selection
- getRoot()->changeSelection(prev, TRUE);
+ changeSelection(prev, TRUE);
}
}
}
@@ -2083,3 +2031,22 @@ S32 LLFolderView::getItemHeight()
}
return 0;
}
+
+LLFolderViewItem* LLFolderView::getNextUnselectedItem()
+{
+ 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);
+ }
+ }
+ return new_selection;
+}
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 05beff9bd8..81b0f087e8 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -172,17 +172,19 @@ public:
BOOL isOpen() const { return TRUE; } // root folder always open
// Copy & paste
- virtual void copy();
virtual BOOL canCopy() const;
+ virtual void copy();
- virtual void cut();
virtual BOOL canCut() const;
+ virtual void cut();
- virtual void paste();
virtual BOOL canPaste() const;
+ virtual void paste();
- virtual void doDelete();
virtual BOOL canDoDelete() const;
+ virtual void doDelete();
+
+ LLFolderViewItem* getNextUnselectedItem();
// Public rename functionality - can only start the process
void startRenamingSelectedItem( void );
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 9403ccdabe..b02d08955f 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -604,9 +604,25 @@ void LLInventoryPanel::idle(void* user_data)
if (panel->mClipboardState != LLClipboard::instance().getGeneration())
{
panel->mClipboardState = LLClipboard::instance().getGeneration();
- panel->getFilter().setModified(LLClipboard::instance().isCutMode()
- ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE
- : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
+ if (LLClipboard::instance().isCutMode())
+ {
+ LLDynamicArray<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+
+ for (LLDynamicArray<LLUUID>::iterator it = objects.begin(), end_it = objects.end();
+ it != end_it;
+ ++it)
+ {
+ LLFolderViewItem* item = panel->getItemByID(*it);
+ if (item)
+ {
+ item->getViewModelItem()->dirtyFilter();
+ }
+ }
+ /*panel->getFilter().setModified(LLClipboard::instance().isCutMode()
+ ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE
+ : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);*/
+ }
}
panel->mFolderRoot->update();