From f5b3fc596d029d3ac2f953ee94ea3ae131d00940 Mon Sep 17 00:00:00 2001
From: callum <none@none>
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 +++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

(limited to 'indra/llui')

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 <boost/regex.hpp>
 
+typedef std::map<std::string, LLControlGroup*> 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();
-- 
cgit v1.2.3