From db824cff75696c42fff80ba29dbb60f12d10a1da Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 3 Feb 2012 18:38:03 -0800 Subject: EXP-1862 : Suppress LLInventoryClipboard, move its functions to the unified LLClipboard and use this only --- indra/newview/llinventorybridge.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 869cb735d5..420b834933 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -47,7 +47,7 @@ #include "llgiveinventory.h" #include "llimfloater.h" #include "llimview.h" -#include "llinventoryclipboard.h" +#include "llclipboard.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" @@ -212,7 +212,7 @@ void LLInvFVBridge::cutToClipboard() { if(isItemMovable()) { - LLInventoryClipboard::instance().cut(mUUID); + LLClipboard::getInstance()->cut(mUUID); } } // *TODO: make sure this does the right thing @@ -397,7 +397,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArrayhasContents() || !isAgentInventory()) { return FALSE; } @@ -410,7 +410,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const const LLUUID &agent_id = gAgent.getID(); LLDynamicArray objects; - LLInventoryClipboard::instance().retrieve(objects); + LLClipboard::getInstance()->retrieve(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -437,7 +437,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const BOOL LLInvFVBridge::isClipboardPasteableAsLink() const { - if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory()) + if (!LLClipboard::getInstance()->hasContents() || !isAgentInventory()) { return FALSE; } @@ -448,7 +448,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } LLDynamicArray objects; - LLInventoryClipboard::instance().retrieve(objects); + LLClipboard::getInstance()->retrieve(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -1663,7 +1663,7 @@ BOOL LLItemBridge::copyToClipboard() const { if(isItemCopyable()) { - LLInventoryClipboard::instance().add(mUUID); + LLClipboard::getInstance()->add(mUUID); return TRUE; } return FALSE; @@ -1775,7 +1775,7 @@ BOOL LLFolderBridge::copyToClipboard() const { if(isItemCopyable()) { - LLInventoryClipboard::instance().add(mUUID); + LLClipboard::getInstance()->add(mUUID); return TRUE; } return FALSE; @@ -1796,7 +1796,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const } LLDynamicArray objects; - LLInventoryClipboard::instance().retrieve(objects); + LLClipboard::getInstance()->retrieve(objects); const LLViewerInventoryCategory *current_cat = getCategory(); // Search for the direct descendent of current Friends subfolder among all pasted items, @@ -1834,7 +1834,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); LLDynamicArray objects; - LLInventoryClipboard::instance().retrieve(objects); + LLClipboard::getInstance()->retrieve(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -2825,7 +2825,7 @@ void LLFolderBridge::pasteFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray objects; - LLInventoryClipboard::instance().retrieve(objects); + LLClipboard::getInstance()->retrieve(objects); for (LLDynamicArray::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) @@ -2841,7 +2841,7 @@ void LLFolderBridge::pasteFromClipboard() dropToOutfit(item, move_is_into_current_outfit); } } - else if(LLInventoryClipboard::instance().isCutMode()) + else if (LLClipboard::getInstance()->isCutMode()) { // move_inventory_item() is not enough, //we have to update inventory locally too @@ -2879,7 +2879,7 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray objects; - LLInventoryClipboard::instance().retrieve(objects); + LLClipboard::getInstance()->retrieve(objects); for (LLDynamicArray::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) -- cgit v1.2.3 From 9761375ac244af36635899c73e99efc46b68b589 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 6 Feb 2012 15:43:53 -0800 Subject: EXP-1841 : Refactoring of LLClipboard, simplify the API and make it behave like a normal clipboard. --- indra/newview/llinventorybridge.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 420b834933..14f1bb9d41 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -409,6 +409,9 @@ BOOL LLInvFVBridge::isClipboardPasteable() const const LLUUID &agent_id = gAgent.getID(); + // Merov : This should be suppressed for 2 reasons: + // 1. folders should be pastable + // 2. when pasting, we should paste what is authorized and let the rest not pasted LLDynamicArray objects; LLClipboard::getInstance()->retrieve(objects); S32 count = objects.count(); -- cgit v1.2.3 From c744603af9b53c6bc73fefbd56de68cf2778ed70 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 7 Feb 2012 17:13:24 -0800 Subject: EXP-1873 : Implement cut in the inventory contextual menu. Works without deleting the items but simply dimming them and moving them. Doesn't work for folders yet. --- indra/newview/llinventorybridge.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 14f1bb9d41..7ba914eaf6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -210,7 +210,7 @@ BOOL LLInvFVBridge::isLink() const */ void LLInvFVBridge::cutToClipboard() { - if(isItemMovable()) + if (isItemMovable() && isItemRemovable()) { LLClipboard::getInstance()->cut(mUUID); } @@ -602,6 +602,12 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Copy")); } + items.push_back(std::string("Cut")); + if (!isItemMovable() || !isItemRemovable()) + { + disabled_items.push_back(std::string("Cut")); + } + if (canListOnMarketplace()) { items.push_back(std::string("Marketplace Separator")); @@ -1281,6 +1287,11 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer)); return; } + else if ("cut" == action) + { + cutToClipboard(); + return; + } else if ("copy" == action) { copyToClipboard(); @@ -2608,6 +2619,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) modifyOutfit(TRUE); return; } + else if ("cut" == action) + { + cutToClipboard(); + return; + } else if ("copy" == action) { copyToClipboard(); @@ -2867,6 +2883,8 @@ void LLFolderBridge::pasteFromClipboard() } } } + // Change mode to paste for next paste + LLClipboard::getInstance()->setCutMode(false); } } @@ -2920,6 +2938,8 @@ void LLFolderBridge::pasteLinkFromClipboard() LLPointer(NULL)); } } + // Change mode to paste for next paste + LLClipboard::getInstance()->setCutMode(false); } } -- cgit v1.2.3 From ee3c3c15b714f8f68e98a2d4064afaec665bd64a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 7 Feb 2012 22:46:04 -0800 Subject: EXP-1841 : Final deep scrub on LLClipboard API, clean up the use of copy and cut everywhere. --- indra/newview/llinventorybridge.cpp | 52 ++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 29 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7ba914eaf6..9775e54d6a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -208,13 +208,27 @@ BOOL LLInvFVBridge::isLink() const /** * @brief Adds this item into clipboard storage */ -void LLInvFVBridge::cutToClipboard() +BOOL LLInvFVBridge::cutToClipboard() const { - if (isItemMovable() && isItemRemovable()) + LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); + if (inv_item && isItemMovable() && isItemRemovable()) { - LLClipboard::getInstance()->cut(mUUID); + LLClipboard::getInstance()->setCutMode(true); + return LLClipboard::getInstance()->addToClipboard(mUUID,inv_item->getType()); } + return FALSE; } + +BOOL LLInvFVBridge::copyToClipboard() const +{ + LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); + if (inv_item && isItemCopyable()) + { + return LLClipboard::getInstance()->addToClipboard(mUUID,inv_item->getType()); + } + return FALSE; +} + // *TODO: make sure this does the right thing void LLInvFVBridge::showProperties() { @@ -413,7 +427,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const // 1. folders should be pastable // 2. when pasting, we should paste what is authorized and let the rest not pasted LLDynamicArray objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -451,7 +465,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } LLDynamicArray objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -1673,16 +1687,6 @@ BOOL LLItemBridge::isItemCopyable() const return FALSE; } -BOOL LLItemBridge::copyToClipboard() const -{ - if(isItemCopyable()) - { - LLClipboard::getInstance()->add(mUUID); - return TRUE; - } - return FALSE; -} - LLViewerInventoryItem* LLItemBridge::getItem() const { LLViewerInventoryItem* item = NULL; @@ -1785,16 +1789,6 @@ BOOL LLFolderBridge::isItemCopyable() const return gSavedSettings.getBOOL("InventoryLinking"); } -BOOL LLFolderBridge::copyToClipboard() const -{ - if(isItemCopyable()) - { - LLClipboard::getInstance()->add(mUUID); - return TRUE; - } - return FALSE; -} - BOOL LLFolderBridge::isClipboardPasteable() const { if ( ! LLInvFVBridge::isClipboardPasteable() ) @@ -1810,7 +1804,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const } LLDynamicArray objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); const LLViewerInventoryCategory *current_cat = getCategory(); // Search for the direct descendent of current Friends subfolder among all pasted items, @@ -1848,7 +1842,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); LLDynamicArray objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -2844,7 +2838,7 @@ void LLFolderBridge::pasteFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); for (LLDynamicArray::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) @@ -2900,7 +2894,7 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); for (LLDynamicArray::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) -- cgit v1.2.3 From 2a4aa438f5798c34f1eef3ef75dc3289492138e1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 9 Feb 2012 23:37:24 -0800 Subject: EXP-1863 : Implemented cut, copy, paste for folders. Issues with folder filtering though. --- indra/newview/llinventorybridge.cpp | 82 +++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 31 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9775e54d6a..1fa6820d2d 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -210,21 +210,21 @@ BOOL LLInvFVBridge::isLink() const */ BOOL LLInvFVBridge::cutToClipboard() const { - LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); - if (inv_item && isItemMovable() && isItemRemovable()) + const LLInventoryObject* obj = gInventory.getObject(mUUID); + if (obj && isItemMovable() && isItemRemovable()) { LLClipboard::getInstance()->setCutMode(true); - return LLClipboard::getInstance()->addToClipboard(mUUID,inv_item->getType()); + return LLClipboard::getInstance()->addToClipboard(mUUID,obj->getType()); } return FALSE; } BOOL LLInvFVBridge::copyToClipboard() const { - LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); - if (inv_item && isItemCopyable()) + const LLInventoryObject* obj = gInventory.getObject(mUUID); + if (obj && isItemCopyable()) { - return LLClipboard::getInstance()->addToClipboard(mUUID,inv_item->getType()); + return LLClipboard::getInstance()->addToClipboard(mUUID,obj->getType()); } return FALSE; } @@ -423,9 +423,6 @@ BOOL LLInvFVBridge::isClipboardPasteable() const const LLUUID &agent_id = gAgent.getID(); - // Merov : This should be suppressed for 2 reasons: - // 1. folders should be pastable - // 2. when pasting, we should paste what is authorized and let the rest not pasted LLDynamicArray objects; LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); @@ -433,12 +430,9 @@ BOOL LLInvFVBridge::isClipboardPasteable() const { const LLUUID &item_id = objects.get(i); - // Can't paste folders + // Always paste folders const LLInventoryCategory *cat = model->getCategory(item_id); - if (cat) - { - return FALSE; - } + if (cat) continue; const LLInventoryItem *item = model->getItem(item_id); if (item) @@ -1313,7 +1307,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) } else if ("paste" == action) { - // Single item only LLInventoryItem* itemp = model->getItem(mUUID); if (!itemp) return; @@ -1785,8 +1778,9 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { + return TRUE; // Can copy folders to paste-as-link, but not for straight paste. - return gSavedSettings.getBOOL("InventoryLinking"); + //return gSavedSettings.getBOOL("InventoryLinking"); } BOOL LLFolderBridge::isClipboardPasteable() const @@ -2829,7 +2823,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re void LLFolderBridge::pasteFromClipboard() { LLInventoryModel* model = getInventoryModel(); - if(model && isClipboardPasteable()) + if (model && isClipboardPasteable()) { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); @@ -2845,7 +2839,8 @@ void LLFolderBridge::pasteFromClipboard() { const LLUUID& item_id = (*iter); LLInventoryItem *item = model->getItem(item_id); - if (item) + LLInventoryObject *obj = model->getObject(item_id); + if (obj) { if (move_is_into_current_outfit || move_is_into_outfit) { @@ -2856,24 +2851,49 @@ void LLFolderBridge::pasteFromClipboard() } else if (LLClipboard::getInstance()->isCutMode()) { - // move_inventory_item() is not enough, - //we have to update inventory locally too - LLViewerInventoryItem* viitem = dynamic_cast(item); - llassert(viitem); - if (viitem) + // Do a move to "paste" a "cut" + // move_inventory_item() is not enough, as we have to update inventory locally too + if (LLAssetType::AT_CATEGORY == obj->getType()) { - changeItemParent(model, viitem, parent_id, FALSE); + LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); + llassert(vicat); + if (vicat) + { + changeCategoryParent(model, vicat, parent_id, FALSE); + } + } + else + { + LLViewerInventoryItem* viitem = dynamic_cast(item); + llassert(viitem); + if (viitem) + { + changeItemParent(model, viitem, parent_id, FALSE); + } } } else { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - parent_id, - std::string(), - LLPointer(NULL)); + // Do a "copy" to "paste" a regular copy clipboard + if (LLAssetType::AT_CATEGORY == obj->getType()) + { + LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); + llassert(vicat); + if (vicat) + { + copy_inventory_category(model, vicat, parent_id); + } + } + else + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + parent_id, + std::string(), + LLPointer(NULL)); + } } } } -- cgit v1.2.3 From 632c8c138c94fae24729ef75ac29967cd4758eb3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 13 Feb 2012 10:09:33 -0800 Subject: EXP-1863 : Add comment and dead code cleanup --- indra/newview/llinventorybridge.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1fa6820d2d..eb0f9803b0 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1778,9 +1778,9 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { + // Folders are always copyable as they have no permissions attached to them as items. + // The story is different of course for items within folders. return TRUE; - // Can copy folders to paste-as-link, but not for straight paste. - //return gSavedSettings.getBOOL("InventoryLinking"); } BOOL LLFolderBridge::isClipboardPasteable() const -- cgit v1.2.3 From bb6ace0672fa5e1c47c534ba74396ef04daa408b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 17 Feb 2012 14:42:12 -0800 Subject: EXP-1902, EXP-1903 : Move items cut to the trash when clipboard reset. --- indra/newview/llinventorybridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index eb0f9803b0..54d195a2e6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -213,7 +213,7 @@ BOOL LLInvFVBridge::cutToClipboard() const const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemMovable() && isItemRemovable()) { - LLClipboard::getInstance()->setCutMode(true); + LLClipboard::getInstance()->setCutMode(true, boost::bind(LLFolderView::removeCutItems)); return LLClipboard::getInstance()->addToClipboard(mUUID,obj->getType()); } return FALSE; -- cgit v1.2.3 From 39e9a17c11d84d65645f2664b077438e9be1d449 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 17 Feb 2012 16:57:29 -0800 Subject: EXP-1894 : Fix the handling of no-copy items on the clipboard (can cut, can paste once but not twice and cannot copy). Also work on folders with no-copy items. --- indra/newview/llinventorybridge.cpp | 54 +++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 14 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 54d195a2e6..9fcad8093c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -421,8 +421,6 @@ BOOL LLInvFVBridge::isClipboardPasteable() const return FALSE; } - const LLUUID &agent_id = gAgent.getID(); - LLDynamicArray objects; LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); @@ -430,18 +428,21 @@ BOOL LLInvFVBridge::isClipboardPasteable() const { const LLUUID &item_id = objects.get(i); - // Always paste folders + // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); - if (cat) continue; - - const LLInventoryItem *item = model->getItem(item_id); - if (item) + if (cat) { - if (!item->getPermissions().allowCopyBy(agent_id)) - { + LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id); + if (!cat_br.isItemCopyable()) return FALSE; - } + // Skip to the next item in the clipboard + continue; } + + // Each item must be copyable to be pastable + LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id); + if (!item_br.isItemCopyable()) + return FALSE; } return TRUE; } @@ -634,7 +635,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { items.push_back(std::string("Paste")); } - if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0)) + if ((!LLClipboard::getInstance()->isCutMode() && !isClipboardPasteable()) || ((flags & FIRST_SELECTED_ITEM) == 0)) { disabled_items.push_back(std::string("Paste")); } @@ -1778,8 +1779,33 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { - // Folders are always copyable as they have no permissions attached to them as items. - // The story is different of course for items within folders. + // Folders are copyable if items in them are, recursively, copyable. + + // Get the content of the folder + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array); + + // Check the items + LLInventoryModel::item_array_t item_array_copy = *item_array; + for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) + { + LLInventoryItem* item = *iter; + LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID()); + if (!item_br.isItemCopyable()) + return FALSE; + } + + // Check the folders + LLInventoryModel::cat_array_t cat_array_copy = *cat_array; + for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) + { + LLViewerInventoryCategory* category = *iter; + LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID()); + if (!cat_br.isItemCopyable()) + return FALSE; + } + return TRUE; } @@ -2823,7 +2849,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re void LLFolderBridge::pasteFromClipboard() { LLInventoryModel* model = getInventoryModel(); - if (model && isClipboardPasteable()) + if (model && (isClipboardPasteable() || LLClipboard::getInstance()->isCutMode())) { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); -- cgit v1.2.3 From 2fdb18971b01bb9026e2918b79993f0a2629994b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 17 Feb 2012 17:43:54 -0800 Subject: EXP-1897 : Suppress the copy of UUID on text clipboard when copy/cut items (back to old behavior). --- indra/newview/llinventorybridge.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9fcad8093c..cac1dbfe4a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -214,7 +214,7 @@ BOOL LLInvFVBridge::cutToClipboard() const if (obj && isItemMovable() && isItemRemovable()) { LLClipboard::getInstance()->setCutMode(true, boost::bind(LLFolderView::removeCutItems)); - return LLClipboard::getInstance()->addToClipboard(mUUID,obj->getType()); + return LLClipboard::getInstance()->addToClipboard(mUUID); } return FALSE; } @@ -224,7 +224,7 @@ BOOL LLInvFVBridge::copyToClipboard() const const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemCopyable()) { - return LLClipboard::getInstance()->addToClipboard(mUUID,obj->getType()); + return LLClipboard::getInstance()->addToClipboard(mUUID); } return FALSE; } -- cgit v1.2.3 From af83268a7b45ed6f5ee785e1671b0212d20ef47a Mon Sep 17 00:00:00 2001 From: paulgproductengine Date: Thu, 23 Feb 2012 19:51:43 +0200 Subject: EXP-1908 FIXED (Gesture floater is not refreshed when deleting more then one gesture from Inventory) - Updating moved items, to update model's modify mask. --- indra/newview/llinventorybridge.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index daebfb5c86..724c9133a7 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -389,6 +389,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArrayupdateItem(gInventory.getItem(*it)); } // notify inventory observers. -- cgit v1.2.3 From f0a1b43f2270cb8424409babf5ae88233cdd8f6c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 1 Mar 2012 21:35:05 -0800 Subject: EXP-1841 : Use instance instead of getInstance on LLClipboard singleton. --- indra/newview/llinventorybridge.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d55fb6a089..3001a998aa 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -220,8 +220,8 @@ BOOL LLInvFVBridge::cutToClipboard() const const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemMovable() && isItemRemovable()) { - LLClipboard::getInstance()->setCutMode(true, boost::bind(LLFolderView::removeCutItems)); - return LLClipboard::getInstance()->addToClipboard(mUUID); + LLClipboard::instance().setCutMode(true, boost::bind(LLFolderView::removeCutItems)); + return LLClipboard::instance().addToClipboard(mUUID); } return FALSE; } @@ -231,7 +231,7 @@ BOOL LLInvFVBridge::copyToClipboard() const const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemCopyable()) { - return LLClipboard::getInstance()->addToClipboard(mUUID); + return LLClipboard::instance().addToClipboard(mUUID); } return FALSE; } @@ -419,7 +419,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArrayhasContents() || !isAgentInventory()) + if (!LLClipboard::instance().hasContents() || !isAgentInventory()) { return FALSE; } @@ -430,7 +430,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const } LLDynamicArray objects; - LLClipboard::getInstance()->pasteFromClipboard(objects); + LLClipboard::instance().pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -457,7 +457,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const BOOL LLInvFVBridge::isClipboardPasteableAsLink() const { - if (!LLClipboard::getInstance()->hasContents() || !isAgentInventory()) + if (!LLClipboard::instance().hasContents() || !isAgentInventory()) { return FALSE; } @@ -468,7 +468,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } LLDynamicArray objects; - LLClipboard::getInstance()->pasteFromClipboard(objects); + LLClipboard::instance().pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -643,7 +643,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { items.push_back(std::string("Paste")); } - if ((!LLClipboard::getInstance()->isCutMode() && !isClipboardPasteable()) || ((flags & FIRST_SELECTED_ITEM) == 0)) + if ((!LLClipboard::instance().isCutMode() && !isClipboardPasteable()) || ((flags & FIRST_SELECTED_ITEM) == 0)) { disabled_items.push_back(std::string("Paste")); } @@ -1833,7 +1833,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const } LLDynamicArray objects; - LLClipboard::getInstance()->pasteFromClipboard(objects); + LLClipboard::instance().pasteFromClipboard(objects); const LLViewerInventoryCategory *current_cat = getCategory(); // Search for the direct descendent of current Friends subfolder among all pasted items, @@ -1871,7 +1871,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); LLDynamicArray objects; - LLClipboard::getInstance()->pasteFromClipboard(objects); + LLClipboard::instance().pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -2910,7 +2910,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re void LLFolderBridge::pasteFromClipboard() { LLInventoryModel* model = getInventoryModel(); - if (model && (isClipboardPasteable() || LLClipboard::getInstance()->isCutMode())) + if (model && (isClipboardPasteable() || LLClipboard::instance().isCutMode())) { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); @@ -2920,7 +2920,7 @@ void LLFolderBridge::pasteFromClipboard() const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); LLDynamicArray objects; - LLClipboard::getInstance()->pasteFromClipboard(objects); + LLClipboard::instance().pasteFromClipboard(objects); if (move_is_into_outbox) { @@ -2980,7 +2980,7 @@ void LLFolderBridge::pasteFromClipboard() dropToOutfit(item, move_is_into_current_outfit); } } - else if (LLClipboard::getInstance()->isCutMode()) + else if (LLClipboard::instance().isCutMode()) { // Do a move to "paste" a "cut" // move_inventory_item() is not enough, as we have to update inventory locally too @@ -3029,7 +3029,7 @@ void LLFolderBridge::pasteFromClipboard() } } // Change mode to paste for next paste - LLClipboard::getInstance()->setCutMode(false); + LLClipboard::instance().setCutMode(false); } } @@ -3054,7 +3054,7 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray objects; - LLClipboard::getInstance()->pasteFromClipboard(objects); + LLClipboard::instance().pasteFromClipboard(objects); for (LLDynamicArray::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) @@ -3093,7 +3093,7 @@ void LLFolderBridge::pasteLinkFromClipboard() } } // Change mode to paste for next paste - LLClipboard::getInstance()->setCutMode(false); + LLClipboard::instance().setCutMode(false); } } -- cgit v1.2.3 From 85d380b210ebb609f6fc273918e06007c9da1950 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 5 Mar 2012 20:03:21 -0800 Subject: EXP-1917 : Fix items coming back in folders when quit after cut. --- indra/newview/llinventorybridge.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3001a998aa..49eb8db5be 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -220,7 +220,7 @@ BOOL LLInvFVBridge::cutToClipboard() const const LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj && isItemMovable() && isItemRemovable()) { - LLClipboard::instance().setCutMode(true, boost::bind(LLFolderView::removeCutItems)); + LLClipboard::instance().setCutMode(true); return LLClipboard::instance().addToClipboard(mUUID); } return FALSE; @@ -1307,6 +1307,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); + LLFolderView::removeCutItems(); return; } else if ("copy" == action) @@ -2697,6 +2698,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); + LLFolderView::removeCutItems(); return; } else if ("copy" == action) -- cgit v1.2.3 From 4ffad9495cdf6f5d6577c4829628fc78bb32b817 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 9 Mar 2012 17:15:48 -0800 Subject: EXP-1915 : Disable copy/cut options for folders as long as all items in them are not present. --- indra/newview/llinventorybridge.cpp | 51 ++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 49eb8db5be..96785eb312 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -143,6 +143,21 @@ bool isMarketplaceSendAction(const std::string& action) return ("send_to_marketplace" == action); } +//Used by LLFolderBridge as callback for directory recursion. +class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver +{ +public: + LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids, + bool copy_items) : + LLInventoryFetchDescendentsObserver(ids), + mCopyItems(copy_items) + {} + ~LLRightClickInventoryFetchDescendentsObserver() {} + virtual void done(); +protected: + bool mCopyItems; +}; + // +=================================================+ // | LLInvFVBridge | // +=================================================+ @@ -1722,9 +1737,15 @@ LLHandle LLFolderBridge::sSelf; BOOL LLFolderBridge::isItemMovable() const { LLInventoryObject* obj = getInventoryObject(); - if(obj) + if (obj) { - return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())); + // If it's a protected type folder, we can't move it + if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())) + return FALSE; + // If the folder is not there yet, it's too early to decide if it's movable + if (!isUpToDate()) + return FALSE; + return TRUE; } return FALSE; } @@ -1759,6 +1780,10 @@ BOOL LLFolderBridge::isItemRemovable() const return FALSE; } + // If the folder is not there yet, we shouldn't try to remove it yet + if (!isUpToDate()) + return FALSE; + LLInventoryPanel* panel = mInventoryPanel.get(); LLFolderViewFolder* folderp = dynamic_cast(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL); if (folderp) @@ -1790,7 +1815,11 @@ BOOL LLFolderBridge::isUpToDate() const BOOL LLFolderBridge::isItemCopyable() const { // Folders are copyable if items in them are, recursively, copyable. - + + // If the folder is not there yet, it's not copyable + if (!isUpToDate()) + return FALSE; + // Get the content of the folder LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; @@ -2492,21 +2521,6 @@ protected: }; -//Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver -{ -public: - LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids, - bool copy_items) : - LLInventoryFetchDescendentsObserver(ids), - mCopyItems(copy_items) - {} - ~LLRightClickInventoryFetchDescendentsObserver() {} - virtual void done(); -protected: - bool mCopyItems; -}; - void LLRightClickInventoryFetchDescendentsObserver::done() { // Avoid passing a NULL-ref as mCompleteFolders.front() down to @@ -3358,6 +3372,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) inc_busy_count(); if (fetch->isFinished()) { + delete fetch; buildContextMenuFolderOptions(flags); } else -- cgit v1.2.3 From 0df0218329ce894afe3a27980a2862ac4a584be7 Mon Sep 17 00:00:00 2001 From: merov Date: Mon, 12 Mar 2012 17:21:32 -0700 Subject: EXP-1914 : Fix the evaluation of isClipboardPasteable() when the clipboard is in cut mode. --- indra/newview/llinventorybridge.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 96785eb312..060250cc07 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -434,6 +434,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray objects; LLClipboard::instance().pasteFromClipboard(objects); S32 count = objects.count(); @@ -658,7 +666,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { items.push_back(std::string("Paste")); } - if ((!LLClipboard::instance().isCutMode() && !isClipboardPasteable()) || ((flags & FIRST_SELECTED_ITEM) == 0)) + if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { disabled_items.push_back(std::string("Paste")); } @@ -2926,7 +2934,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re void LLFolderBridge::pasteFromClipboard() { LLInventoryModel* model = getInventoryModel(); - if (model && (isClipboardPasteable() || LLClipboard::instance().isCutMode())) + if (model && isClipboardPasteable()) { const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false); const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); -- cgit v1.2.3 From 1c51271d56c0332394fb23dc843aecf812f6f901 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 13 Mar 2012 15:05:51 +0200 Subject: CHUI-56 FIXED Fixed a crash when deleting multiple inventory folders. --- indra/newview/llinventorybridge.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ef58e4fa21..da85c81cf2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -396,7 +396,11 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArrayupdateItem(gInventory.getItem(*it)); + LLViewerInventoryItem* item = gInventory.getItem(*it); + if (item) + { + model->updateItem(item); + } } // notify inventory observers. -- cgit v1.2.3 From 82700548058527001657758888cf79df099064b3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 13 Mar 2012 21:08:10 -0700 Subject: EXP-1915 : Rewrote the fetching mechanism for folders making it truly recursive. --- indra/newview/llinventorybridge.cpp | 221 ++++++++++++++++++++---------------- 1 file changed, 126 insertions(+), 95 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 060250cc07..03f6a31c6d 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -143,19 +143,40 @@ bool isMarketplaceSendAction(const std::string& action) return ("send_to_marketplace" == action); } -//Used by LLFolderBridge as callback for directory recursion. +// Used by LLFolderBridge as callback for directory fetching recursion class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver { public: - LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids, - bool copy_items) : - LLInventoryFetchDescendentsObserver(ids), - mCopyItems(copy_items) - {} + LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : LLInventoryFetchDescendentsObserver(ids) {} ~LLRightClickInventoryFetchDescendentsObserver() {} - virtual void done(); -protected: - bool mCopyItems; + virtual void execute(bool clear_observer = false); + virtual void done() + { + execute(true); + } +}; + +// Used by LLFolderBridge as callback for directory content items fetching +class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver +{ +public: + LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : LLInventoryFetchItemsObserver(ids) { }; + ~LLRightClickInventoryFetchObserver() {} + void execute(bool clear_observer = false) + { + if (clear_observer) + { + dec_busy_count(); + gInventory.removeObserver(this); + delete this; + } + // we've downloaded all the items, so repaint the dialog + LLFolderBridge::staticFolderOptionsMenu(); + } + virtual void done() + { + execute(true); + } }; // +=================================================+ @@ -2499,106 +2520,114 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, return accept; } -//Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver +void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) { -public: - LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : - LLInventoryFetchItemsObserver(ids), - mCopyItems(false) - { }; - LLRightClickInventoryFetchObserver(const uuid_vec_t& ids, - const LLUUID& cat_id, - bool copy_items) : - LLInventoryFetchItemsObserver(ids), - mCatID(cat_id), - mCopyItems(copy_items) - { }; - virtual void done() - { - // we've downloaded all the items, so repaint the dialog - LLFolderBridge::staticFolderOptionsMenu(); - - gInventory.removeObserver(this); - delete this; - } - -protected: - LLUUID mCatID; - bool mCopyItems; - -}; - -void LLRightClickInventoryFetchDescendentsObserver::done() -{ - // Avoid passing a NULL-ref as mCompleteFolders.front() down to - // gInventory.collectDescendents() + // Bail out immediately if no descendents if( mComplete.empty() ) { llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl; - dec_busy_count(); - gInventory.removeObserver(this); - delete this; + if (clear_observer) + { + dec_busy_count(); + gInventory.removeObserver(this); + delete this; + } return; } - - // What we do here is get the complete information on the items in - // the library, and set up an observer that will wait for that to - // happen. - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(mComplete.front(), - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH); - S32 count = item_array.count(); -#if 0 // HACK/TODO: Why? - // This early causes a giant menu to get produced, and doesn't seem to be needed. - if(!count) - { - llwarns << "Nothing fetched in category " << mCompleteFolders.front() - << llendl; + + // Copy the list of complete fetched folders while "this" is still valid + uuid_vec_t completed_folder = mComplete; + + // Clean up, and remove this as an observer now since recursive calls + // could notify observers and throw us into an infinite loop. + if (clear_observer) + { dec_busy_count(); gInventory.removeObserver(this); delete this; - return; } -#endif - - uuid_vec_t ids; - for(S32 i = 0; i < count; ++i) + + for (uuid_vec_t::iterator current_folder = completed_folder.begin(); current_folder != completed_folder.end(); ++current_folder) { - ids.push_back(item_array.get(i)->getUUID()); - } + // Get the information on the fetched folder items and subfolders and fetch those + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array); - LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems); + S32 item_count = item_array->count(); + S32 cat_count = cat_array->count(); + + // Move to next if current folder empty + if ((item_count == 0) && (cat_count == 0)) + { + continue; + } - // clean up, and remove this as an observer since the call to the - // outfit could notify observers and throw us into an infinite - // loop. - dec_busy_count(); - gInventory.removeObserver(this); - delete this; + uuid_vec_t ids; + LLRightClickInventoryFetchObserver* outfit = NULL; + LLRightClickInventoryFetchDescendentsObserver* categories = NULL; - // increment busy count and either tell the inventory to check & - // call done, or add this object to the inventory for observation. - inc_busy_count(); + // Fetch the items + if (item_count) + { + for (S32 i = 0; i < item_count; ++i) + { + ids.push_back(item_array->get(i)->getUUID()); + } + outfit = new LLRightClickInventoryFetchObserver(ids); + } + // Fetch the subfolders + if (cat_count) + { + for (S32 i = 0; i < cat_count; ++i) + { + ids.push_back(cat_array->get(i)->getUUID()); + } + categories = new LLRightClickInventoryFetchDescendentsObserver(ids); + } - // do the fetch - outfit->startFetch(); - outfit->done(); //Not interested in waiting and this will be right 99% of the time. -//Uncomment the following code for laggy Inventory UI. -/* if(outfit->isFinished()) - { - // everything is already here - call done. - outfit->done(); + // Perform the item fetch + if (outfit) + { + outfit->startFetch(); + outfit->execute(); // Not interested in waiting and this will be right 99% of the time. + delete outfit; + // Uncomment the following code for laggy Inventory UI. + /* + if (outfit->isFinished()) + { + // everything is already here - call done. + outfit->execute(); + delete outfit; + } + else + { + // it's all on its way - add an observer, and the inventory + // will call done for us when everything is here. + inc_busy_count(); + gInventory.addObserver(outfit); + } + */ + } + // Perform the subfolders fetch : this is where we truly recurse down the folder hierarchy + if (categories) + { + categories->startFetch(); + if (categories->isFinished()) + { + // everything is already here - call done. + categories->execute(); + delete categories; + } + else + { + // it's all on its way - add an observer, and the inventory + // will call done for us when everything is here. + inc_busy_count(); + gInventory.addObserver(categories); + } + } } - else - { - // it's all on it's way - add an observer, and the inventory - // will call done for us when everything is here. - gInventory.addObserver(outfit); - }*/ } @@ -3375,17 +3404,19 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) folders.push_back(category->getUUID()); sSelf = getHandle(); - LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); + LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders); fetch->startFetch(); - inc_busy_count(); if (fetch->isFinished()) { + // Do not call execute() or done() here as if the folder is here, there's likely no point drilling down + // This saves lots of time as buildContextMenu() is called a lot delete fetch; buildContextMenuFolderOptions(flags); } else { // it's all on its way - add an observer, and the inventory will call done for us when everything is here. + inc_busy_count(); gInventory.addObserver(fetch); } } -- cgit v1.2.3 From 86c572ad63f0cf222050e807899e80ea5802e1d7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 16 Mar 2012 15:58:05 -0700 Subject: EXP-1915 : Fetch recursively folders when selected --- indra/newview/llinventorybridge.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 9b8c311d16..8d3ac3e723 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1775,9 +1775,6 @@ BOOL LLFolderBridge::isItemMovable() const // If it's a protected type folder, we can't move it if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())) return FALSE; - // If the folder is not there yet, it's too early to decide if it's movable - if (!isUpToDate()) - return FALSE; return TRUE; } return FALSE; @@ -1785,9 +1782,10 @@ BOOL LLFolderBridge::isItemMovable() const void LLFolderBridge::selectItem() { + // Have no fear: the first thing start() does is to test if everything for that folder has been fetched... + LLInventoryModelBackgroundFetch::instance().start(getUUID(), true); } - // Iterate through a folder's children to determine if // all the children are removable. class LLIsItemRemovable : public LLFolderViewFunctor @@ -1813,10 +1811,6 @@ BOOL LLFolderBridge::isItemRemovable() const return FALSE; } - // If the folder is not there yet, we shouldn't try to remove it yet - if (!isUpToDate()) - return FALSE; - LLInventoryPanel* panel = mInventoryPanel.get(); LLFolderViewFolder* folderp = dynamic_cast(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL); if (folderp) @@ -1849,10 +1843,6 @@ BOOL LLFolderBridge::isItemCopyable() const { // Folders are copyable if items in them are, recursively, copyable. - // If the folder is not there yet, it's not copyable - if (!isUpToDate()) - return FALSE; - // Get the content of the folder LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; -- cgit v1.2.3 From fdd018783a0cc06a467443ca7c9ea0876a87ef49 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 27 Mar 2012 18:40:17 -0400 Subject: CHOP-854: move change_(item|category)_parent() into LLInventoryModel. It's not really clear why they're in llinventoryfunctions.{h,cpp} instead of LLInventoryModel, and in fact LLInventoryModel::removeItem() already contains code essentially cloned from change_item_parent() -- or perhaps vice-versa. This changeset addresses only migrating the functions, and fixing up existing references, to simplify code review. --- indra/newview/llinventorybridge.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c0065a94e6..21f03e3d66 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -910,7 +910,7 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model, const LLUUID& new_parent_id, BOOL restamp) { - change_item_parent(model, item, new_parent_id, restamp); + model->changeItemParent(item, new_parent_id, restamp); } // static @@ -919,7 +919,7 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model, const LLUUID& new_parent_id, BOOL restamp) { - change_category_parent(model, cat, new_parent_id, restamp); + model->changeCategoryParent(cat, new_parent_id, restamp); } LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, -- cgit v1.2.3 From ee87fd975faf403707908cd3c7d37f8431df46ac Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 14 Apr 2012 22:23:24 -0400 Subject: DRTVWR-136: Remove redundant remove_(item|category)() functions. Incoming changes from two different project repos left viewer-development with LLInventoryModel::removeItem() and removeCategory() plus free functions remove_item() and remove_category() in llinventoryfunctions.cpp. remove_category() was actually the better implementation; migrated its body into LLInventoryModel::removeCategory(). Clearly the previous state of affairs -- with LLInventoryModel::removeItem() plus a remove_category() free function in a very different source file -- fooled two different developers into overlooking the other of the pair. Unfortunately we each added different "missing" functions, leaving us with a complete set of four. Fix existing references to remove_item() and remove_category() free functions. --- indra/newview/llinventorybridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cae04ccb49..b86c453d61 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2948,7 +2948,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re { // move it to the trash LLPreview::hide(mUUID); - remove_category(getInventoryModel(), mUUID); + getInventoryModel()->removeCategory(mUUID); return TRUE; } return FALSE; -- cgit v1.2.3