diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-03-03 16:40:38 +0200 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-03-03 16:40:38 +0200 |
commit | f75f19be93417081f45438e3c2106bedf201fa8d (patch) | |
tree | 9a4d09bf1bee073508a9d3ddb4d6d38419a7eb18 /indra/llui | |
parent | 76587bc1d66491a302236bd6fdf1bbf09b73e68b (diff) |
Fixed bug EXT-4574 ([BSI] Unhelpful tooltip for Partner and Group links in Profile).
For wiki-style links ([<URL> <label>]) we now show the tooltip corresponding to the URL type.
--HG--
branch : product-engine
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/CMakeLists.txt | 10 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 16 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 3 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 2 |
4 files changed, 29 insertions, 2 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 853f6f173d..532b6b6524 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -209,6 +209,16 @@ set(llui_HEADER_FILES set_source_files_properties(${llui_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) +SET(llurlentry_TEST_DEPENDENCIES + llurlmatch.cpp + llurlregistry.cpp + ) + +set_source_files_properties(llurlentry.cpp + PROPERTIES LL_TEST_ADDITIONAL_SOURCE_FILES + "${llurlentry_TEST_DEPENDENCIES}" + ) + list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES}) add_library (llui ${llui_SOURCE_FILES}) diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 20c939874b..2d0a156654 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -34,6 +34,8 @@ #include "linden_common.h" #include "llurlentry.h" #include "lluri.h" +#include "llurlmatch.h" +#include "llurlregistry.h" #include "llcachename.h" #include "lltrans.h" @@ -602,6 +604,20 @@ std::string LLUrlEntrySLLabel::getUrl(const std::string &string) const return getUrlFromWikiLink(string); } +std::string LLUrlEntrySLLabel::getTooltip(const std::string &string) const +{ + // return a tooltip corresponding to the URL type instead of the generic one (EXT-4574) + std::string url = getUrl(string); + LLUrlMatch match; + if (LLUrlRegistry::instance().findUrl(url, match)) + { + return match.getTooltip(); + } + + // unrecognized URL? should not happen + return LLUrlEntryBase::getTooltip(string); +} + // // LLUrlEntryWorldMap Describes secondlife:///<location> URLs // diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 3abada0f24..c947ef7259 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -83,7 +83,7 @@ public: LLUIColor getColor() const { return mColor; } /// Given a matched Url, return a tooltip string for the hyperlink - std::string getTooltip() const { return mTooltip; } + virtual std::string getTooltip(const std::string &string) const { return mTooltip; } /// Return the name of a XUI file containing the context menu items std::string getMenuName() const { return mMenuName; } @@ -257,6 +257,7 @@ public: LLUrlEntrySLLabel(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ std::string getUrl(const std::string &string) const; + /*virtual*/ std::string getTooltip(const std::string &string) const; }; /// diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 722dbe41b3..faa02e1904 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -174,7 +174,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL match.setValues(match_start, match_end, match_entry->getUrl(url), match_entry->getLabel(url, cb), - match_entry->getTooltip(), + match_entry->getTooltip(url), match_entry->getIcon(), match_entry->getColor(), match_entry->getMenuName(), |