diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2010-11-17 21:40:04 +0200 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2010-11-17 21:40:04 +0200 |
commit | fa2aeb07f8474cfd5d61d5347dfcc28bd8f7f257 (patch) | |
tree | 594f0815f9858400b2c58d539b3dcaabe5125943 /indra | |
parent | 3a36ed079c0dec55efe9622d9ff86ae932ef9ed5 (diff) |
STORM-316 FIXED Added an item to inventory gear menu to control "Sort System Folders to Top" option (was always "true").
Changed inventory gear menu sort items - now they have check marks on the left.
Made inventory sort options persist across sessions.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml | 25 |
3 files changed, 66 insertions, 7 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; diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index d136e2d32e..c2b78ff9ea 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -136,6 +136,7 @@ protected: void onTrashButtonClick(); void onClipboardAction(const LLSD& userdata); BOOL isActionEnabled(const LLSD& command_name); + BOOL isActionChecked(const LLSD& userdata); void onCustomAction(const LLSD& command_name); bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept); /** diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml index 679d5bc82e..7fa4cd840a 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml @@ -16,22 +16,39 @@ </menu_item_call> <menu_item_separator layout="topleft" /> - <menu_item_call + <menu_item_check label="Sort by Name" layout="topleft" name="sort_by_name"> <on_click function="Inventory.GearDefault.Custom.Action" parameter="sort_by_name" /> - </menu_item_call> - <menu_item_call + <on_check + function="Inventory.GearDefault.Check" + parameter="sort_by_name" /> + </menu_item_check> + <menu_item_check label="Sort by Most Recent" layout="topleft" name="sort_by_recent"> <on_click function="Inventory.GearDefault.Custom.Action" parameter="sort_by_recent" /> - </menu_item_call> + <on_check + function="Inventory.GearDefault.Check" + parameter="sort_by_recent" /> + </menu_item_check> + <menu_item_check + label="Sort System Folders to Top" + layout="topleft" + name="sort_system_folders_to_top"> + <on_click + function="Inventory.GearDefault.Custom.Action" + parameter="sort_system_folders_to_top" /> + <on_check + function="Inventory.GearDefault.Check" + parameter="sort_system_folders_to_top" /> + </menu_item_check> <menu_item_separator layout="topleft" /> <menu_item_call |