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/llinventoryfunctions.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index dd92188e9d..ea00474b2a 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -54,7 +54,6 @@ #include "lliconctrl.h" #include "llimview.h" #include "llinventorybridge.h" -#include "llinventoryclipboard.h" #include "llinventorymodel.h" #include "llinventorypanel.h" #include "lllineeditor.h" -- cgit v1.2.3 From 10dadc6b0dd646faa251c0935e75d07c97b3052d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 8 Feb 2012 17:22:04 -0800 Subject: EXP-1873 : Move cut items to trash in cut/copy over cut situations. --- indra/newview/llinventoryfunctions.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ea00474b2a..8313b23f44 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -160,6 +160,31 @@ void change_category_parent(LLInventoryModel* model, model->notifyObservers(); } +// Move the item to the trash. Works for folders and objects. +// Caution: This method assumes that the item is removable! +void remove_item(LLInventoryModel* model, const LLUUID& id) +{ + LLViewerInventoryItem* item = model->getItem(id); + if (!item) + return; + + if (item->getType() == LLAssetType::AT_CATEGORY) + { + // Call the general helper function to delete a folder + remove_category(model, id); + } + else + { + // Get the trash UUID + LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false); + if (trash_id.notNull()) + { + // Finally, move the item to the trash + change_item_parent(model, item, trash_id, true); + } + } +} + void remove_category(LLInventoryModel* model, const LLUUID& cat_id) { if (!model || !get_is_category_removable(model, cat_id)) -- 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/llinventoryfunctions.cpp | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8313b23f44..4fb06f82c1 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -238,6 +238,42 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s model->notifyObservers(); } +void copy_inventory_category(LLInventoryModel* model, + LLViewerInventoryCategory* cat, + const LLUUID& parent_id) +{ + // Create the initial folder + LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName()); + model->notifyObservers(); + + // Get the content of the folder + LLInventoryModel::cat_array_t* cat_array; + LLInventoryModel::item_array_t* item_array; + gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array); + + // Copy all 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; + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + new_cat_uuid, + std::string(), + LLPointer(NULL)); + } + + // Copy all 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; + copy_inventory_category(model, category, new_cat_uuid); + } +} + class LLInventoryCollectAllItems : public LLInventoryCollectFunctor { public: -- cgit v1.2.3 From 155a171180be2df4500e7c6d03df3f99bf4231e7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 16 Feb 2012 14:57:30 -0800 Subject: EXP-1896 : Prevent recursively copying of folders onto themselves --- indra/newview/llinventoryfunctions.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 4fb06f82c1..236c997ef6 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -240,11 +240,15 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, - const LLUUID& parent_id) + const LLUUID& parent_id, + const LLUUID& root_copy_id) { // Create the initial folder LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName()); model->notifyObservers(); + + // We need to exclude the initial root of the copy to avoid recursively copying the copy, etc... + LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id); // Get the content of the folder LLInventoryModel::cat_array_t* cat_array; @@ -270,7 +274,10 @@ void copy_inventory_category(LLInventoryModel* model, for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) { LLViewerInventoryCategory* category = *iter; - copy_inventory_category(model, category, new_cat_uuid); + if (category->getUUID() != root_id) + { + copy_inventory_category(model, category, new_cat_uuid, root_id); + } } } -- cgit v1.2.3 From b2085efa8bad3da7442f35f92c8fe7c65019e182 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 22 Mar 2012 12:27:55 -0700 Subject: CHUI-68 FIX Using arrow keys to scroll through inventory folders does not scroll content in view as a side effect, "My Inventory" is not selected by default auto selection of filtered items now reliably turns itself off as soon as user scrolls or moves keyboard focus to inventory --- indra/newview/llinventoryfunctions.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 236c997ef6..f74a239fd3 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1059,20 +1059,24 @@ void LLSaveFolderState::setApply(BOOL apply) void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) { LLMemType mt(LLMemType::MTYPE_INVENTORY_DO_FOLDER); + LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getListener(); + if(!bridge) return; + if(mApply) { // we're applying the open state - LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getListener(); - if(!bridge) return; LLUUID id(bridge->getUUID()); if(mOpenFolders.find(id) != mOpenFolders.end()) { - folder->setOpen(TRUE); + if (!folder->isOpen()) + { + folder->setOpen(TRUE); + } } else { // keep selected filter in its current state, this is less jarring to user - if (!folder->isSelected()) + if (!folder->isSelected() && folder->isOpen()) { folder->setOpen(FALSE); } @@ -1083,8 +1087,6 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) // we're recording state at this point if(folder->isOpen()) { - LLInvFVBridge* bridge = (LLInvFVBridge*)folder->getListener(); - if(!bridge) return; mOpenFolders.insert(bridge->getUUID()); } } @@ -1120,7 +1122,6 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item) { item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); } - item->getRoot()->scrollToShowSelection(); mItemSelected = TRUE; } } @@ -1134,7 +1135,6 @@ void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder) { folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); } - folder->getRoot()->scrollToShowSelection(); mItemSelected = TRUE; } } -- 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/llinventoryfunctions.cpp | 59 ++-------------------------------- 1 file changed, 3 insertions(+), 56 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index dd92188e9d..ae8d11c3f7 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -109,58 +109,6 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } -void change_item_parent(LLInventoryModel* model, - LLViewerInventoryItem* item, - const LLUUID& new_parent_id, - BOOL restamp) -{ - if (item->getParentUUID() != new_parent_id) - { - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - LLPointer new_item = new LLViewerInventoryItem(item); - new_item->setParent(new_parent_id); - new_item->updateParentOnServer(restamp); - model->updateItem(new_item); - model->notifyObservers(); - } -} - -void change_category_parent(LLInventoryModel* model, - LLViewerInventoryCategory* cat, - const LLUUID& new_parent_id, - BOOL restamp) -{ - if (!model || !cat) - { - return; - } - - // Can't move a folder into a child of itself. - if (model->isObjectDescendentOf(new_parent_id, cat->getUUID())) - { - return; - } - - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); - update.push_back(new_folder); - model->accountForUpdate(update); - - LLPointer new_cat = new LLViewerInventoryCategory(cat); - new_cat->setParent(new_parent_id); - new_cat->updateParentOnServer(restamp); - model->updateCategory(new_cat); - model->notifyObservers(); -} - void remove_category(LLInventoryModel* model, const LLUUID& cat_id) { if (!model || !get_is_category_removable(model, cat_id)) @@ -190,7 +138,7 @@ void remove_category(LLInventoryModel* model, const LLUUID& cat_id) if (cat) { const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - change_category_parent(model, cat, trash_id, TRUE); + model->changeCategoryParent(cat, trash_id, TRUE); } } @@ -568,8 +516,7 @@ void move_to_outbox_cb_action(const LLSD& payload) LLUUID parent = viitem->getParentUUID(); - change_item_parent( - &gInventory, + gInventory.changeItemParent( viitem, dest_folder_id, false); @@ -670,7 +617,7 @@ void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item; - change_item_parent(&gInventory, + gInventory.changeItemParent( viewer_inv_item, dest_folder, false); -- cgit v1.2.3 From a56424d0781a07bbf74b9c6cdde5a488a3ba8329 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 13 Apr 2012 20:57:52 -0400 Subject: fix merge conflict in remove_item --- indra/newview/llinventoryfunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 629fa53388..94d1b19726 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -128,7 +128,7 @@ void remove_item(LLInventoryModel* model, const LLUUID& id) if (trash_id.notNull()) { // Finally, move the item to the trash - change_item_parent(model, item, trash_id, true); + model->changeItemParent(item, trash_id, true); } } } -- 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/llinventoryfunctions.cpp | 60 +--------------------------------- 1 file changed, 1 insertion(+), 59 deletions(-) (limited to 'indra/newview/llinventoryfunctions.cpp') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 94d1b19726..ab5b082915 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -108,64 +108,6 @@ void append_path(const LLUUID& id, std::string& path) path.append(temp); } -// Move the item to the trash. Works for folders and objects. -// Caution: This method assumes that the item is removable! -void remove_item(LLInventoryModel* model, const LLUUID& id) -{ - LLViewerInventoryItem* item = model->getItem(id); - if (!item) - return; - - if (item->getType() == LLAssetType::AT_CATEGORY) - { - // Call the general helper function to delete a folder - remove_category(model, id); - } - else - { - // Get the trash UUID - LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false); - if (trash_id.notNull()) - { - // Finally, move the item to the trash - model->changeItemParent(item, trash_id, true); - } - } -} - -void remove_category(LLInventoryModel* model, const LLUUID& cat_id) -{ - if (!model || !get_is_category_removable(model, cat_id)) - { - return; - } - - // Look for any gestures and deactivate them - LLInventoryModel::cat_array_t descendent_categories; - LLInventoryModel::item_array_t descendent_items; - gInventory.collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); - - for (LLInventoryModel::item_array_t::const_iterator iter = descendent_items.begin(); - iter != descendent_items.end(); - ++iter) - { - const LLViewerInventoryItem* item = (*iter); - const LLUUID& item_id = item->getUUID(); - if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureMgr::instance().isGestureActive(item_id)) - { - LLGestureMgr::instance().deactivateGesture(item_id); - } - } - - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat) - { - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - model->changeCategoryParent(cat, trash_id, TRUE); - } -} - void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name) { LLViewerInventoryCategory* cat; @@ -610,7 +552,7 @@ void move_to_outbox_cb_action(const LLSD& payload) if (cat_array->empty() && item_array->empty()) { - remove_category(&gInventory, parent); + gInventory.removeCategory(parent); } if (parent == top_level_folder) -- cgit v1.2.3