diff options
author | Mike Antipov <mantipov@productengine.com> | 2010-01-15 20:18:22 +0200 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2010-01-15 20:18:22 +0200 |
commit | c3c0b5ed47589b1074c42aff59cb33b97b62e0a1 (patch) | |
tree | ac1d9aab8f1861fed1d77930035dc5476b529a9c | |
parent | 0a5d6198ced40ad5f181628fcf6740161114ad42 (diff) |
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
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.h | 12 |
3 files changed, 30 insertions, 1 deletions
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<AddFavoriteLandmarkCallback> cb = new AddFavoriteLandmarkCallback(); + LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(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<LLInventoryCallback>(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); |