diff options
author | Oz Linden <oz@lindenlab.com> | 2010-11-19 15:52:52 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2010-11-19 15:52:52 -0500 |
commit | 0f72f152e88efd7fc56cf6764f25bd2d0d4bf062 (patch) | |
tree | 7681f51b585d19910fa749dc4dbbc0ab4abe63fd /indra/newview/llpanelmaininventory.cpp | |
parent | daae74e569c0f0bc4ea822ac4127c1d8c21aa91f (diff) | |
parent | 1630bd4149cc8637f01eea82e4497dbf0d76b777 (diff) |
merge fix for STORM-616
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 904e3dabcc..17433a557b 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -329,15 +329,23 @@ void LLPanelMainInventory::setSortBy(const LLSD& userdata) if (sort_field == "name") { U32 order = getActivePanel()->getSortOrder(); - getActivePanel()->setSortOrder( order & ~LLInventoryFilter::SO_DATE ); - + order &= ~LLInventoryFilter::SO_DATE; + + getActivePanel()->setSortOrder( order ); + + gSavedSettings.setU32("InventorySortOrder", order); + gSavedSettings.setBOOL("Inventory.SortByName", TRUE ); gSavedSettings.setBOOL("Inventory.SortByDate", FALSE ); } else if (sort_field == "date") { U32 order = getActivePanel()->getSortOrder(); - getActivePanel()->setSortOrder( order | LLInventoryFilter::SO_DATE ); + order |= LLInventoryFilter::SO_DATE; + + getActivePanel()->setSortOrder( order ); + + gSavedSettings.setU32("InventorySortOrder", order); gSavedSettings.setBOOL("Inventory.SortByName", FALSE ); gSavedSettings.setBOOL("Inventory.SortByDate", TRUE ); @@ -375,6 +383,8 @@ void LLPanelMainInventory::setSortBy(const LLSD& userdata) gSavedSettings.setBOOL("Inventory.SystemFoldersToTop", TRUE ); } getActivePanel()->setSortOrder( order ); + + gSavedSettings.setU32("InventorySortOrder", order); } } @@ -915,6 +925,7 @@ void LLPanelMainInventory::initListCommandsHandlers() )); mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2)); + mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2)); mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2)); mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mGearMenuButton->setMenu(mMenuGearDefault); @@ -1000,6 +1011,11 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) const LLSD arg = "date"; setSortBy(arg); } + if (command_name == "sort_system_folders_to_top") + { + const LLSD arg = "systemfolderstotop"; + setSortBy(arg); + } if (command_name == "show_filters") { toggleFindOptions(); @@ -1173,6 +1189,31 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) return TRUE; } +BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + + if (command_name == "sort_by_name") + { + U32 order = getActivePanel()->getSortOrder(); + return ~order & LLInventoryFilter::SO_DATE; + } + + if (command_name == "sort_by_recent") + { + U32 order = getActivePanel()->getSortOrder(); + return order & LLInventoryFilter::SO_DATE; + } + + if (command_name == "sort_system_folders_to_top") + { + U32 order = getActivePanel()->getSortOrder(); + return order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP; + } + + return FALSE; +} + bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept) { *accept = ACCEPT_NO; |