Remove the Outbox
Goodbye, old friend.
This commit is contained in:
@@ -47,7 +47,6 @@
|
||||
//#include "llfirstuse.h"
|
||||
#include "llfloaterinventory.h"
|
||||
#include "llfloatermarketplacelistings.h"
|
||||
#include "llfloateroutbox.h"
|
||||
#include "llfocusmgr.h"
|
||||
#include "llfolderview.h"
|
||||
#include "llgesturemgr.h"
|
||||
@@ -744,183 +743,11 @@ void show_item_profile(const LLUUID& item_uuid)
|
||||
}
|
||||
}
|
||||
|
||||
void open_outbox()
|
||||
{
|
||||
LLFloaterOutbox::showInstance();
|
||||
}
|
||||
|
||||
void open_marketplace_listings()
|
||||
{
|
||||
LLFloaterMarketplaceListings::showInstance();
|
||||
}
|
||||
|
||||
// Create a new folder in destFolderId with the same name as the item name and return the uuid of the new folder
|
||||
// Note: this is used locally in various situation where we need to wrap an item into a special folder
|
||||
LLUUID create_folder_for_item(LLInventoryItem* item, const LLUUID& destFolderId)
|
||||
{
|
||||
llassert(item);
|
||||
llassert(destFolderId.notNull());
|
||||
|
||||
LLUUID created_folder_id = gInventory.createNewCategory(destFolderId, LLFolderType::FT_NONE, item->getName());
|
||||
gInventory.notifyObservers();
|
||||
|
||||
// *TODO : Create different notifications for the various cases
|
||||
LLNotificationsUtil::add("OutboxFolderCreated");
|
||||
|
||||
return created_folder_id;
|
||||
}
|
||||
|
||||
void move_to_outbox_cb_action(const LLSD& payload)
|
||||
{
|
||||
LLViewerInventoryItem * viitem = gInventory.getItem(payload["item_id"].asUUID());
|
||||
LLUUID dest_folder_id = payload["dest_folder_id"].asUUID();
|
||||
|
||||
if (viitem)
|
||||
{
|
||||
// when moving item directly into outbox create folder with that name
|
||||
if (dest_folder_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
|
||||
{
|
||||
dest_folder_id = create_folder_for_item(viitem, dest_folder_id);
|
||||
}
|
||||
|
||||
LLUUID parent = viitem->getParentUUID();
|
||||
|
||||
gInventory.changeItemParent(
|
||||
viitem,
|
||||
dest_folder_id,
|
||||
false);
|
||||
|
||||
LLUUID top_level_folder = payload["top_level_folder"].asUUID();
|
||||
|
||||
if (top_level_folder != LLUUID::null)
|
||||
{
|
||||
LLViewerInventoryCategory* category;
|
||||
|
||||
while (parent.notNull())
|
||||
{
|
||||
LLInventoryModel::cat_array_t* cat_array;
|
||||
LLInventoryModel::item_array_t* item_array;
|
||||
gInventory.getDirectDescendentsOf(parent,cat_array,item_array);
|
||||
|
||||
LLUUID next_parent;
|
||||
|
||||
category = gInventory.getCategory(parent);
|
||||
|
||||
if (!category) break;
|
||||
|
||||
next_parent = category->getParentUUID();
|
||||
|
||||
if (cat_array->empty() && item_array->empty())
|
||||
{
|
||||
gInventory.removeCategory(parent);
|
||||
}
|
||||
|
||||
if (parent == top_level_folder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
parent = next_parent;
|
||||
}
|
||||
}
|
||||
|
||||
open_outbox();
|
||||
}
|
||||
}
|
||||
|
||||
void copy_item_to_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, const LLUUID& top_level_folder, S32 operation_id)
|
||||
{
|
||||
// Collapse links directly to items/folders
|
||||
LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
|
||||
LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
|
||||
if (linked_category != NULL)
|
||||
{
|
||||
copy_folder_to_outbox(linked_category, dest_folder, top_level_folder, operation_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
|
||||
if (linked_item != NULL)
|
||||
{
|
||||
inv_item = (LLInventoryItem *) linked_item;
|
||||
}
|
||||
|
||||
// Check for copy permissions
|
||||
if (inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()))
|
||||
{
|
||||
// when moving item directly into outbox create folder with that name
|
||||
if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
|
||||
{
|
||||
dest_folder = create_folder_for_item(inv_item, dest_folder);
|
||||
}
|
||||
|
||||
copy_inventory_item(gAgent.getID(),
|
||||
inv_item->getPermissions().getOwner(),
|
||||
inv_item->getUUID(),
|
||||
dest_folder,
|
||||
inv_item->getName(),
|
||||
LLPointer<LLInventoryCallback>(NULL));
|
||||
|
||||
open_outbox();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSD payload;
|
||||
payload["item_id"] = inv_item->getUUID();
|
||||
payload["dest_folder_id"] = dest_folder;
|
||||
payload["top_level_folder"] = top_level_folder;
|
||||
payload["operation_id"] = operation_id;
|
||||
|
||||
LLMarketplaceInventoryNotifications::addNoCopyNotification(payload, move_to_outbox_cb_action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void move_item_within_outbox(LLInventoryItem* inv_item, LLUUID dest_folder, S32 operation_id)
|
||||
{
|
||||
// when moving item directly into outbox create folder with that name
|
||||
if (dest_folder == gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false))
|
||||
{
|
||||
dest_folder = create_folder_for_item(inv_item, dest_folder);
|
||||
}
|
||||
|
||||
LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
|
||||
|
||||
gInventory.changeItemParent(
|
||||
viewer_inv_item,
|
||||
dest_folder,
|
||||
false);
|
||||
}
|
||||
|
||||
void copy_folder_to_outbox(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, const LLUUID& top_level_folder, S32 operation_id)
|
||||
{
|
||||
LLUUID new_folder_id = gInventory.createNewCategory(dest_folder, LLFolderType::FT_NONE, inv_cat->getName());
|
||||
gInventory.notifyObservers();
|
||||
|
||||
LLInventoryModel::cat_array_t* cat_array;
|
||||
LLInventoryModel::item_array_t* item_array;
|
||||
gInventory.getDirectDescendentsOf(inv_cat->getUUID(),cat_array,item_array);
|
||||
|
||||
// copy the vector because otherwise the iterator won't be happy if we delete from it
|
||||
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_item_to_outbox(item, new_folder_id, top_level_folder, operation_id);
|
||||
}
|
||||
|
||||
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_folder_to_outbox(category, new_folder_id, top_level_folder, operation_id);
|
||||
}
|
||||
|
||||
open_outbox();
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
// Marketplace functions
|
||||
//
|
||||
@@ -1213,7 +1040,7 @@ bool has_correct_permissions_for_sale(LLInventoryCategory* cat, std::string& err
|
||||
// bundle_size is the amount of sibling items that are getting moved to the marketplace at the same time.
|
||||
bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size, bool from_paste)
|
||||
{
|
||||
// Check stock folder type matches item type in marketplace listings or merchant outbox (even if of no use there for the moment)
|
||||
// Check stock folder type matches item type in marketplace listings (even if of no use there for the moment)
|
||||
LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(dest_folder);
|
||||
bool move_in_stock = (view_folder && (view_folder->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK));
|
||||
bool accept = (view_folder && view_folder->acceptItem(inv_item));
|
||||
|
||||
Reference in New Issue
Block a user