summaryrefslogtreecommitdiff
path: root/indra/newview/llcofwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llcofwearables.cpp')
-rw-r--r--indra/newview/llcofwearables.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 498aeec682..8d4430a9ea 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -46,6 +46,20 @@ static LLRegisterPanelClassWrapper<LLCOFWearables> t_cof_wearables("cof_wearable
const LLSD REARRANGE = LLSD().with("rearrange", LLSD());
+static const LLWearableItemNameComparator WEARABLE_NAME_COMPARATOR;
+
+
+bool LLWearableItemNameComparator::doCompare(const LLPanelWearableListItem* wearable_item1, const LLPanelWearableListItem* wearable_item2) const
+{
+ std::string name1 = wearable_item1->getItemName();
+ std::string name2 = wearable_item2->getItemName();
+
+ LLStringUtil::toUpper(name1);
+ LLStringUtil::toUpper(name2);
+
+ return name1 < name2;
+}
+
LLCOFWearables::LLCOFWearables() : LLPanel(),
mAttachments(NULL),
@@ -73,6 +87,10 @@ BOOL LLCOFWearables::postBuild()
mClothing->setCommitOnSelectionChange(true);
mBodyParts->setCommitOnSelectionChange(true);
+ //clothing is sorted according to its position relatively to the body
+ mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR);
+ mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR);
+
return LLPanel::postBuild();
}
@@ -164,16 +182,15 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
if (mAttachments->size())
{
- mAttachments->sort(); //*TODO by Name
+ mAttachments->sort();
mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
}
if (mBodyParts->size())
{
- mBodyParts->sort(); //*TODO by name
+ mBodyParts->sort();
+ mBodyParts->notify(REARRANGE);
}
-
- mBodyParts->notify(REARRANGE);
}
//create a clothing list item, update verbs and show/hide line separator