Skip to content
Snippets Groups Projects
Commit 85df4c30 authored by maxim_productengine's avatar maxim_productengine
Browse files

MAINT-8616 FIXED Edit Tool often displays the wrong Creator and/or Owner of an object

parent 22a33cc8
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......@@ -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<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";
......@@ -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<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 +429,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 +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<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);
......@@ -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*)
......
......@@ -28,6 +28,7 @@
#define LL_LLPANELPERMISSIONS_H
#include "llpanel.h"
#include "llstyle.h"
#include "lluuid.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -36,6 +37,8 @@
// Panel for permissions of an object.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLAvatarName;
class LLTextBox;
class LLNameBox;
class LLViewerInventoryItem;
......@@ -46,7 +49,8 @@ class LLPanelPermissions : public LLPanel
virtual ~LLPanelPermissions();
/*virtual*/ BOOL postBuild();
void updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params);
void updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params);
void refresh(); // refresh all labels as needed
protected:
......@@ -85,10 +89,14 @@ class LLPanelPermissions : public LLPanel
private:
LLNameBox* mLabelGroupName; // group name
LLTextBox* mLabelOwnerName;
LLTextBox* mLabelCreatorName;
LLUUID mCreatorID;
LLUUID mOwnerID;
LLUUID mLastOwnerID;
boost::signals2::connection mOwnerCacheConnection;
boost::signals2::connection mCreatorCacheConnection;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment