MAINT-6097 FIXED On required update, clicking link to release notes opens browser behind menu

master
andreykproductengine 2016-03-11 20:16:03 +02:00
parent debc51af6b
commit 230fc28d8a
9 changed files with 55 additions and 23 deletions

View File

@ -417,6 +417,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par
mExpireOption(p.expire_option), mExpireOption(p.expire_option),
mURLOption(p.url.option), mURLOption(p.url.option),
mURLTarget(p.url.target), mURLTarget(p.url.target),
mForceUrlsExternal(p.force_urls_external),
mUnique(p.unique.isProvided()), mUnique(p.unique.isProvided()),
mCombineBehavior(p.unique.combine), mCombineBehavior(p.unique.combine),
mPriority(p.priority), mPriority(p.priority),
@ -748,6 +749,11 @@ S32 LLNotification::getURLOpenExternally() const
return(mTemplatep? mTemplatep->mURLTarget == "_external": -1); return(mTemplatep? mTemplatep->mURLTarget == "_external": -1);
} }
bool LLNotification::getForceUrlsExternal() const
{
return (mTemplatep ? mTemplatep->mForceUrlsExternal : false);
}
bool LLNotification::hasUniquenessConstraints() const bool LLNotification::hasUniquenessConstraints() const
{ {
return (mTemplatep ? mTemplatep->mUnique : false); return (mTemplatep ? mTemplatep->mUnique : false);

View File

@ -553,7 +553,8 @@ public:
std::string getLabel() const; std::string getLabel() const;
std::string getURL() const; std::string getURL() const;
S32 getURLOption() const; S32 getURLOption() const;
S32 getURLOpenExternally() const; S32 getURLOpenExternally() const; //for url responce option
bool getForceUrlsExternal() const;
bool canLogToChat() const; bool canLogToChat() const;
bool canLogToIM() const; bool canLogToIM() const;
bool canShowToast() const; bool canShowToast() const;

View File

@ -177,7 +177,8 @@ struct LLNotificationTemplate
Optional<bool> persist, Optional<bool> persist,
log_to_im, log_to_im,
show_toast, show_toast,
log_to_chat; log_to_chat,
force_urls_external;
Optional<std::string> functor, Optional<std::string> functor,
icon, icon,
label, label,
@ -201,6 +202,7 @@ struct LLNotificationTemplate
log_to_im("log_to_im", false), log_to_im("log_to_im", false),
show_toast("show_toast", true), show_toast("show_toast", true),
log_to_chat("log_to_chat", true), log_to_chat("log_to_chat", true),
force_urls_external("force_urls_external", false),
functor("functor"), functor("functor"),
icon("icon"), icon("icon"),
label("label"), label("label"),
@ -284,11 +286,16 @@ struct LLNotificationTemplate
// that URL. Obsolete this and eliminate the buttons for affected // that URL. Obsolete this and eliminate the buttons for affected
// messages when we allow clickable URLs in the UI // messages when we allow clickable URLs in the UI
U32 mURLOption; U32 mURLOption;
std::string mURLTarget; //This is a flag that tells if option url needs to open externally dispite
//This is a flag that tells if the url needs to open externally dispite
//what the user setting is. //what the user setting is.
std::string mURLTarget;
// All links clicked inside notification will be opened in external browser
// Note: Some notifications block and exit viewer, yet they provide a link
// to click, we should be able to open such links in external browser.
bool mForceUrlsExternal;
// does this notification persist across sessions? if so, it will be // does this notification persist across sessions? if so, it will be
// serialized to disk on first receipt and read on startup // serialized to disk on first receipt and read on startup
bool mPersist; bool mPersist;

View File

@ -164,6 +164,7 @@ LLTextBase::Params::Params()
trusted_content("trusted_content", true), trusted_content("trusted_content", true),
use_ellipses("use_ellipses", false), use_ellipses("use_ellipses", false),
parse_urls("parse_urls", false), parse_urls("parse_urls", false),
force_urls_external("force_urls_external", false),
parse_highlights("parse_highlights", false) parse_highlights("parse_highlights", false)
{ {
addSynonym(track_end, "track_bottom"); addSynonym(track_end, "track_bottom");
@ -216,6 +217,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
mWordWrap(p.wrap), mWordWrap(p.wrap),
mUseEllipses( p.use_ellipses ), mUseEllipses( p.use_ellipses ),
mParseHTML(p.parse_urls), mParseHTML(p.parse_urls),
mForceUrlsExternal(p.force_urls_external),
mParseHighlights(p.parse_highlights), mParseHighlights(p.parse_highlights),
mBGVisible(p.bg_visible), mBGVisible(p.bg_visible),
mScroller(NULL), mScroller(NULL),
@ -1937,7 +1939,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
registrar.add("Url.Open", boost::bind(&LLUrlAction::openURL, url)); registrar.add("Url.Open", boost::bind(&LLUrlAction::openURL, url));
registrar.add("Url.OpenInternal", boost::bind(&LLUrlAction::openURLInternal, url)); registrar.add("Url.OpenInternal", boost::bind(&LLUrlAction::openURLInternal, url));
registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url)); registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url));
registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url)); registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url, true));
registrar.add("Url.Block", boost::bind(&LLUrlAction::blockObject, url)); registrar.add("Url.Block", boost::bind(&LLUrlAction::blockObject, url));
registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url));
registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url));
@ -3227,7 +3229,15 @@ BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask)
// Only process the click if it's actually in this segment, not to the right of the end-of-line. // Only process the click if it's actually in this segment, not to the right of the end-of-line.
if(mEditor.getSegmentAtLocalPos(x, y, false) == this) if(mEditor.getSegmentAtLocalPos(x, y, false) == this)
{ {
LLUrlAction::clickAction(getStyle()->getLinkHREF(), mEditor.isContentTrusted()); std::string url = getStyle()->getLinkHREF();
if (!mEditor.mForceUrlsExternal)
{
LLUrlAction::clickAction(url, mEditor.isContentTrusted());
}
else if (!LLUrlAction::executeSLURL(url, mEditor.isContentTrusted()))
{
LLUrlAction::openURLExternal(url);
}
return TRUE; return TRUE;
} }
} }

