From 18d8be556c03bf6f7db175e51cce93ece37c45d2 Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Tue, 12 Feb 2019 18:57:47 -0800 Subject: Backed out changeset: 25426acca617 Added back the display name floater --- indra/newview/llfloaterdisplayname.cpp | 217 +++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 indra/newview/llfloaterdisplayname.cpp (limited to 'indra/newview/llfloaterdisplayname.cpp') diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp new file mode 100644 index 0000000000..596e8c0dbe --- /dev/null +++ b/indra/newview/llfloaterdisplayname.cpp @@ -0,0 +1,217 @@ +/** + * @file llfloaterdisplayname.cpp + * @author Leyla Farazha + * @brief Implementation of the LLFloaterDisplayName class. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" +#include "llfloaterreg.h" +#include "llfloater.h" + +#include "llnotificationsutil.h" +#include "llviewerdisplayname.h" + +#include "llnotifications.h" +#include "llfloaterdisplayname.h" +#include "llavatarnamecache.h" + +#include "llagent.h" + + +class LLFloaterDisplayName : public LLFloater +{ +public: + LLFloaterDisplayName(const LLSD& key); + virtual ~LLFloaterDisplayName() { } + /*virtual*/ BOOL postBuild(); + void onSave(); + void onReset(); + void onCancel(); + /*virtual*/ void onOpen(const LLSD& key); + +private: + + void onCacheSetName(bool success, + const std::string& reason, + const LLSD& content); +}; + +LLFloaterDisplayName::LLFloaterDisplayName(const LLSD& key) : + LLFloater(key) +{ +} + +void LLFloaterDisplayName::onOpen(const LLSD& key) +{ + getChild("display_name_editor")->clear(); + getChild("display_name_confirm")->clear(); + + LLAvatarName av_name; + LLAvatarNameCache::get(gAgent.getID(), &av_name); + + F64 now_secs = LLDate::now().secondsSinceEpoch(); + + if (now_secs < av_name.mNextUpdate) + { + // ...can't update until some time in the future + F64 next_update_local_secs = + av_name.mNextUpdate - LLStringOps::getLocalTimeOffset(); + LLDate next_update_local(next_update_local_secs); + // display as "July 18 12:17 PM" + std::string next_update_string = + next_update_local.toHTTPDateString("%B %d %I:%M %p"); + getChild("lockout_text")->setTextArg("[TIME]", next_update_string); + getChild("lockout_text")->setVisible(true); + getChild("save_btn")->setEnabled(false); + getChild("display_name_editor")->setEnabled(false); + getChild("display_name_confirm")->setEnabled(false); + getChild("cancel_btn")->setFocus(TRUE); + + } + else + { + getChild("lockout_text")->setVisible(false); + getChild("save_btn")->setEnabled(true); + getChild("display_name_editor")->setEnabled(true); + getChild("display_name_confirm")->setEnabled(true); + + } +} + +BOOL LLFloaterDisplayName::postBuild() +{ + getChild("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this)); + getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this)); + getChild("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this)); + + center(); + + return TRUE; +} + +void LLFloaterDisplayName::onCacheSetName(bool success, + const std::string& reason, + const LLSD& content) +{ + if (success) + { + // Inform the user that the change took place, but will take a while + // to percolate. + LLSD args; + args["DISPLAY_NAME"] = content["display_name"]; + LLNotificationsUtil::add("SetDisplayNameSuccess", args); + return; + } + + // Request failed, notify the user + std::string error_tag = content["error_tag"].asString(); + LL_INFOS() << "set name failure error_tag " << error_tag << LL_ENDL; + + // We might have a localized string for this message + // error_args will usually be empty from the server. + if (!error_tag.empty() + && LLNotifications::getInstance()->templateExists(error_tag)) + { + LLNotificationsUtil::add(error_tag); + return; + } + + // The server error might have a localized message for us + std::string lang_code = LLUI::getLanguage(); + LLSD error_desc = content["error_description"]; + if (error_desc.has( lang_code )) + { + LLSD args; + args["MESSAGE"] = error_desc[lang_code].asString(); + LLNotificationsUtil::add("GenericAlert", args); + return; + } + + // No specific error, throw a generic one + LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); +} + +void LLFloaterDisplayName::onCancel() +{ + setVisible(false); +} + +void LLFloaterDisplayName::onReset() +{ + if (LLAvatarNameCache::hasNameLookupURL()) + { + LLViewerDisplayName::set("",boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); + } + else + { + LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); + } + + setVisible(false); +} + + +void LLFloaterDisplayName::onSave() +{ + std::string display_name_utf8 = getChild("display_name_editor")->getValue().asString(); + std::string display_name_confirm = getChild("display_name_confirm")->getValue().asString(); + + if (display_name_utf8.compare(display_name_confirm)) + { + LLNotificationsUtil::add("SetDisplayNameMismatch"); + return; + } + + const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes + LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8); + if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH) + { + LLSD args; + args["LENGTH"] = llformat("%d", DISPLAY_NAME_MAX_LENGTH); + LLNotificationsUtil::add("SetDisplayNameFailedLength", args); + return; + } + + if (LLAvatarNameCache::hasNameLookupURL()) + { + LLViewerDisplayName::set(display_name_utf8,boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); + } + else + { + LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); + } + + setVisible(false); +} + + +////////////////////////////////////////////////////////////////////////////// +// LLInspectObjectUtil +////////////////////////////////////////////////////////////////////////////// +void LLFloaterDisplayNameUtil::registerFloater() +{ + LLFloaterReg::add("display_name", "floater_display_name.xml", + &LLFloaterReg::build); +} -- cgit v1.3 From 4f38a63b076044e9578a91b769a4e1856241f2ba Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 13 Apr 2022 23:38:02 +0300 Subject: SL-15312 Legacy profiles remake #6 --- indra/newview/llfloaterdisplayname.cpp | 17 - indra/newview/llpanelprofile.cpp | 352 +++++++++++++-------- indra/newview/llpanelprofile.h | 38 +-- .../skins/default/xui/en/floater_display_name.xml | 11 +- .../default/xui/en/floater_profile_permissions.xml | 73 +++++ .../skins/default/xui/en/panel_profile_notes.xml | 43 --- .../default/xui/en/panel_profile_secondlife.xml | 26 +- 7 files changed, 329 insertions(+), 231 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_profile_permissions.xml (limited to 'indra/newview/llfloaterdisplayname.cpp') diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index e6742727d6..3b0c67415a 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -47,7 +47,6 @@ public: virtual ~LLFloaterDisplayName() { } /*virtual*/ BOOL postBuild(); void onSave(); - void onReset(); void onCancel(); /*virtual*/ void onOpen(const LLSD& key); @@ -102,7 +101,6 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) BOOL LLFloaterDisplayName::postBuild() { - getChild("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this)); getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this)); getChild("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this)); @@ -158,21 +156,6 @@ void LLFloaterDisplayName::onCancel() setVisible(false); } -void LLFloaterDisplayName::onReset() -{ - if (LLAvatarNameCache::getInstance()->hasNameLookupURL()) - { - LLViewerDisplayName::set("",boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); - } - else - { - LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); - } - - setVisible(false); -} - - void LLFloaterDisplayName::onSave() { std::string display_name_utf8 = getChild("display_name_editor")->getValue().asString(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index b7bc1e2cba..34caa61fbf 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -574,6 +574,163 @@ public: LLAgentHandler gAgentHandler; +///---------------------------------------------------------------------------- +/// LLFloaterInventoryFinder +///---------------------------------------------------------------------------- + +class LLFloaterProfilePermissions + : public LLFloater + , public LLFriendObserver +{ +public: + LLFloaterProfilePermissions(const LLUUID &avatar_id); + ~LLFloaterProfilePermissions(); + BOOL postBuild() override; + void changed(U32 mask) override; // LLFriendObserver + // todo: check if this (and inventory filters) need a drawFrustum() + +private: + void fillRightsData(); + void rightsConfirmationCallback(const LLSD& notification, const LLSD& response); + void confirmModifyRights(bool grant); + void onCommitRights(); + + void onApplyRights(); + void onCancel(); + + LLCheckBoxCtrl* mOnlineStatus; + LLCheckBoxCtrl* mMapRights; + LLCheckBoxCtrl* mEditObjectRights; + LLButton* mOkBtn; + LLButton* mCancelBtn; + + LLUUID mAvatarID; +}; + +LLFloaterProfilePermissions::LLFloaterProfilePermissions(const LLUUID &avatar_id) + : LLFloater(LLSD()) + , mAvatarID(avatar_id) +{ + buildFromFile("floater_profile_permissions.xml"); +} + +LLFloaterProfilePermissions::~LLFloaterProfilePermissions() +{ +} + +BOOL LLFloaterProfilePermissions::postBuild() +{ + mOnlineStatus = getChild("online_check"); + mMapRights = getChild("map_check"); + mEditObjectRights = getChild("objects_check"); + mOkBtn = getChild("perms_btn_ok"); + mCancelBtn = getChild("perms_btn_cancel"); + + mEditObjectRights->setCommitCallback([this](LLUICtrl*, void*) { onCommitRights(); }, nullptr); + mOkBtn->setCommitCallback([this](LLUICtrl*, void*) { onApplyRights(); }, nullptr); + mCancelBtn->setCommitCallback([this](LLUICtrl*, void*) { onCancel(); }, nullptr); + + fillRightsData(); // is it possible to not be friends at this point? This might need to be onOpen() + + return TRUE; +} + +void LLFloaterProfilePermissions::changed(U32 mask) +{ + //todo +} + +void LLFloaterProfilePermissions::fillRightsData() +{ + const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(mAvatarID); + // If true - we are viewing friend's profile, enable check boxes and set values. + if (relation) + { + S32 rights = relation->getRightsGrantedTo(); + + mOnlineStatus->setValue(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); + mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); + } + else + { + closeFloater(); + LL_INFOS("ProfilePermissions") << "Floater closing since agent is no longer a friend" << LL_ENDL; + } +} + +void LLFloaterProfilePermissions::rightsConfirmationCallback(const LLSD& notification, + const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) + { + mEditObjectRights->setValue(mEditObjectRights->getValue().asBoolean() ? FALSE : TRUE); + } +} + +void LLFloaterProfilePermissions::confirmModifyRights(bool grant) +{ + LLSD args; + args["NAME"] = LLSLURL("agent", mAvatarID, "completename").getSLURLString(); + LLNotificationsUtil::add(grant ? "GrantModifyRights" : "RevokeModifyRights", args, LLSD(), + boost::bind(&LLFloaterProfilePermissions::rightsConfirmationCallback, this, _1, _2)); +} + +void LLFloaterProfilePermissions::onCommitRights() +{ + const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(mAvatarID); + + if (!buddy_relationship) + { + LL_WARNS("ProfilePermissions") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL; + return; + } + + bool allow_modify_objects = mEditObjectRights->getValue().asBoolean(); + + // if modify objects checkbox clicked + if (buddy_relationship->isRightGrantedTo( + LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects) + { + confirmModifyRights(allow_modify_objects); + } +} + +void LLFloaterProfilePermissions::onApplyRights() +{ + const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(mAvatarID); + + if (!buddy_relationship) + { + LL_WARNS("ProfilePermissions") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL; + return; + } + + S32 rights = 0; + + if (mOnlineStatus->getValue().asBoolean()) + { + rights |= LLRelationship::GRANT_ONLINE_STATUS; + } + if (mMapRights->getValue().asBoolean()) + { + rights |= LLRelationship::GRANT_MAP_LOCATION; + } + if (mEditObjectRights->getValue().asBoolean()) + { + rights |= LLRelationship::GRANT_MODIFY_OBJECTS; + } + + LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(mAvatarID, rights); + + closeFloater(); +} + +void LLFloaterProfilePermissions::onCancel() +{ + closeFloater(); +} ////////////////////////////////////////////////////////////////////////// // LLPanelProfileSecondLife @@ -613,12 +770,21 @@ BOOL LLPanelProfileSecondLife::postBuild() mAgentActionMenuButton = getChild("agent_actions_menu"); mSaveDescriptionChanges = getChild("save_description_changes"); mDiscardDescriptionChanges = getChild("discard_description_changes"); + mSeeOnlineToggle = getChild("allow_to_see_online"); + mSeeOnMapToggle = getChild("allow_to_see_on_map"); + mEditObjectsToggle = getChild("allow_edit_my_objects"); mGroupList->setDoubleClickCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { LLPanelProfileSecondLife::openGroupProfile(); }); mGroupList->setReturnCallback([this](LLUICtrl*, const LLSD&) { LLPanelProfileSecondLife::openGroupProfile(); }); mSaveDescriptionChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveDescriptionChanges(); }, nullptr); mDiscardDescriptionChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardDescriptionChanges(); }, nullptr); mDescriptionEdit->setKeystrokeCallback([this](LLTextEditor* caller) { onSetDescriptionDirty(); }); + //mSeeOnlineToggle->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); + mSeeOnlineToggle->setMouseUpCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); + // mSeeOnMapToggle->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); + mSeeOnMapToggle->setMouseUpCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); + //mEditObjectsToggle->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); + mEditObjectsToggle->setMouseUpCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); return TRUE; } @@ -639,7 +805,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) childSetVisible("notes_panel", !own_profile); childSetVisible("settings_panel", own_profile); childSetVisible("about_buttons_panel", own_profile); - childSetVisible("permissions_panel", !own_profile); if (own_profile && !getEmbedded()) { @@ -672,6 +837,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) { mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : TRUE); updateOnlineStatus(); + fillRightsData(); } updateButtons(); @@ -715,10 +881,6 @@ void LLPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorTyp void LLPanelProfileSecondLife::resetData() { resetLoading(); - getChild("complete_name")->setValue(LLStringUtil::null); - getChild("register_date")->setValue(LLStringUtil::null); - getChild("acc_status_text")->setValue(LLStringUtil::null); - getChild("partner_text")->setValue(LLStringUtil::null); // Set default image and 1:1 dimensions for it mSecondLifePic->setValue("Generic_Person_Large"); @@ -728,6 +890,11 @@ void LLPanelProfileSecondLife::resetData() setDescriptionText(LLStringUtil::null); mGroups.clear(); mGroupList->setGroups(mGroups); + + mSeeOnlineToggle->setToggleState(false); + mSeeOnMapToggle->setToggleState(false); + mEditObjectsToggle->setToggleState(false); + childSetVisible("permissions_panel", false); } void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avatar_data) @@ -891,6 +1058,28 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data getChild("account_info")->setValue(caption_text); } +void LLPanelProfileSecondLife::fillRightsData() +{ + const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + // If true - we are viewing friend's profile, enable check boxes and set values. + if (relation) + { + S32 rights = relation->getRightsGrantedTo(); + + mSeeOnlineToggle->setToggleState(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE); + mSeeOnMapToggle->setToggleState(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); + mEditObjectsToggle->setToggleState(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); + } + else + { + mSeeOnlineToggle->setToggleState(false); + mSeeOnMapToggle->setToggleState(false); + mEditObjectsToggle->setToggleState(false); + } + + childSetVisible("permissions_panel", NULL != relation); +} + void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) { LLRect imageRect = mSecondLifePicLayout->getRect(); @@ -936,7 +1125,14 @@ void LLPanelProfileSecondLife::onImageLoaded(BOOL success, // virtual, called by LLAvatarTracker void LLPanelProfileSecondLife::changed(U32 mask) { - updateOnlineStatus(); + if (mask & LLFriendObserver::ONLINE) + { + updateOnlineStatus(); + } + if (mask != LLFriendObserver::ONLINE) + { + fillRightsData(); + } updateButtons(); } @@ -1000,6 +1196,7 @@ void LLPanelProfileSecondLife::processOnlineStatus(bool online) { } +//todo: remove? void LLPanelProfileSecondLife::updateButtons() { LLPanelProfileTab::updateButtons(); @@ -1019,7 +1216,7 @@ class LLProfileImagePicker : public LLFilePickerThread public: LLProfileImagePicker(EProfileImageType type, LLHandle *handle); ~LLProfileImagePicker(); - virtual void notify(const std::vector& filenames); + void notify(const std::vector& filenames) override; private: LLHandle *mHandle; @@ -1321,6 +1518,25 @@ void LLPanelProfileSecondLife::onDiscardDescriptionChanges() setDescriptionText(mDescriptionText); } +void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() +{ + LLFloater *floater = mFloaterPermissionsHandle.get(); + if (!floater) + { + LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(getAvatarId()); + mFloaterPermissionsHandle = perms->getHandle(); + perms->openFloater(); + + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + if (parent_floater) + parent_floater->addDependentFloater(mFloaterPermissionsHandle); + } + else // already open + { + floater->closeFloater(); + } +} + ////////////////////////////////////////////////////////////////////////// // LLPanelProfileWeb @@ -1658,10 +1874,6 @@ LLPanelProfileNotes::LLPanelProfileNotes() LLPanelProfileNotes::~LLPanelProfileNotes() { - if (getAvatarId().notNull()) - { - LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); - } } void LLPanelProfileNotes::updateData() @@ -1682,14 +1894,10 @@ void LLPanelProfileNotes::updateData() BOOL LLPanelProfileNotes::postBuild() { - mOnlineStatus = getChild("status_check"); - mMapRights = getChild("map_check"); - mEditObjectRights = getChild("objects_check"); mNotesEditor = getChild("notes_edit"); mSaveChanges = getChild("notes_save_changes"); mDiscardChanges = getChild("notes_discard_changes"); - mEditObjectRights->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitRights, this)); mSaveChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveNotesChanges(); }, nullptr); mDiscardChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardNotesChanges(); }, nullptr); mNotesEditor->setKeystrokeCallback([this](LLTextEditor* caller) { onSetNotesDirty(); }); @@ -1702,28 +1910,6 @@ void LLPanelProfileNotes::onOpen(const LLSD& key) LLPanelProfileTab::onOpen(key); resetData(); - - fillRightsData(); -} - -void LLPanelProfileNotes::fillRightsData() -{ - mOnlineStatus->setValue(FALSE); - mMapRights->setValue(FALSE); - mEditObjectRights->setValue(FALSE); - - const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - // If true - we are viewing friend's profile, enable check boxes and set values. - if(relation) - { - S32 rights = relation->getRightsGrantedTo(); - - mOnlineStatus->setValue(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); - mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); - } - - enableCheckboxes(NULL != relation); } void LLPanelProfileNotes::onCommitNotes() @@ -1781,76 +1967,6 @@ void LLPanelProfileNotes::onDiscardNotesChanges() setNotesText(mCurrentNotes); } -void LLPanelProfileNotes::rightsConfirmationCallback(const LLSD& notification, - const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) - { - mEditObjectRights->setValue(mEditObjectRights->getValue().asBoolean() ? FALSE : TRUE); - } -} - -void LLPanelProfileNotes::confirmModifyRights(bool grant) -{ - LLSD args; - args["NAME"] = LLSLURL("agent", getAvatarId(), "completename").getSLURLString(); - - - LLNotificationsUtil::add(grant ? "GrantModifyRights" : "RevokeModifyRights", args, LLSD(), - boost::bind(&LLPanelProfileNotes::rightsConfirmationCallback, this, _1, _2)); - -} - -void LLPanelProfileNotes::onCommitRights() -{ - const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - - if (!buddy_relationship) - { - LL_WARNS("LegacyProfile") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL; - return; - } - - bool allow_modify_objects = mEditObjectRights->getValue().asBoolean(); - - // if modify objects checkbox clicked - if (buddy_relationship->isRightGrantedTo( - LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects) - { - confirmModifyRights(allow_modify_objects); - } -} - -void LLPanelProfileNotes::applyRights() -{ - const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - - if (!buddy_relationship) - { - // Lets have a warning log message instead of having a crash. EXT-4947. - LL_WARNS("LegacyProfile") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL; - return; - } - - S32 rights = 0; - - if (mOnlineStatus->getValue().asBoolean()) - { - rights |= LLRelationship::GRANT_ONLINE_STATUS; - } - if (mMapRights->getValue().asBoolean()) - { - rights |= LLRelationship::GRANT_MAP_LOCATION; - } - if (mEditObjectRights->getValue().asBoolean()) - { - rights |= LLRelationship::GRANT_MODIFY_OBJECTS; - } - - LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(), rights); -} - void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType type) { if (APT_NOTES == type) @@ -1875,35 +1991,13 @@ void LLPanelProfileNotes::resetData() { resetLoading(); mNotesEditor->setValue(LLStringUtil::null); - mOnlineStatus->setValue(FALSE); - mMapRights->setValue(FALSE); - mEditObjectRights->setValue(FALSE); -} - -void LLPanelProfileNotes::enableCheckboxes(bool enable) -{ - mOnlineStatus->setEnabled(enable); - mMapRights->setEnabled(enable); - mEditObjectRights->setEnabled(enable); -} - -// virtual, called by LLAvatarTracker -void LLPanelProfileNotes::changed(U32 mask) -{ - // update rights to avoid have checkboxes enabled when friendship is terminated. EXT-4947. - fillRightsData(); } void LLPanelProfileNotes::setAvatarId(const LLUUID& avatar_id) { if (avatar_id.notNull()) { - if (getAvatarId().notNull()) - { - LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); - } LLPanelProfileTab::setAvatarId(avatar_id); - LLAvatarTracker::instance().addParticularFriendObserver(getAvatarId(), this); } } diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 428f4ce78d..1d871415e8 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -109,27 +109,29 @@ protected: /** * Process profile related data received from server. */ - virtual void processProfileProperties(const LLAvatarData* avatar_data); + void processProfileProperties(const LLAvatarData* avatar_data); /** * Processes group related data received from server. */ - virtual void processGroupProperties(const LLAvatarGroups* avatar_groups); + void processGroupProperties(const LLAvatarGroups* avatar_groups); /** * Fills common for Avatar profile and My Profile fields. */ - virtual void fillCommonData(const LLAvatarData* avatar_data); + void fillCommonData(const LLAvatarData* avatar_data); /** * Fills partner data. */ - virtual void fillPartnerData(const LLAvatarData* avatar_data); + void fillPartnerData(const LLAvatarData* avatar_data); /** * Fills account status. */ - virtual void fillAccountStatus(const LLAvatarData* avatar_data); + void fillAccountStatus(const LLAvatarData* avatar_data); + + void fillRightsData(); void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep); static void onImageLoaded(BOOL success, @@ -168,6 +170,7 @@ private: void onSetDescriptionDirty(); void onSaveDescriptionChanges(); void onDiscardDescriptionChanges(); + void onShowAgentPermissionsDialog(); private: typedef std::map group_map_t; @@ -182,6 +185,11 @@ private: LLMenuButton* mAgentActionMenuButton; LLButton* mSaveDescriptionChanges; LLButton* mDiscardDescriptionChanges; + LLButton* mSeeOnlineToggle; + LLButton* mSeeOnMapToggle; + LLButton* mEditObjectsToggle; + + LLHandle mFloaterPermissionsHandle; bool mVoiceStatus; bool mWaitingForImageUpload; @@ -285,7 +293,6 @@ protected: */ class LLPanelProfileNotes : public LLPanelProfileTab - , public LLFriendObserver { public: LLPanelProfileNotes(); @@ -293,11 +300,6 @@ public: virtual void setAvatarId(const LLUUID& avatar_id); - /** - * LLFriendObserver trigger - */ - virtual void changed(U32 mask); - /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ BOOL postBuild(); @@ -310,26 +312,12 @@ public: /*virtual*/ void updateData(); protected: - /** - * Fills rights data for friends. - */ - void fillRightsData(); - - void rightsConfirmationCallback(const LLSD& notification, const LLSD& response); - void confirmModifyRights(bool grant); - void onCommitRights(); void onCommitNotes(); - void enableCheckboxes(bool enable); void setNotesText(const std::string &text); void onSetNotesDirty(); void onSaveNotesChanges(); void onDiscardNotesChanges(); - void applyRights(); - - LLCheckBoxCtrl* mOnlineStatus; - LLCheckBoxCtrl* mMapRights; - LLCheckBoxCtrl* mEditObjectRights; LLTextEditor* mNotesEditor; LLButton* mSaveChanges; LLButton* mDiscardChanges; diff --git a/indra/newview/skins/default/xui/en/floater_display_name.xml b/indra/newview/skins/default/xui/en/floater_display_name.xml index 9a9fd32a77..d14b4a1699 100644 --- a/indra/newview/skins/default/xui/en/floater_display_name.xml +++ b/indra/newview/skins/default/xui/en/floater_display_name.xml @@ -83,21 +83,12 @@ tool_tip="Save your new Display Name" top_pad="40" width="120" /> -