diff options
author | Andrew Polunin <apolunin@productengine.com> | 2009-10-27 18:38:18 +0200 |
---|---|---|
committer | Andrew Polunin <apolunin@productengine.com> | 2009-10-27 18:38:18 +0200 |
commit | 0a1d9175f2cf30b8e6dd67a3ea6a30dffdd8bde2 (patch) | |
tree | 97729285068fe8692c3614e353417d09f3e0ec57 | |
parent | 606488d1df9f5eae093a1864d49f2eef3029b9dc (diff) | |
parent | d8802ba0fd7ac65d240070ec5e7d17afbcd9e196 (diff) |
merge
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llfavoritesbar.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llfavoritesbar.h | 2 |
2 files changed, 22 insertions, 12 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 3b5b7f570e..a6afbc05be 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -503,13 +503,15 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con return; } + LLPointer<LLViewerInventoryItem> viewer_item = new LLViewerInventoryItem(item); + if (dest) { - insertBeforeItem(mItems, dest->getLandmarkId(), item->getUUID()); + insertBeforeItem(mItems, dest->getLandmarkId(), viewer_item); } else { - mItems.push_back(gInventory.getItem(item->getUUID())); + mItems.push_back(viewer_item); } int sortField = 0; @@ -534,13 +536,22 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con } } - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - favorites_id, - std::string(), - cb); + LLToolDragAndDrop* tool_dad = LLToolDragAndDrop::getInstance(); + if (tool_dad->getSource() == LLToolDragAndDrop::SOURCE_NOTECARD) + { + viewer_item->setType(LLAssetType::AT_FAVORITE); + copy_inventory_from_notecard(tool_dad->getObjectID(), tool_dad->getSourceID(), viewer_item.get(), gInventoryCallbacks.registerCB(cb)); + } + else + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + favorites_id, + std::string(), + cb); + } llinfos << "Copied inventory item #" << item->getUUID() << " to favorites." << llendl; } @@ -1263,10 +1274,9 @@ void LLFavoritesBarCtrl::updateItemsOrder(LLInventoryModel::item_array_t& items, items.insert(findItemByUUID(items, destItem->getUUID()), srcItem); } -void LLFavoritesBarCtrl::insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, const LLUUID& insertedItemId) +void LLFavoritesBarCtrl::insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, LLViewerInventoryItem* insertedItem) { LLViewerInventoryItem* beforeItem = gInventory.getItem(beforeItemId); - LLViewerInventoryItem* insertedItem = gInventory.getItem(insertedItemId); items.insert(findItemByUUID(items, beforeItem->getUUID()), insertedItem); } diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index ea2a3d08e2..e90d13f9d5 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -141,7 +141,7 @@ private: * inserts an item identified by insertedItemId BEFORE an item identified by beforeItemId. * this function assumes that an item identified by insertedItemId doesn't exist in items array. */ - void insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, const LLUUID& insertedItemId); + void insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, LLViewerInventoryItem* insertedItem); // finds an item by it's UUID in the items array LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id); |