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 ++++++++++ indra/llui/llurlentry.h | 2 +- indra/llui/tests/llurlentry_test.cpp | 9 +++++++++ indra/newview/app_settings/settings.xml | 11 +++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) 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); diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index e25eaa7555..623856c320 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -86,7 +86,7 @@ public: virtual std::string getLocation(const std::string &url) const { return ""; } /// is this a match for a URL that should not be hyperlinked? - bool isLinkDisabled() const { return mDisabledLink; } + bool isLinkDisabled() const; /// Should this link text be underlined only when mouse is hovered over it? virtual bool underlineOnHoverOnly(const std::string &string) const { return false; } diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 95affe4460..4c2b3a8d59 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -27,12 +27,21 @@ #include "linden_common.h" #include "../llurlentry.h" +#include "../lluictrl.h" #include "llurlentry_stub.cpp" #include "lltut.h" #include "../lluicolortable.h" #include +typedef std::map settings_map_t; +settings_map_t LLUI::sSettingGroups; + +BOOL LLControlGroup::getBOOL(const std::string& name) +{ + return false; +} + LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& default_color) const { return LLUIColor(); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 09f74e5508..345a1f3576 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2556,6 +2556,17 @@ Value 0 + DisableTextHyperlinkActions + + Comment + Disable highlighting and linking of URLs in XUI text boxes + Persist + 1 + Type + Boolean + Value + 0 + DisableVerticalSync Comment -- cgit v1.2.3