From a04eb16976baef0d4cb75658d8a25b21c4eec840 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Fri, 27 Nov 2009 13:34:08 +0200 Subject: fixed EXT-2740 "There is no alert on giving/removing modify rights to resident" --HG-- branch : product-engine --- indra/newview/llpanelavatar.cpp | 50 ++++++++++++++++++++++++++++++++++++++++- indra/newview/llpanelavatar.h | 3 +++ 2 files changed, 52 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 87f1ac1f9f..4c26440bda 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -50,6 +50,7 @@ #include "llweb.h" #include "llfloaterworldmap.h" #include "llfloaterreg.h" +#include "llnotifications.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLDropTarget @@ -199,6 +200,46 @@ void LLPanelAvatarNotes::onCommitNotes() LLAvatarPropertiesProcessor::getInstance()-> sendNotes(getAvatarId(),notes); } +void LLPanelAvatarNotes::rightsConfirmationCallback(const LLSD& notification, + const LLSD& response, S32 rights) +{ + S32 option = LLNotification::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) + { + LLNotifications::instance().add("GrantModifyRights", args, LLSD(), + boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this, + _1, _2, rights)); + } + else + { + LLNotifications::instance().add("RevokeModifyRights", args, LLSD(), + boost::bind(&LLPanelAvatarNotes::rightsConfirmationCallback, this, + _1, _2, rights)); + } +} + void LLPanelAvatarNotes::onCommitRights() { S32 rights = 0; @@ -210,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) diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index dc94ff02ca..f54aeee4eb 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -260,6 +260,9 @@ protected: */ void fillRightsData(); + void rightsConfirmationCallback(const LLSD& notification, + const LLSD& response, S32 rights); + void confirmModifyRights(bool grant, S32 rights); void onCommitRights(); void onCommitNotes(); -- cgit v1.2.3