MAINT-3319 : WIP : Introduce a consolidate folder method used for Merchant Outbox

meow-7.2.2
Merov Linden 2013-11-18 16:03:22 -08:00
parent 6ec99570cd
commit 125f3f071a
3 changed files with 29 additions and 4 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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