Fixed normal bug EXT-6907 ('Show residents profile' menu opens inspector instead of profile) - added 'Url.ShowProfile' action.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/282/

--HG--
branch : product-engine
meow-7.2.2
Eugene Mutavchi 2010-04-21 20:23:55 +03:00
parent b36539f23f
commit 647327d0ec
5 changed files with 23 additions and 2 deletions

View File

@ -1507,6 +1507,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url));
registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url));
registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url));
registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url));
registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url));
registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url));
registrar.add("Url.CopyUrl", boost::bind(&LLUrlAction::copyURLToClipboard, url));

View File

@ -146,3 +146,20 @@ void LLUrlAction::copyLabelToClipboard(std::string url)
LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(match.getLabel()));
}
}
void LLUrlAction::showProfile(std::string url)
{
// Get id from 'secondlife:///app/{cmd}/{id}/{action}'
// and show its profile
LLURI uri(url);
LLSD path_array = uri.pathArray();
if (path_array.size() == 4)
{
std::string id_str = path_array.get(2).asString();
if (LLUUID::validate(id_str))
{
std::string cmd_str = path_array.get(1).asString();
executeSLURL("secondlife:///app/" + cmd_str + "/" + id_str + "/about");
}
}
}

View File

@ -79,6 +79,9 @@ public:
/// copy a Url to the clipboard
static void copyURLToClipboard(std::string url);
/// if the Url specifies an SL command in the form like 'app/{cmd}/{id}/*', show its profile
static void showProfile(std::string url);
/// specify the callbacks to enable this class's functionality
static void setOpenURLCallback(void (*cb) (const std::string& url));
static void setOpenURLInternalCallback(void (*cb) (const std::string& url));

View File

@ -7,7 +7,7 @@
layout="topleft"
name="show_agent">
<menu_item_call.on_click
function="Url.Execute" />
function="Url.ShowProfile" />
</menu_item_call>
<menu_item_separator
layout="topleft" />

View File

@ -7,7 +7,7 @@
layout="topleft"
name="show_group">
<menu_item_call.on_click
function="Url.Execute" />
function="Url.ShowProfile" />
</menu_item_call>
<menu_item_separator
layout="topleft" />