summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-04-09 11:50:32 +0300
committerMike Antipov <mantipov@productengine.com>2010-04-09 11:50:32 +0300
commit5c797555b3293f0fac20ae5ba27a2bfd6c732215 (patch)
treec8d75cbd725e8575ae7215fa2c75977708ff07f1 /indra/newview
parent6d78a90636ecd0d6bf8266c3020cc31d7f233052 (diff)
Fixed normal bug EXT-6747 ('Favorites bar' folder became blank after part of landmarks were deleted by DnD on Trash button)
Reason: LLFolderView::removeSelectedItems() was used to delete dropped items in Places Landmarks Panel. This led to calling this method N times where N is count of selected items. Due to removeSelectedItems() select one of non-removed items each time after removing of selected ones (2*N - 1) items were really deleted. Fix: updated removing in Landmarks panel to remove dropped items one by one. Reviewed by Richard at https://codereview.productengine.com/secondlife/r/204/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanellandmarks.cpp19
-rw-r--r--indra/newview/llpanellandmarks.h2
2 files changed, 18 insertions, 3 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index a1cdbdad59..67d40a39b1 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -675,6 +675,7 @@ void LLLandmarksPanel::initListCommandsHandlers()
trash_btn->setDragAndDropHandler(boost::bind(&LLLandmarksPanel::handleDragAndDropToTrash, this
, _4 // BOOL drop
, _5 // EDragAndDropType cargo_type
+ , _6 // void* cargo_data
, _7 // EAcceptance* accept
));
@@ -1109,7 +1110,7 @@ void LLLandmarksPanel::onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* own
pick_panel = NULL;
}
-bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
+bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept)
{
*accept = ACCEPT_NO;
@@ -1125,7 +1126,21 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg
if (is_enabled && drop)
{
- onClipboardAction("delete");
+ // don't call onClipboardAction("delete")
+ // this lead to removing (N * 2 - 1) items if drag N>1 items into trash. EXT-6757
+ // So, let remove items one by one.
+ LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data);
+ if (item)
+ {
+ LLFolderViewItem* fv_item = (mCurrentSelectedList && mCurrentSelectedList->getRootFolder()) ?
+ mCurrentSelectedList->getRootFolder()->getItemByID(item->getUUID()) : NULL;
+
+ if (fv_item)
+ {
+ // is Item Removable checked inside of remove()
+ fv_item->remove();
+ }
+ }
}
}
break;
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index da5d683cfc..2d1eb0f091 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -142,7 +142,7 @@ private:
/**
* Processes drag-n-drop of the Landmarks and folders into trash button.
*/
- bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
+ bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept);
/**
* Landmark actions callbacks. Fire when a landmark is loaded from the list.