diff options
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 6f753b6176..97c1e96175 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -48,6 +48,9 @@ #include "llscrollcontainer.h" #include "llavatariconctrl.h" #include "llweb.h" +#include "llfloaterworldmap.h" +#include "llfloaterreg.h" +#include "llnotificationsutil.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLDropTarget @@ -150,6 +153,8 @@ BOOL LLPanelAvatarNotes::postBuild() childSetCommitCallback("call", boost::bind(&LLPanelAvatarNotes::onCallButtonClick, this), NULL); childSetCommitCallback("teleport", boost::bind(&LLPanelAvatarNotes::onTeleportButtonClick, this), NULL); childSetCommitCallback("share", boost::bind(&LLPanelAvatarNotes::onShareButtonClick, this), NULL); + childSetCommitCallback("show_on_map_btn", (boost::bind( + &LLPanelAvatarNotes::onMapButtonClick, this)), NULL); LLTextEditor* te = getChild<LLTextEditor>("notes_edit"); te->setCommitCallback(boost::bind(&LLPanelAvatarNotes::onCommitNotes,this)); @@ -195,6 +200,46 @@ void LLPanelAvatarNotes::onCommitNotes() LLAvatarPropertiesProcessor::getInstance()-> sendNotes(getAvatarId(),notes); } +void LLPanelAvatarNotes::rightsConfirmationCallback(const LLSD& notification, + const LLSD& response, S32 rights) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + LLAvatarPropertiesProcessor::getInstance()->sendFriendRights( + getAvatarId(), rights); + } + else + { + childSetValue("objects_check", + childGetValue("objects_check").asBoolean() ? FALSE : TRUE); + } +} + +void LLPanelAvatarNotes::confirmModifyRights(bool grant, S32 rights) +{ + std::string first, last; + LLSD args; + if (gCacheName->getName(getAvatarId(), first, last)) + { + args["FIRST_NAME"] = first; + args["LAST_NAME"] = last; + } + + if (grant) + { + LLNotificationsUtil::add("GrantModifyRights", args, LLSD(), + boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this, + _1, _2, rights)); + } + else + { + LLNotificationsUtil::add("RevokeModifyRights", args, LLSD(), + boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this, + _1, _2, rights)); + } +} + void LLPanelAvatarNotes::onCommitRights() { S32 rights = 0; @@ -206,7 +251,14 @@ void LLPanelAvatarNotes::onCommitRights() if(childGetValue("objects_check").asBoolean()) rights |= LLRelationship::GRANT_MODIFY_OBJECTS; - LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(),rights); + const LLRelationship* buddy_relationship = + LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + bool allow_modify_objects = childGetValue("objects_check").asBoolean(); + if (buddy_relationship->isRightGrantedTo( + LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects) + { + confirmModifyRights(allow_modify_objects, rights); + } } void LLPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type) @@ -311,6 +363,7 @@ void LLPanelProfileTab::onOpen(const LLSD& key) // Update data even if we are viewing same avatar profile as some data might been changed. setAvatarId(key.asUUID()); updateData(); + updateButtons(); } void LLPanelProfileTab::scrollToTop() @@ -320,6 +373,22 @@ void LLPanelProfileTab::scrollToTop() scrollContainer->goToTop(); } +void LLPanelProfileTab::onMapButtonClick() +{ + std::string name; + gCacheName->getFullName(getAvatarId(), name); + gFloaterWorldMap->trackAvatar(getAvatarId(), name); + LLFloaterReg::showInstance("world_map"); +} + +void LLPanelProfileTab::updateButtons() +{ + bool enable_map_btn = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) + && gAgent.isGodlike() || is_agent_mappable(getAvatarId()); + + childSetEnabled("show_on_map_btn", enable_map_btn); +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -338,6 +407,8 @@ BOOL LLPanelAvatarProfile::postBuild() childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL); childSetCommitCallback("overflow_btn", boost::bind(&LLPanelAvatarProfile::onOverflowButtonClicked, this), NULL); childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL); + childSetCommitCallback("show_on_map_btn", (boost::bind( + &LLPanelAvatarProfile::onMapButtonClick, this)), NULL); LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); |