From c3c0b5ed47589b1074c42aff59cb33b97b62e0a1 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 15 Jan 2010 20:18:22 +0200 Subject: Fixed normal bug EXT-4312 (Landmark occupy random location in the 'Favorites Bar' accordion if drag-and-drop it) -- added LLInventoryCallback to rearrange favorite landmarks properly after new on is added. --HG-- branch : product-engine --- indra/newview/llinventorybridge.cpp | 12 +++++++++++- indra/newview/llviewerinventory.cpp | 7 +++++++ indra/newview/llviewerinventory.h | 12 ++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a68a7b7aa2..099f863dc9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3024,13 +3024,23 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if (favorites_id == mUUID) // if target is the favorites folder we use copy { + // use callback to rearrange favorite landmarks after adding + // to have new one placed before target (on which it was dropped). See EXT-4312. + LLPointer cb = new AddFavoriteLandmarkCallback(); + LLInventoryPanel* panel = dynamic_cast(mInventoryPanel.get()); + LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL; + if (drag_over_item && drag_over_item->getListener()) + { + cb.get()->setTargetLandmarkId(drag_over_item->getListener()->getUUID()); + } + copy_inventory_item( gAgent.getID(), inv_item->getPermissions().getOwner(), inv_item->getUUID(), mUUID, std::string(), - LLPointer(NULL)); + cb); } else if (move_is_into_current_outfit || move_is_into_outfit) { diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5605f425e0..3bed2d36c2 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -823,6 +823,13 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) gFloaterView->adjustToFitScreen(preview, FALSE); } +void AddFavoriteLandmarkCallback::fire(const LLUUID& inv_item_id) +{ + if (mTargetLandmarkId.isNull()) return; + + gInventory.rearrangeFavoriteLandmarks(inv_item_id, mTargetLandmarkId); +} + LLInventoryCallbackManager gInventoryCallbacks; void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 412a2c66e6..c4b7fdaa23 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -279,6 +279,18 @@ public: void fire(const LLUUID& inv_item); }; +class AddFavoriteLandmarkCallback : public LLInventoryCallback +{ +public: + AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {} + void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; } + +private: + void fire(const LLUUID& inv_item); + + LLUUID mTargetLandmarkId; +}; + // misc functions //void inventory_reliable_callback(void**, S32 status); -- cgit v1.2.3