diff options
Diffstat (limited to 'indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 137 |
1 files changed, 115 insertions, 22 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 6e677bbce5..29ca172f60 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -56,13 +56,19 @@ #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); @@ -185,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); @@ -365,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 @@ -1016,13 +1073,26 @@ void LLPanelPermissions::onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data) // static void LLPanelPermissions::onCommitName(LLUICtrl*, void* data) { - //LL_INFOS() << "LLPanelPermissions::onCommitName()" << LL_ENDL; LLPanelPermissions* self = (LLPanelPermissions*)data; LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name"); - if(tb) + if (!tb) + { + return; + } + LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText()); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->isAttachment() && (selection->getNumNodes() == 1) && !tb->getText().empty()) { - LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText()); -// LLSelectMgr::getInstance()->selectionSetObjectName(self->mLabelObjectName->getText()); + LLUUID object_id = selection->getFirstObject()->getAttachmentItemID(); + LLViewerInventoryItem* item = findItem(object_id); + if (item) + { + LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); + new_item->rename(tb->getText()); + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } } } @@ -1030,12 +1100,26 @@ void LLPanelPermissions::onCommitName(LLUICtrl*, void* data) // static void LLPanelPermissions::onCommitDesc(LLUICtrl*, void* data) { - //LL_INFOS() << "LLPanelPermissions::onCommitDesc()" << LL_ENDL; LLPanelPermissions* self = (LLPanelPermissions*)data; LLLineEditor* le = self->getChild<LLLineEditor>("Object Description"); - if(le) + if (!le) + { + return; + } + LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText()); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->isAttachment() && (selection->getNumNodes() == 1)) { - LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText()); + LLUUID object_id = selection->getFirstObject()->getAttachmentItemID(); + LLViewerInventoryItem* item = findItem(object_id); + if (item) + { + LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); + new_item->setDescription(le->getText()); + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } } } @@ -1159,3 +1243,12 @@ void LLPanelPermissions::onCommitIncludeInSearch(LLUICtrl* ctrl, void*) LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get()); } + +LLViewerInventoryItem* LLPanelPermissions::findItem(LLUUID &object_id) +{ + if (!object_id.isNull()) + { + return gInventory.getItem(object_id); + } + return NULL; +} |