diff options
Diffstat (limited to 'indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 86 |
1 files changed, 71 insertions, 15 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 203c57b732..29ca172f60 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,87 @@ 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 + const LLFontGL* fontp = getChild<LLTextBox>("Creator Name")->getFont(); + style_params.font.name = LLFontGL::nameFromFont(fontp); + style_params.font.size = LLFontGL::sizeFromFont(fontp); + 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 |