Fixed bug EXT-4582 ([BSI] "Report" from avatar inspector does not auto-populate "Abuser name" when Resident is not nearby).

Added method LLFloaterReporter::showFromAvatar() to use for remote avatars.

--HG--
branch : product-engine
master
Vadim Savchuk 2010-01-22 20:08:09 +02:00
parent ff852efdd2
commit 189329853b
3 changed files with 36 additions and 13 deletions

View File

@ -277,13 +277,8 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
{
object_owner.append("Unknown");
}
childSetText("object_name", object_owner);
std::string owner_link =
LLSLURL::buildCommand("agent", mObjectID, "inspect");
childSetText("owner_name", owner_link);
childSetText("abuser_name_edit", object_owner);
mAbuserID = object_id;
mOwnerName = object_owner;
setFromAvatar(object_id, object_owner);
}
else
{
@ -305,7 +300,6 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
}
}
void LLFloaterReporter::onClickSelectAbuser()
{
gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ));
@ -323,6 +317,17 @@ void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names,
}
void LLFloaterReporter::setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name)
{
mAbuserID = mObjectID = avatar_id;
mOwnerName = avatar_name;
std::string avatar_link = LLSLURL::buildCommand("agent", mObjectID, "inspect");
childSetText("owner_name", avatar_link);
childSetText("object_name", avatar_name); // name
childSetText("abuser_name_edit", avatar_name);
}
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
@ -458,9 +463,8 @@ void LLFloaterReporter::showFromMenu(EReportType report_type)
}
}
// static
void LLFloaterReporter::showFromObject(const LLUUID& object_id)
void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name)
{
LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter");
@ -469,8 +473,11 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id)
LLAgentUI::buildFullname(fullname);
f->childSetText("reporter_field", fullname);
// Request info for this object
f->getObjectInfo(object_id);
if (avatar_name.empty())
// Request info for this object
f->getObjectInfo(object_id);
else
f->setFromAvatar(object_id, avatar_name);
// Need to deselect on close
f->mDeselectOnClose = TRUE;
@ -479,6 +486,18 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id)
}
// static
void LLFloaterReporter::showFromObject(const LLUUID& object_id)
{
show(object_id);
}
// static
void LLFloaterReporter::showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name)
{
show(avatar_id, avatar_name);
}
void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id)
{
childSetText("object_name", object_name);

View File

@ -93,6 +93,7 @@ public:
static void showFromMenu(EReportType report_type);
static void showFromObject(const LLUUID& object_id);
static void showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name);
static void onClickSend (void *userdata);
static void onClickCancel (void *userdata);
@ -109,6 +110,8 @@ public:
void setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id);
private:
static void show(const LLUUID& object_id, const std::string& avatar_name = LLStringUtil::null);
void takeScreenshot();
void sendReportViaCaps(std::string url);
void uploadImage();
@ -121,6 +124,7 @@ private:
void enableControls(BOOL own_avatar);
void getObjectInfo(const LLUUID& object_id);
void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
void setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name = LLStringUtil::null);
private:
EReportType mReportType;

View File

@ -689,7 +689,7 @@ void LLInspectAvatar::onToggleMute()
void LLInspectAvatar::onClickReport()
{
LLFloaterReporter::showFromObject(mAvatarID);
LLFloaterReporter::showFromAvatar(mAvatarID, mAvatarName);
closeFloater();
}