View File

@ -300,6 +300,7 @@ public:
wrap, wrap,
use_ellipses, use_ellipses,
parse_urls, parse_urls,
force_urls_external,
parse_highlights, parse_highlights,
clip, clip,
clip_partial, clip_partial,
@ -654,6 +655,7 @@ protected:
S32 mLineSpacingPixels; // padding between lines S32 mLineSpacingPixels; // padding between lines
bool mBorderVisible; bool mBorderVisible;
bool mParseHTML; // make URLs interactive bool mParseHTML; // make URLs interactive
bool mForceUrlsExternal; // URLs from this textbox will be opened in external browser
bool mParseHighlights; // highlight user-defined keywords bool mParseHighlights; // highlight user-defined keywords
bool mWordWrap; bool mWordWrap;
bool mUseEllipses; bool mUseEllipses;

View File

@ -83,12 +83,13 @@ void LLUrlAction::openURLExternal(std::string url)
} }
} }
void LLUrlAction::executeSLURL(std::string url) bool LLUrlAction::executeSLURL(std::string url, bool trusted_content)
{ {
if (sExecuteSLURLCallback) if (sExecuteSLURLCallback)
{ {
sExecuteSLURLCallback(url ,true); return sExecuteSLURLCallback(url, trusted_content);
} }
return false;
} }
void LLUrlAction::clickAction(std::string url, bool trusted_content) void LLUrlAction::clickAction(std::string url, bool trusted_content)

View File

@ -57,7 +57,7 @@ public:
static void openURLExternal(std::string url); static void openURLExternal(std::string url);
/// execute the given secondlife: SLURL /// execute the given secondlife: SLURL
static void executeSLURL(std::string url); static bool executeSLURL(std::string url, bool trusted_content = true);
/// if the Url specifies an SL location, teleport there /// if the Url specifies an SL location, teleport there
static void teleportToLocation(std::string url); static void teleportToLocation(std::string url);

View File

@ -181,6 +181,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
params.wrap(true); params.wrap(true);
params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
params.allow_scroll(true); params.allow_scroll(true);
params.force_urls_external(mNotification->getForceUrlsExternal());
LLTextBox * msg_box = LLUICtrlFactory::create<LLTextBox> (params); LLTextBox * msg_box = LLUICtrlFactory::create<LLTextBox> (params);
// Compute max allowable height for the dialog text, so we can allocate // Compute max allowable height for the dialog text, so we can allocate

View File

@ -3870,9 +3870,10 @@ We have downloaded an update to your [APP_NAME] installation.
</notification> </notification>
<notification <notification
icon="alertmodal.tga" icon="alertmodal.tga"
name="RequiredUpdateDownloadedVerboseDialog" name="RequiredUpdateDownloadedVerboseDialog"
type="alertmodal"> type="alertmodal"
force_urls_external="true">
We have downloaded a required software update. We have downloaded a required software update.
Version [VERSION] [[INFO_URL] Information about this update] Version [VERSION] [[INFO_URL] Information about this update]
@ -3884,9 +3885,10 @@ We must restart [APP_NAME] to install the update.
</notification> </notification>
<notification <notification
icon="alertmodal.tga" icon="alertmodal.tga"
name="RequiredUpdateDownloadedDialog" name="RequiredUpdateDownloadedDialog"
type="alertmodal"> type="alertmodal"
force_urls_external="true">
We must restart [APP_NAME] to install the update. We must restart [APP_NAME] to install the update.
[[INFO_URL] Information about this update] [[INFO_URL] Information about this update]
<tag>confirm</tag> <tag>confirm</tag>
@ -3926,9 +3928,10 @@ see [[INFO_URL] Information about this update]
</notification> </notification>
<notification <notification
icon="alertmodal.tga" icon="alertmodal.tga"
name="OtherChannelRequiredUpdateDownloadedVerboseDialog" name="OtherChannelRequiredUpdateDownloadedVerboseDialog"
type="alertmodal"> type="alertmodal"
force_urls_external="true">
We have downloaded a required software update. We have downloaded a required software update.
Version [VERSION] Version [VERSION]
This experimental viewer has been replaced by a [NEW_CHANNEL] viewer; This experimental viewer has been replaced by a [NEW_CHANNEL] viewer;
@ -3942,9 +3945,10 @@ We must restart [APP_NAME] to install the update.
</notification> </notification>
<notification <notification
icon="alertmodal.tga" icon="alertmodal.tga"
name="OtherChannelRequiredUpdateDownloadedDialog" name="OtherChannelRequiredUpdateDownloadedDialog"
type="alertmodal"> type="alertmodal"
force_urls_external="true">
We must restart [APP_NAME] to install the update. We must restart [APP_NAME] to install the update.
This experimental viewer has been replaced by a [NEW_CHANNEL] viewer; This experimental viewer has been replaced by a [NEW_CHANNEL] viewer;
see [[INFO_URL] Information about this update] see [[INFO_URL] Information about this update]