diff options
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 83 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_tools.xml | 42 |
2 files changed, 104 insertions, 21 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 203c57b732..cf38090798 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -56,15 +56,20 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llavataractions.h" +#include "llavatariconctrl.h" #include "llnamebox.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" #include "llspinctrl.h" #include "roles_constants.h" #include "llgroupactions.h" +#include "llgroupiconctrl.h" #include "lltrans.h" #include "llinventorymodel.h" +#include "llavatarnamecache.h" +#include "llcachename.h" + U8 string_value_to_click_action(std::string p_value); std::string click_action_to_string_value( U8 action); @@ -186,10 +191,13 @@ void LLPanelPermissions::disableAll() getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLStringUtil::null); getChildView("Creator:")->setEnabled(FALSE); + getChild<LLUICtrl>("Creator Icon")->setVisible(FALSE); getChild<LLUICtrl>("Creator Name")->setValue(LLStringUtil::null); getChildView("Creator Name")->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); @@ -366,39 +374,84 @@ void LLPanelPermissions::refresh() // Update creator text field getChildView("Creator:")->setEnabled(TRUE); - std::string creator_name; - LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); - - getChild<LLUICtrl>("Creator Name")->setValue(creator_name); + std::string creator_app_link; + LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_app_link); + + // Style for creator and owner links (both group and agent) + LLStyle::Params style_params; + LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + style_params.color = link_color; + style_params.readonly_color = link_color; + style_params.is_link = true; // link will be added later + style_params.font.style = "UNDERLINE"; + + 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<LLTextBox>("Creator Name"); + style_params.link_href = creator_app_link; + text_box->setText(av_name.getCompleteName(), style_params); + } + getChild<LLAvatarIconCtrl>("Creator Icon")->setValue(mCreatorID); + getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(TRUE); getChildView("Creator Name")->setEnabled(TRUE); // Update owner text field getChildView("Owner:")->setEnabled(TRUE); - std::string owner_name; - const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); - if (mOwnerID.isNull()) + std::string owner_app_link; + const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_app_link); + + + if (LLSelectMgr::getInstance()->selectIsGroupOwned()) { - if (LLSelectMgr::getInstance()->selectIsGroupOwned()) + // Group owned already displayed by selectGetOwner + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mOwnerID); + if (group_data && group_data->isGroupPropertiesDataComplete()) { - // Group owned already displayed by selectGetOwner + LLTextBox* text_box = getChild<LLTextBox>("Owner Name"); + style_params.link_href = owner_app_link; + text_box->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); } else { + // Triggers refresh + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mOwnerID); + } + } + else + { + LLUUID owner_id = mOwnerID; + if (owner_id.isNull()) + { // Display last owner if public - std::string last_owner_name; - LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); + std::string last_owner_app_link; + LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_app_link); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC - if (!mLastOwnerID.isNull() && !last_owner_name.empty()) + if (!mLastOwnerID.isNull() && !last_owner_app_link.empty()) { - owner_name.append(", last "); - owner_name.append(last_owner_name); + owner_app_link.append(", last "); + owner_app_link.append(last_owner_app_link); } + owner_id = mLastOwnerID; + } + 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); } + getChild<LLAvatarIconCtrl>("Owner Icon")->setValue(owner_id); + getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(TRUE); + getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); } - getChild<LLUICtrl>("Owner Name")->setValue(owner_name); getChildView("Owner Name")->setEnabled(TRUE); // update group text field diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 91e4c1b603..c3a5a0dce8 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -946,18 +946,28 @@ width="90"> Creator: </text> + <avatar_icon + default_icon_name="Generic_Person" + height="18" + follows="left|top" + layout="topleft" + left_pad="1" + name="Creator Icon" + visible="false" + top_delta="0" + width="18" /> <!-- *NOTE: Intentionally wide for long names --> <text type="string" length="1" follows="left|top" - left_pad="0" + left_pad="1" height="29" layout="topleft" name="Creator Name" - top_delta="0" + top_delta="-1" translate="false" - width="190" + width="170" word_wrap="true" use_ellipses="true"> TestString PleaseIgnore (please.ignore) @@ -974,6 +984,26 @@ width="90"> Owner: </text> + <avatar_icon + default_icon_name="Generic_Person" + height="18" + follows="left|top" + layout="topleft" + left_pad="1" + name="Owner Icon" + visible="false" + top_delta="0" + width="18" /> + <group_icon + default_icon_name="Generic_Group" + height="18" + follows="left|top" + layout="topleft" + left_pad="-18" + name="Owner Group Icon" + visible="false" + top_delta="0" + width="18" /> <!-- *NOTE: Intentionally wide for long names --> <text type="string" @@ -982,10 +1012,10 @@ height="29" layout="topleft" name="Owner Name" - left_pad="0" - top_delta="0" + left_pad="1" + top_delta="-1" translate="false" - width="190" + width="170" word_wrap="true" use_ellipses="true"> TestString PleaseIgnore (please.ignore) |