diff options
author | Merov Linden <merov@lindenlab.com> | 2013-11-18 16:03:22 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-11-18 16:03:22 -0800 |
commit | 125f3f071a30f4c47feb664b21f3e380ee4e7e49 (patch) | |
tree | c56f1c2a5beba6485865403b8a03e2f78d7b1823 /indra | |
parent | 6ec99570cd86a89ed6367f81d6b0cccd7fe0e913 (diff) |
MAINT-3319 : WIP : Introduce a consolidate folder method used for Merchant Outbox
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llfloateroutbox.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.cpp | 23 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.h | 5 |
3 files changed, 29 insertions, 4 deletions
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index fa628f2a08..90da9ad2c0 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -238,6 +238,11 @@ void LLFloaterOutbox::setupOutbox() llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl; return; } + + // Consolidate Merchant Outbox + // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually + gInventory.consolidateForType(outbox_id, LLFolderType::FT_OUTBOX); + if (outbox_id == mOutboxId) { llwarns << "Inventory warning: Merchant outbox already set" << llendl; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 935fe2b4d0..18dbce3321 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -369,15 +369,30 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id) mItemLock[cat_id] = false; } +void LLInventoryModel::consolidateForType(const LLUUID& id, LLFolderType::EType type) +{ + bool trace = (type == LLFolderType::FT_OUTBOX); + if (trace) + { + for (cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) + { + LLViewerInventoryCategory* cat = cit->second; + if (cat->getPreferredType() == type) + { + llinfos << "Merov : List outbox from mCategoryMap, name = " << cat->getName() << ", type = " << cat->getPreferredType() << ", id = " << cat->getUUID().asString() << llendl; + } + } + } +} + // findCategoryUUIDForType() returns the uuid of the category that // specifies 'type' as what it defaults to containing. The category is // not necessarily only for that type. *NOTE: This will create a new // inventory category on the fly if one does not exist. -const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder/*, +const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder/*, bool find_in_library*/) { LLUUID rv = LLUUID::null; - const LLUUID &root_id = /*(find_in_library) ? gInventory.getLibraryRootFolderID() :*/ gInventory.getRootFolderID(); if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) { @@ -392,9 +407,9 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe S32 count = cats->count(); for(S32 i = 0; i < count; ++i) { - if(cats->get(i)->getPreferredType() == preferred_type) + if (cats->get(i)->getPreferredType() == preferred_type) { - rv = cats->get(i)->getUUID(); + rv = cats->get(i)->getUUID(); break; } } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 8aac879a93..544ca5e5dc 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -263,6 +263,11 @@ public: // Get the inventoryID or item that this item points to, else just return object_id const LLUUID& getLinkedItemID(const LLUUID& object_id) const; LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const; + + // Copy content of all folders of type "type" into folder "id" and delete/purge the empty folders + // Note : This method has been designed for FT_OUTBOX (aka Merchant Outbox) but can be used for other categories + void consolidateForType(const LLUUID& id, LLFolderType::EType type); + private: mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups |