From f5b3fc596d029d3ac2f953ee94ea3ae131d00940 Mon Sep 17 00:00:00 2001 From: callum Date: Wed, 6 Oct 2010 15:34:32 -0700 Subject: Add support for debug setting to disable link highlight & follow in URLs that appear in XUI widgets --- indra/llui/llurlentry.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 5680ab8bd4..13c729ace9 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -27,6 +27,7 @@ #include "linden_common.h" #include "llurlentry.h" +#include "lluictrl.h" #include "lluri.h" #include "llurlmatch.h" #include "llurlregistry.h" @@ -146,6 +147,15 @@ void LLUrlEntryBase::callObservers(const std::string &id, const std::string &lab } } +/// is this a match for a URL that should not be hyperlinked? +bool LLUrlEntryBase::isLinkDisabled() const +{ + // this allows us to have a global setting to turn off text hyperlink highlighting/action + bool globally_disabled = LLUI::sSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions"); + + return mDisabledLink || globally_disabled; +} + static std::string getStringAfterToken(const std::string str, const std::string token) { size_t pos = str.find(token); -- cgit v1.2.3 From d276950c8d4d53f9d5d6497d5a4a4582c499938a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Nov 2010 17:03:52 -0800 Subject: build fixes --- indra/llui/llurlentry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index ebd0f912b8..13bfeb5e2d 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -174,7 +174,7 @@ bool LLUrlEntryBase::isLinkDisabled() const // this allows us to have a global setting to turn off text hyperlink highlighting/action bool globally_disabled = LLUI::sSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions"); - return mDisabledLink || globally_disabled; + return globally_disabled; } static std::string getStringAfterToken(const std::string str, const std::string token) -- cgit v1.2.3 From abda07fb77de69b294eafb65cb1cfb265855365f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 16 Dec 2010 20:22:32 +0200 Subject: STORM-796 FIXED Implemented rendering /app/region/ SLapps into human-readable strings. Example: secondlife:///app/region/Ahern/10/20/30/ is displayed as "Ahern (10,20,30)". --- indra/llui/llurlentry.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'indra/llui/llurlentry.cpp') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index e51f28e2e9..4f7b4be526 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -805,6 +805,69 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const return ::getStringAfterToken(url, "://"); } +// +// LLUrlEntryRegion Describes secondlife:///app/region/REGION_NAME/X/Y/Z URLs, e.g. +// secondlife:///app/region/Ahern/128/128/0 +// +LLUrlEntryRegion::LLUrlEntryRegion() +{ + mPattern = boost::regex("secondlife:///app/region/[^/\\s]+(/\\d+)?(/\\d+)?(/\\d+)?/?", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_slurl.xml"; + mTooltip = LLTrans::getString("TooltipSLURL"); +} + +std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + // + // we handle SLURLs in the following formats: + // - secondlife:///app/region/Place/X/Y/Z + // - secondlife:///app/region/Place/X/Y + // - secondlife:///app/region/Place/X + // - secondlife:///app/region/Place + // + + LLSD path_array = LLURI(url).pathArray(); + S32 path_parts = path_array.size(); + + if (path_parts < 3) // no region name + { + llwarns << "Failed to parse url [" << url << "]" << llendl; + return url; + } + + std::string label = unescapeUrl(path_array[2]); // region name + + if (path_parts > 3) // secondlife:///app/region/Place/X + { + std::string x = path_array[3]; + label += " (" + x; + + if (path_parts > 4) // secondlife:///app/region/Place/X/Y + { + std::string y = path_array[4]; + label += "," + y; + + if (path_parts > 5) // secondlife:///app/region/Place/X/Y/Z + { + std::string z = path_array[5]; + label = label + "," + z; + } + } + + label += ")"; + } + + return label; +} + +std::string LLUrlEntryRegion::getLocation(const std::string &url) const +{ + LLSD path_array = LLURI(url).pathArray(); + std::string region_name = unescapeUrl(path_array[2]); + return region_name; +} + // // LLUrlEntryTeleport Describes a Second Life teleport Url, e.g., // secondlife:///app/teleport/Ahern/50/50/50/ -- cgit v1.2.3