diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2016-05-10 16:09:25 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2016-05-10 16:09:25 +0300 |
commit | b1243c55e5579f72e3dd9dafe2b53173349a047f (patch) | |
tree | 9d9e0b018059483973a8e6f76644b0875d2534a3 /indra/llui | |
parent | 042930b59a82f706f16e4b67a683697aed65112f (diff) | |
parent | 7f5e6cea124e1193b199a3eabd50bdab96340c13 (diff) |
Merged in oz_linden/maint-5974
Diffstat (limited to 'indra/llui')
-rwxr-xr-x | indra/llui/CMakeLists.txt | 13 | ||||
-rwxr-xr-x | indra/llui/lliconctrl.cpp | 11 | ||||
-rwxr-xr-x | indra/llui/lliconctrl.h | 2 | ||||
-rwxr-xr-x | indra/llui/llnotifications.cpp | 6 | ||||
-rwxr-xr-x | indra/llui/llnotifications.h | 3 | ||||
-rwxr-xr-x | indra/llui/llnotificationtemplate.h | 17 | ||||
-rwxr-xr-x | indra/llui/llradiogroup.cpp | 12 | ||||
-rwxr-xr-x | indra/llui/lltextbase.cpp | 14 | ||||
-rwxr-xr-x | indra/llui/lltextbase.h | 2 | ||||
-rwxr-xr-x | indra/llui/lltexteditor.cpp | 17 | ||||
-rwxr-xr-x | indra/llui/llurlaction.cpp | 5 | ||||
-rwxr-xr-x | indra/llui/llurlaction.h | 2 | ||||
-rwxr-xr-x | indra/llui/llurlentry.cpp | 8 | ||||
-rwxr-xr-x | indra/llui/tests/llurlentry_stub.cpp | 2 | ||||
-rwxr-xr-x | indra/llui/tests/llurlentry_test.cpp | 22 |
15 files changed, 100 insertions, 36 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 52738aeb6f..7fb1db15fb 100755 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -8,13 +8,16 @@ include(LLImage) include(LLInventory) include(LLMath) include(LLMessage) +include(LLCoreHttp) include(LLRender) include(LLWindow) +include(LLCoreHttp) include(LLVFS) include(LLXML) include_directories( ${LLCOMMON_INCLUDE_DIRS} + ${LLCOREHTTP_INCLUDE_DIRS} ${LLIMAGE_INCLUDE_DIRS} ${LLINVENTORY_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} @@ -268,16 +271,18 @@ add_library (llui ${llui_SOURCE_FILES}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level target_link_libraries(llui - ${LLMESSAGE_LIBRARIES} ${LLRENDER_LIBRARIES} ${LLWINDOW_LIBRARIES} ${LLIMAGE_LIBRARIES} ${LLINVENTORY_LIBRARIES} + ${LLMESSAGE_LIBRARIES} + ${LLCOREHTTP_LIBRARIES} ${LLVFS_LIBRARIES} # ugh, just for LLDir ${LLXUIXML_LIBRARIES} ${LLXML_LIBRARIES} ${LLMATH_LIBRARIES} ${HUNSPELL_LIBRARY} + ${LLMESSAGE_LIBRARIES} ${LLCOMMON_LIBRARIES} # must be after llimage, llwindow, llrender ) @@ -289,6 +294,8 @@ if(LL_TESTS) ) LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") # INTEGRATION TESTS - set(test_libs llui llmessage llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) - LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}") + set(test_libs llui llmessage llcorehttp llcommon ${LLCOMMON_LIBRARIES} ${BOOST_COROUTINE_LIBRARY} ${BOOST_CONTEXT_LIBRARY} ${BOOST_SYSTEM_LIBRARY} ${WINDOWS_LIBRARIES}) + if(NOT LINUX) + LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}") + endif(NOT LINUX) endif(LL_TESTS) diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index f841901801..82b01e705d 100755 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -83,7 +83,12 @@ void LLIconCtrl::draw() // virtual // value might be a string or a UUID -void LLIconCtrl::setValue(const LLSD& value ) +void LLIconCtrl::setValue(const LLSD& value) +{ + setValue(value, mPriority); +} + +void LLIconCtrl::setValue(const LLSD& value, S32 priority) { LLSD tvalue(value); if (value.isString() && LLUUID::validate(value.asString())) @@ -94,11 +99,11 @@ void LLIconCtrl::setValue(const LLSD& value ) LLUICtrl::setValue(tvalue); if (tvalue.isUUID()) { - mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority); + mImagep = LLUI::getUIImageByID(tvalue.asUUID(), priority); } else { - mImagep = LLUI::getUIImage(tvalue.asString(), mPriority); + mImagep = LLUI::getUIImage(tvalue.asString(), priority); } if(mImagep.notNull() diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index 7971cd44d3..dd83e78fd3 100755 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -59,6 +59,8 @@ protected: LLIconCtrl(const Params&); friend class LLUICtrlFactory; + void setValue(const LLSD& value, S32 priority); + public: virtual ~LLIconCtrl(); diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 77e7d375c8..0cb959a315 100755 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -417,6 +417,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mExpireOption(p.expire_option), mURLOption(p.url.option), mURLTarget(p.url.target), + mForceUrlsExternal(p.force_urls_external), mUnique(p.unique.isProvided()), mCombineBehavior(p.unique.combine), mPriority(p.priority), @@ -748,6 +749,11 @@ S32 LLNotification::getURLOpenExternally() const return(mTemplatep? mTemplatep->mURLTarget == "_external": -1); } +bool LLNotification::getForceUrlsExternal() const +{ + return (mTemplatep ? mTemplatep->mForceUrlsExternal : false); +} + bool LLNotification::hasUniquenessConstraints() const { return (mTemplatep ? mTemplatep->mUnique : false); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 010e6caba2..354add0b82 100755 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -553,7 +553,8 @@ public: std::string getLabel() const; std::string getURL() const; S32 getURLOption() const; - S32 getURLOpenExternally() const; + S32 getURLOpenExternally() const; //for url responce option + bool getForceUrlsExternal() const; bool canLogToChat() const; bool canLogToIM() const; bool canShowToast() const; diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index c23fc53763..bed29254d8 100755 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -177,7 +177,8 @@ struct LLNotificationTemplate Optional<bool> persist, log_to_im, show_toast, - log_to_chat; + log_to_chat, + force_urls_external; Optional<std::string> functor, icon, label, @@ -201,6 +202,7 @@ struct LLNotificationTemplate log_to_im("log_to_im", false), show_toast("show_toast", true), log_to_chat("log_to_chat", true), + force_urls_external("force_urls_external", false), functor("functor"), icon("icon"), label("label"), @@ -284,11 +286,16 @@ struct LLNotificationTemplate // that URL. Obsolete this and eliminate the buttons for affected // messages when we allow clickable URLs in the UI U32 mURLOption; - - std::string mURLTarget; - //This is a flag that tells if the url needs to open externally dispite + + //This is a flag that tells if option url needs to open externally dispite //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 // serialized to disk on first receipt and read on startup bool mPersist; diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index b53bb16d97..8cf72928ff 100755 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -179,6 +179,18 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) return FALSE; } + if (index < -1) + { + // less then minimum value + return FALSE; + } + + if (index < 0 && mSelectedIndex >= 0 && !mAllowDeselect) + { + // -1 is "nothing selected" + return FALSE; + } + if (mSelectedIndex >= 0) { LLRadioCtrl* old_radio_item = mRadioButtons[mSelectedIndex]; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 4309e6557e..4ccf1ef009 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -164,6 +164,7 @@ LLTextBase::Params::Params() trusted_content("trusted_content", true), use_ellipses("use_ellipses", false), parse_urls("parse_urls", false), + force_urls_external("force_urls_external", false), parse_highlights("parse_highlights", false) { addSynonym(track_end, "track_bottom"); @@ -216,6 +217,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mWordWrap(p.wrap), mUseEllipses( p.use_ellipses ), mParseHTML(p.parse_urls), + mForceUrlsExternal(p.force_urls_external), mParseHighlights(p.parse_highlights), mBGVisible(p.bg_visible), 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.OpenInternal", boost::bind(&LLUrlAction::openURLInternal, 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.Teleport", boost::bind(&LLUrlAction::teleportToLocation, 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. 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; } } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index ac408bbe7a..7d87271b0e 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -300,6 +300,7 @@ public: wrap, use_ellipses, parse_urls, + force_urls_external, parse_highlights, clip, clip_partial, @@ -654,6 +655,7 @@ protected: S32 mLineSpacingPixels; // padding between lines bool mBorderVisible; bool mParseHTML; // make URLs interactive + bool mForceUrlsExternal; // URLs from this textbox will be opened in external browser bool mParseHighlights; // highlight user-defined keywords bool mWordWrap; bool mUseEllipses; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 926326aaff..3c86b539c4 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1716,7 +1716,20 @@ void LLTextEditor::unindentLineBeforeCloseBrace() LLWString text = getWText(); if( ' ' == text[ mCursorPos - 1 ] ) { - removeCharOrTab(); + S32 line = getLineNumFromDocIndex(mCursorPos, false); + S32 line_start = getLineStart(line); + + // Jump over spaces in the current line + while ((' ' == text[line_start]) && (line_start < mCursorPos)) + { + line_start++; + } + + // Make sure there is nothing but ' ' before the Brace we are unindenting + if (line_start == mCursorPos) + { + removeCharOrTab(); + } } } } @@ -1800,7 +1813,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) // Handle most keys only if the text editor is writeable. if( !mReadOnly ) { - if( '}' == uni_char ) + if( mAutoIndent && '}' == uni_char ) { unindentLineBeforeCloseBrace(); } diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index 12537d9dd1..027a3e3a64 100755 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -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) { - sExecuteSLURLCallback(url ,true); + return sExecuteSLURLCallback(url, trusted_content); } + return false; } void LLUrlAction::clickAction(std::string url, bool trusted_content) diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index 5f3626490c..5497e28bb4 100755 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -57,7 +57,7 @@ public: static void openURLExternal(std::string url); /// 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 static void teleportToLocation(std::string url); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 57de35dfde..e4848362a7 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -920,7 +920,7 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const // LLUrlEntryParcel statics. LLUUID LLUrlEntryParcel::sAgentID(LLUUID::null); LLUUID LLUrlEntryParcel::sSessionID(LLUUID::null); -LLHost LLUrlEntryParcel::sRegionHost(LLHost::invalid); +LLHost LLUrlEntryParcel::sRegionHost; bool LLUrlEntryParcel::sDisconnected(false); std::set<LLUrlEntryParcel*> LLUrlEntryParcel::sParcelInfoObservers; @@ -969,7 +969,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC void LLUrlEntryParcel::sendParcelInfoRequest(const LLUUID& parcel_id) { - if (sRegionHost == LLHost::invalid || sDisconnected) return; + if (sRegionHost.isInvalid() || sDisconnected) return; LLMessageSystem *msg = gMessageSystem; msg->newMessage("ParcelInfoRequest"); @@ -1427,7 +1427,7 @@ std::string LLUrlEntryExperienceProfile::getLabel( const std::string &url, const return LLTrans::getString("ExperienceNameNull"); } - const LLSD& experience_details = LLExperienceCache::get(experience_id); + const LLSD& experience_details = LLExperienceCache::instance().get(experience_id); if(!experience_details.isUndefined()) { std::string experience_name_string = experience_details[LLExperienceCache::NAME].asString(); @@ -1435,7 +1435,7 @@ std::string LLUrlEntryExperienceProfile::getLabel( const std::string &url, const } addObserver(experience_id_string, url, cb); - LLExperienceCache::get(experience_id, boost::bind(&LLUrlEntryExperienceProfile::onExperienceDetails, this, _1)); + LLExperienceCache::instance().get(experience_id, boost::bind(&LLUrlEntryExperienceProfile::onExperienceDetails, this, _1)); return LLTrans::getString("LoadingData"); } diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 5d3f9ac327..f01178c374 100755 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -165,8 +165,6 @@ LLFontGL* LLFontGL::getFontDefault() char const* const _PREHASH_AgentData = (char *)"AgentData"; char const* const _PREHASH_AgentID = (char *)"AgentID"; -LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS); - LLMessageSystem* gMessageSystem = NULL; // diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index d41930a492..233fb6da23 100755 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -37,17 +37,17 @@ #include <boost/regex.hpp> -namespace LLExperienceCache -{ - const LLSD& get( const LLUUID& key) - { - static LLSD boo; - return boo; - } - - void get( const LLUUID& key, callback_slot_t slot ){} - -} +// namespace LLExperienceCache +// { +// const LLSD& get( const LLUUID& key) +// { +// static LLSD boo; +// return boo; +// } +// +// void get( const LLUUID& key, callback_slot_t slot ){} +// +// } typedef std::map<std::string, LLControlGroup*> settings_map_t; settings_map_t LLUI::sSettingGroups; |