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
master
Vadim Savchuk 2010-03-03 16:40:38 +02:00
parent 76587bc1d6
commit f75f19be93
4 changed files with 29 additions and 2 deletions

View File

@ -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})

View File

@ -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
//

View File

@ -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;
};
///

View File

@ -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(),