diff options
Diffstat (limited to 'indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 82 |
1 files changed, 60 insertions, 22 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 29ca172f60..a7c53a7050 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<LLNameBox>("Group Name Proxy"); + mLabelOwnerName = getChild<LLTextBox>("Owner Name"); + mLabelCreatorName = getChild<LLTextBox>("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<LLUICtrl>("Creator Icon")->setVisible(FALSE); - getChild<LLUICtrl>("Creator Name")->setValue(LLStringUtil::null); - getChildView("Creator Name")->setEnabled(FALSE); + mLabelCreatorName->setValue(LLStringUtil::null); + mLabelCreatorName->setEnabled(FALSE); getChildView("Owner:")->setEnabled(FALSE); getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE); getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); - getChild<LLUICtrl>("Owner Name")->setValue(LLStringUtil::null); - getChildView("Owner Name")->setEnabled(FALSE); + mLabelOwnerName->setValue(LLStringUtil::null); + mLabelOwnerName->setEnabled(FALSE); getChildView("Group:")->setEnabled(FALSE); getChild<LLUICtrl>("Group Name Proxy")->setValue(LLStringUtil::null); @@ -214,8 +224,6 @@ void LLPanelPermissions::disableAll() getChildView("Description:")->setEnabled(FALSE); getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null); getChildView("Object Description")->setEnabled(FALSE); - - getChildView("Permissions:")->setEnabled(FALSE); getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE); getChildView("checkbox share with group")->setEnabled(FALSE); @@ -369,8 +377,6 @@ void LLPanelPermissions::refresh() getChildView("pathfinding_attributes_value")->setEnabled(TRUE); getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); - - getChildView("Permissions:")->setEnabled(TRUE); // Update creator text field getChildView("Creator:")->setEnabled(TRUE); @@ -383,22 +389,29 @@ 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<LLTextBox>("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"; LLAvatarName av_name; + style_params.link_href = creator_app_link; if (LLAvatarNameCache::get(mCreatorID, &av_name)) { - // If name isn't present, this will 'request' it and trigger refresh() again - LLTextBox* text_box = getChild<LLTextBox>("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<LLAvatarIconCtrl>("Creator Icon")->setValue(mCreatorID); getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(TRUE); - getChildView("Creator Name")->setEnabled(TRUE); + mLabelCreatorName->setEnabled(TRUE); // Update owner text field getChildView("Owner:")->setEnabled(TRUE); @@ -413,9 +426,8 @@ void LLPanelPermissions::refresh() LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mOwnerID); if (group_data && group_data->isGroupPropertiesDataComplete()) { - LLTextBox* text_box = getChild<LLTextBox>("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<LLGroupIconCtrl>("Owner Group Icon")->setIconId(group_data->mInsigniaID); getChild<LLGroupIconCtrl>("Owner Group Icon")->setVisible(TRUE); getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE); @@ -444,18 +456,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<LLTextBox>("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<LLAvatarIconCtrl>("Owner Icon")->setValue(owner_id); getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(TRUE); getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); } - getChildView("Owner Name")->setEnabled(TRUE); + mLabelOwnerName->setEnabled(TRUE); // update group text field getChildView("Group:")->setEnabled(TRUE); @@ -785,7 +806,7 @@ void LLPanelPermissions::refresh() else { getChild<LLUICtrl>("checkbox share with group")->setValue(TRUE); - getChild<LLUICtrl>("checkbox share with group")->setTentative( TRUE); + getChild<LLUICtrl>("checkbox share with group")->setTentative(!has_change_perm_ability); getChildView("button deed")->setEnabled(gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } @@ -944,6 +965,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*) |