diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-02-03 22:42:10 +0200 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-02-03 22:42:10 +0200 |
commit | e5bd3b8a4846ee21cfaf726cfbf3e943b277e7c1 (patch) | |
tree | 3718c3a04b67070468f85f10af522863334b15a9 /indra | |
parent | b52d2a2f1b0406becb80862686be7b6f2444006d (diff) |
Fixed bug EXT-2915 ([BSI] Pay Button is hard to find on small resolutions).
Added a "Block/Unblock" item to the profile view panel overflow menu to make the menu more visible.
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llavataractions.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llavataractions.h | 5 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.h | 8 | ||||
-rw-r--r-- | indra/newview/llpanelpeoplemenus.cpp | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_profile_overflow.xml | 13 |
6 files changed, 64 insertions, 6 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 7eed2e7b9a..bd987eac77 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -612,3 +612,13 @@ bool LLAvatarActions::isBlocked(const LLUUID& id) gCacheName->getFullName(id, name); return LLMuteList::getInstance()->isMuted(id, name); } + +// static +bool LLAvatarActions::canBlock(const LLUUID& id) +{ + std::string firstname, lastname; + gCacheName->getName(id, firstname, lastname); + bool is_linden = !LLStringUtil::compareStrings(lastname, "Linden"); + bool is_self = id == gAgentID; + return !is_self && !is_linden; +} diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index c751661acf..16a58718a2 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -124,6 +124,11 @@ public: static bool isBlocked(const LLUUID& id); /** + * @return true if you can block the avatar + */ + static bool canBlock(const LLUUID& id); + + /** * Return true if the avatar is in a P2P voice call with a given user */ /* AD *TODO: Is this function needed any more? diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 48dd5513bd..4a7cdfc856 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -483,6 +483,7 @@ BOOL LLPanelAvatarProfile::postBuild() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this)); + registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this)); registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this)); registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this)); registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this)); @@ -490,6 +491,8 @@ BOOL LLPanelAvatarProfile::postBuild() LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; enable.add("Profile.EnableGod", boost::bind(&enable_god)); + enable.add("Profile.CheckItem", boost::bind(&LLPanelAvatarProfile::checkOverflowMenuItem, this, _2)); + enable.add("Profile.EnableItem", boost::bind(&LLPanelAvatarProfile::enableOverflowMenuItem, this, _2)); mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -666,6 +669,26 @@ void LLPanelAvatarProfile::fillAccountStatus(const LLAvatarData* avatar_data) childSetValue("acc_status_text", caption_text); } +bool LLPanelAvatarProfile::checkOverflowMenuItem(const LLSD& param) +{ + std::string item = param.asString(); + + if (item == "is_blocked") + return LLAvatarActions::isBlocked(getAvatarId()); + + return false; +} + +bool LLPanelAvatarProfile::enableOverflowMenuItem(const LLSD& param) +{ + std::string item = param.asString(); + + if (item == "can_block") + return LLAvatarActions::canBlock(getAvatarId()); + + return false; +} + void LLPanelAvatarProfile::pay() { LLAvatarActions::pay(getAvatarId()); @@ -676,6 +699,11 @@ void LLPanelAvatarProfile::share() LLAvatarActions::share(getAvatarId()); } +void LLPanelAvatarProfile::toggleBlock() +{ + LLAvatarActions::toggleBlock(getAvatarId()); +} + void LLPanelAvatarProfile::kick() { LLAvatarActions::kick(getAvatarId()); diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index ce59f1e93d..632590aa27 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -192,12 +192,18 @@ protected: */ void share(); + /** + * Add/remove resident to/from your block list. + */ + void toggleBlock(); + void kick(); void freeze(); void unfreeze(); void csr(); - + bool checkOverflowMenuItem(const LLSD& param); + bool enableOverflowMenuItem(const LLSD& param); bool enableGod(); diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 470cfca8fe..7e184c78a8 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -164,11 +164,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) if (item == std::string("can_block")) { const LLUUID& id = mUUIDs.front(); - std::string firstname, lastname; - gCacheName->getName(id, firstname, lastname); - bool is_linden = !LLStringUtil::compareStrings(lastname, "Linden"); - bool is_self = id == gAgentID; - return !is_self && !is_linden; + return LLAvatarActions::canBlock(id); } else if (item == std::string("can_add")) { diff --git a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml index 1dc1c610cf..407ce14e81 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml @@ -19,6 +19,19 @@ <menu_item_call.on_click function="Profile.Share" /> </menu_item_call> + <menu_item_check + label="Block/Unblock" + layout="topleft" + name="block_unblock"> + <menu_item_check.on_click + function="Profile.BlockUnblock" /> + <menu_item_check.on_check + function="Profile.CheckItem" + parameter="is_blocked" /> + <menu_item_check.on_enable + function="Profile.EnableItem" + parameter="can_block" /> + </menu_item_check> <menu_item_call label="Kick" layout="topleft" |