summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-01-15 12:02:56 -0800
committerJames Cook <james@lindenlab.com>2010-01-15 12:02:56 -0800
commit4acf56d2a79a4f3bb555977aeaef21e15e26f684 (patch)
treeac0d8ff2225916323d9b942246edd458e04fd738 /indra/newview/llinventorybridge.cpp
parent3f83c05f7c71887825c907b0e148d81cd7de5324 (diff)
parentc9cf84913d306103da51dc83e5932ff3fb308d32 (diff)
Merge in viewer-2-0 changes
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp73
1 files changed, 12 insertions, 61 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 20d7f5214b..e9176da715 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2448,7 +2448,7 @@ void LLFolderBridge::folderOptionsMenu()
const LLInventoryCategory* category = model->getCategory(mUUID);
LLFolderType::EType type = category->getPreferredType();
- const bool is_default_folder = category && LLFolderType::lookupIsProtectedType(type);
+ const bool is_system_folder = category && LLFolderType::lookupIsProtectedType(type);
// BAP change once we're no longer treating regular categories as ensembles.
const bool is_ensemble = category && (type == LLFolderType::FT_NONE ||
LLFolderType::lookupIsEnsembleType(type));
@@ -2462,8 +2462,8 @@ void LLFolderBridge::folderOptionsMenu()
mItems.push_back("Delete");
}
- // Only enable calling-card related options for non-default folders.
- if (!is_sidepanel && !is_default_folder)
+ // Only enable calling-card related options for non-system folders.
+ if (!is_sidepanel && !is_system_folder)
{
LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
@@ -2497,10 +2497,14 @@ void LLFolderBridge::folderOptionsMenu()
mItems.push_back(std::string("Folder Wearables Separator"));
}
- // Only enable add/replace outfit for non-default folders.
- if (!is_default_folder)
+ // Only enable add/replace outfit for non-system folders.
+ if (!is_system_folder)
{
- mItems.push_back(std::string("Add To Outfit"));
+ // Adding an outfit onto another (versus replacing) doesn't make sense.
+ if (type != LLFolderType::FT_OUTFIT)
+ {
+ mItems.push_back(std::string("Add To Outfit"));
+ }
mItems.push_back(std::string("Replace Outfit"));
}
if (is_ensemble)
@@ -2927,50 +2931,6 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
return false;
}
-/*
-Next functions intended to reorder items in the inventory folder and save order on server
-Is now used for Favorites folder.
-
-*TODO: refactoring is needed with Favorites Bar functionality. Probably should be moved in LLInventoryModel
-*/
-void saveItemsOrder(LLInventoryModel::item_array_t& items)
-{
- int sortField = 0;
-
- // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
- for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
- {
- LLViewerInventoryItem* item = *i;
-
- item->setSortField(++sortField);
- item->setComplete(TRUE);
- item->updateServer(FALSE);
-
- gInventory.updateItem(item);
-
- // Tell the parent folder to refresh its sort order.
- gInventory.addChangedMask(LLInventoryObserver::SORT, item->getParentUUID());
- }
-
- gInventory.notifyObservers();
-}
-
-LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
-{
- LLInventoryModel::item_array_t::iterator result = items.end();
-
- for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
- {
- if ((*i)->getUUID() == id)
- {
- result = i;
- break;
- }
- }
-
- return result;
-}
-
// See also LLInventorySort where landmarks in the Favorites folder are sorted.
class LLViewerInventoryItemSort
{
@@ -2992,15 +2952,6 @@ void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items)
std::sort(items.begin(), items.end(), sort_functor);
}
-void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& srcItemId, const LLUUID& destItemId)
-{
- LLViewerInventoryItem* srcItem = gInventory.getItem(srcItemId);
- LLViewerInventoryItem* destItem = gInventory.getItem(destItemId);
-
- items.erase(findItemByUUID(items, srcItem->getUUID()));
- items.insert(findItemByUUID(items, destItem->getUUID()), srcItem);
-}
-
BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
BOOL drop)
{
@@ -3099,9 +3050,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
rearrange_item_order_by_sort_field(items);
// update order
- updateItemsOrder(items, srcItemId, destItemId);
+ LLInventoryModel::updateItemsOrder(items, srcItemId, destItemId);
- saveItemsOrder(items);
+ gInventory.saveItemsOrder(items);
}
}
else if (favorites_id == mUUID) // if target is the favorites folder we use copy