From 85df4c30315500b7bd6e420248fd9174ad6c8570 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 2 May 2018 18:34:59 +0300 Subject: MAINT-8616 FIXED Edit Tool often displays the wrong Creator and/or Owner of an object --- indra/newview/llpanelpermissions.cpp | 75 ++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 17 deletions(-) (limited to 'indra/newview/llpanelpermissions.cpp') diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 29ca172f60..0e5a7aec0d 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -171,6 +171,8 @@ BOOL LLPanelPermissions::postBuild() childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); mLabelGroupName = getChild("Group Name Proxy"); + mLabelOwnerName = getChild("Owner Name"); + mLabelCreatorName = getChild("Creator Name"); return TRUE; } @@ -178,6 +180,14 @@ BOOL LLPanelPermissions::postBuild() LLPanelPermissions::~LLPanelPermissions() { + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } // base class will take care of everything } @@ -192,14 +202,14 @@ void LLPanelPermissions::disableAll() getChildView("Creator:")->setEnabled(FALSE); getChild("Creator Icon")->setVisible(FALSE); - getChild("Creator Name")->setValue(LLStringUtil::null); - getChildView("Creator Name")->setEnabled(FALSE); + mLabelCreatorName->setValue(LLStringUtil::null); + mLabelCreatorName->setEnabled(FALSE); getChildView("Owner:")->setEnabled(FALSE); getChild("Owner Icon")->setVisible(FALSE); getChild("Owner Group Icon")->setVisible(FALSE); - getChild("Owner Name")->setValue(LLStringUtil::null); - getChildView("Owner Name")->setEnabled(FALSE); + mLabelOwnerName->setValue(LLStringUtil::null); + mLabelOwnerName->setEnabled(FALSE); getChildView("Group:")->setEnabled(FALSE); getChild("Group Name Proxy")->setValue(LLStringUtil::null); @@ -383,7 +393,7 @@ void LLPanelPermissions::refresh() style_params.color = link_color; style_params.readonly_color = link_color; style_params.is_link = true; // link will be added later - const LLFontGL* fontp = getChild("Creator Name")->getFont(); + const LLFontGL* fontp = mLabelCreatorName->getFont(); style_params.font.name = LLFontGL::nameFromFont(fontp); style_params.font.size = LLFontGL::sizeFromFont(fontp); style_params.font.style = "UNDERLINE"; @@ -391,14 +401,20 @@ void LLPanelPermissions::refresh() LLAvatarName av_name; if (LLAvatarNameCache::get(mCreatorID, &av_name)) { - // If name isn't present, this will 'request' it and trigger refresh() again - LLTextBox* text_box = getChild("Creator Name"); - style_params.link_href = creator_app_link; - text_box->setText(av_name.getCompleteName(), style_params); + updateCreatorName(mCreatorID, av_name, style_params); + } + else + { + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } + mLabelCreatorName->setText(LLTrans::getString("None")); + mCreatorCacheConnection = LLAvatarNameCache::get(mCreatorID, boost::bind(&LLPanelPermissions::updateCreatorName, this, _1, _2, style_params)); } getChild("Creator Icon")->setValue(mCreatorID); getChild("Creator Icon")->setVisible(TRUE); - getChildView("Creator Name")->setEnabled(TRUE); + mLabelCreatorName->setEnabled(TRUE); // Update owner text field getChildView("Owner:")->setEnabled(TRUE); @@ -413,9 +429,8 @@ void LLPanelPermissions::refresh() LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mOwnerID); if (group_data && group_data->isGroupPropertiesDataComplete()) { - LLTextBox* text_box = getChild("Owner Name"); style_params.link_href = owner_app_link; - text_box->setText(group_data->mName, style_params); + mLabelOwnerName->setText(group_data->mName, style_params); getChild("Owner Group Icon")->setIconId(group_data->mInsigniaID); getChild("Owner Group Icon")->setVisible(TRUE); getChild("Owner Icon")->setVisible(FALSE); @@ -444,18 +459,27 @@ void LLPanelPermissions::refresh() } owner_id = mLastOwnerID; } + + style_params.link_href = owner_app_link; if (LLAvatarNameCache::get(owner_id, &av_name)) { - // If name isn't present, this will 'request' it and trigger refresh() again - LLTextBox* text_box = getChild("Owner Name"); - style_params.link_href = owner_app_link; - text_box->setText(av_name.getCompleteName(), style_params); + updateOwnerName(owner_id, av_name, style_params); + } + else + { + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + mLabelOwnerName->setText(LLTrans::getString("None")); + mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLPanelPermissions::updateOwnerName, this, _1, _2, style_params)); } + getChild("Owner Icon")->setValue(owner_id); getChild("Owner Icon")->setVisible(TRUE); getChild("Owner Group Icon")->setVisible(FALSE); } - getChildView("Owner Name")->setEnabled(TRUE); + mLabelOwnerName->setEnabled(TRUE); // update group text field getChildView("Group:")->setEnabled(TRUE); @@ -944,6 +968,23 @@ void LLPanelPermissions::refresh() getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); } +void LLPanelPermissions::updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params) +{ + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + mLabelOwnerName->setText(owner_name.getCompleteName(), style_params); +} + +void LLPanelPermissions::updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params) +{ + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } + mLabelCreatorName->setText(creator_name.getCompleteName(), style_params); +} // static void LLPanelPermissions::onClickClaim(void*) -- cgit v1.2.3