summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-12-17 18:55:01 -0500
committerLoren Shih <seraph@lindenlab.com>2009-12-17 18:55:01 -0500
commit36634bc1ec8d185b8b1d974b8bf215d3a413e242 (patch)
tree402b4c5ba9f70c960348c07021e32e25a3f8083b /indra/newview/llinventorybridge.cpp
parent6b065789c0f38256adb046a0231fe22d05d038da (diff)
parent74b36a4cf15593e32611f9848b3360605834d626 (diff)
automated merge viewer2.0->avp
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index d24a03a28a..3fc2cbecbe 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2946,6 +2946,27 @@ LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_a
return result;
}
+// See also LLInventorySort where landmarks in the Favorites folder are sorted.
+class LLViewerInventoryItemSort
+{
+public:
+ bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
+ {
+ return a->getSortField() < b->getSortField();
+ }
+};
+
+/**
+ * Sorts passed items by LLViewerInventoryItem sort field.
+ *
+ * @param[in, out] items - array of items, not sorted.
+ */
+void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items)
+{
+ static LLViewerInventoryItemSort sort_functor;
+ 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);
@@ -3049,6 +3070,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
LLUUID srcItemId = inv_item->getUUID();
LLUUID destItemId = itemp->getListener()->getUUID();
+ // ensure items are sorted properly before changing order. EXT-3498
+ rearrange_item_order_by_sort_field(items);
+
// update order
updateItemsOrder(items, srcItemId, destItemId);