From 68d27467610610f8067a74fdecdfad595e6662b4 Mon Sep 17 00:00:00 2001 From: callum Date: Fri, 5 Nov 2010 16:53:10 -0700 Subject: EXP-417 FIX Tab keys in embedded Web form moves focus out of Web page back to container XUI Reviewed by Richard. --- indra/newview/llmediactrl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index e84c9152b1..5e27004ed8 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -432,13 +432,15 @@ BOOL LLMediaCtrl::postBuild () // BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) { - if (LLPanel::handleKeyHere(key, mask)) return TRUE; BOOL result = FALSE; if (mMediaSource) { result = mMediaSource->handleKeyHere(key, mask); } + + if ( ! result ) + result = LLPanel::handleKeyHere(key, mask); return result; } @@ -458,7 +460,6 @@ void LLMediaCtrl::handleVisibilityChange ( BOOL new_visibility ) // BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char) { - if (LLPanel::handleUnicodeCharHere(uni_char)) return TRUE; BOOL result = FALSE; if (mMediaSource) @@ -466,6 +467,9 @@ BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char) result = mMediaSource->handleUnicodeCharHere(uni_char); } + if ( ! result ) + result = LLPanel::handleUnicodeCharHere(uni_char); + return result; } -- cgit v1.2.3 From df8b87435f7443caed5779ef36875004bcfab425 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 16 Nov 2010 17:01:44 -0800 Subject: SOCIAL-266 WIP HTTP AUTH dialogs no longer work in LLQtWebKit 4.7.1 Added support to the webkit media plugin and llpluginclassmedia for passing through the auth request/response. We still need an updated build of llqtwebkit for all platforms, as well as some UI work in the viewer to actually display the auth dialog. --- indra/newview/llmediactrl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 5e27004ed8..0a5263d1ab 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1092,6 +1092,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL; } break; + + case MEDIA_EVENT_AUTH_REQUEST: + { + LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() << ", realm " << self->getAuthRealm() << LL_ENDL; + } + break; }; // chain all events to any potential observers of this object. -- cgit v1.2.3 From a927b1cb0e0454cacf9523d2be7f2ce4b19c9e04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 18 Nov 2010 22:34:54 -0800 Subject: SOCIAL-266 WIP HTTP AUTH dialogs no longer work in LLQtWebKit 4.7.1 initial support for XUI auth dialog --- indra/newview/llmediactrl.cpp | 63 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 13 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 0a5263d1ab..edfc039036 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -54,6 +54,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llnotifications.h" +#include "lllineeditor.h" extern BOOL gRestoreGL; @@ -69,7 +70,6 @@ LLMediaCtrl::Params::Params() texture_height("texture_height", 1024), caret_color("caret_color"), initial_mime_type("initial_mime_type"), - media_id("media_id"), trusted_content("trusted_content", false) { tab_stop(false); @@ -126,7 +126,7 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : setTextureSize(screen_width, screen_height); } - mMediaTextureID.generate(); + mMediaTextureID = getKey(); // We don't need to create the media source up front anymore unless we have a non-empty home URL to navigate to. if(!mHomePageUrl.empty()) @@ -140,8 +140,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : // addChild( mBorder ); } -//////////////////////////////////////////////////////////////////////////////// -// note: this is now a singleton and destruction happens via initClass() now LLMediaCtrl::~LLMediaCtrl() { @@ -1037,7 +1035,7 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) LLNotification::Params notify_params; notify_params.name = "PopupAttempt"; - notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", getKey()); + notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID); notify_params.functor.function = boost::bind(&LLMediaCtrl::onPopup, this, _1, _2); if (mTrusted) @@ -1095,8 +1093,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) case MEDIA_EVENT_AUTH_REQUEST: { - LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() << ", realm " << self->getAuthRealm() << LL_ENDL; - } + LLNotification::Params auth_request_params; + auth_request_params.name = "AuthRequest"; + auth_request_params.payload = LLSD().with("media_id", mMediaTextureID); + auth_request_params.functor.function = boost::bind(&LLMediaCtrl::onAuthSubmit, this, _1, _2); + LLNotifications::instance().add(auth_request_params); + }; break; }; @@ -1122,9 +1124,21 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) // Make sure the opening instance knows its window open request was denied, so it can clean things up. LLViewerMedia::proxyWindowClosed(notification["payload"]["uuid"]); } +} +void LLMediaCtrl::onAuthSubmit(const LLSD& notification, const LLSD& response) +{ + if (response["ok"]) + { + mMediaSource->getMediaPlugin()->sendAuthResponse(true, response["username"], response["password"]); + } + else + { + mMediaSource->getMediaPlugin()->sendAuthResponse(false, "", ""); + } } + void LLMediaCtrl::onCloseNotification() { LLNotifications::instance().cancel(mCurNotification); @@ -1145,15 +1159,20 @@ void LLMediaCtrl::onClickNotificationButton(const std::string& name) { if (!mCurNotification) return; - LLSD response = mCurNotification->getResponseTemplate(); - response[name] = true; + mCurNotificationResponse[name] = true; - mCurNotification->respond(response); + mCurNotification->respond(mCurNotificationResponse); +} + +void LLMediaCtrl::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) +{ + mCurNotificationResponse[name] = ctrl->getValue().asString(); } void LLMediaCtrl::showNotification(LLNotificationPtr notify) { mCurNotification = notify; + mCurNotificationResponse = notify->getResponseTemplate(); // add popup here LLSD payload = notify->getPayload(); @@ -1206,12 +1225,30 @@ void LLMediaCtrl::showNotification(LLNotificationPtr notify) cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL; } + else if (form_element["type"].asString() == "text") + { + LLTextBox::Params label_p; + label_p.name = form_element["name"].asString() + "_label"; + label_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); + label_p.initial_value = form_element["text"]; + LLTextBox* textbox = LLUICtrlFactory::create(label_p); + textbox->reshapeToFitText(); + form_elements.addChild(textbox); + cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL; + + LLLineEditor::Params line_p; + line_p.name = form_element["name"]; + line_p.commit_callback.function = boost::bind(&LLMediaCtrl::onEnterNotificationText, this, _1, form_element["name"].asString()); + line_p.commit_on_focus_lost = true; + line_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); + + LLLineEditor* line_editor = LLUICtrlFactory::create(line_p); + form_elements.addChild(line_editor); + cur_x = line_editor->getRect().mRight + FORM_PADDING_HORIZONTAL; + } } - form_elements.reshape(cur_x, form_elements.getRect().getHeight()); - - //LLWeb::loadURL(payload["url"], payload["target"]); } void LLMediaCtrl::hideNotification() -- cgit v1.2.3 From ecd8290b3fa7484bb0587c49e8c9b01afcc48c0d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 19 Nov 2010 19:18:17 -0800 Subject: SOCIAL-266 WIP HTTP AUTH dialogs no longer work in LLQtWebKit 4.7.1 factored out llwindowshade control for slide-in notifications --- indra/newview/llmediactrl.cpp | 462 ++++++++++++++++++++++++------------------ 1 file changed, 269 insertions(+), 193 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index edfc039036..cdbcee2668 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -60,6 +60,257 @@ extern BOOL gRestoreGL; static LLDefaultChildRegistry::Register r("web_browser"); +class LLWindowShade : public LLView +{ +public: + struct Params : public LLInitParam::Block + { + Mandatory notification; + Optional bg_image; + + Params() + : bg_image("bg_image") + {} + }; + + void show(); + /*virtual*/ void draw(); + void hide(); + +private: + friend class LLUICtrlFactory; + + LLWindowShade(const Params& p); + void initFromParams(const Params& params); + + void onCloseNotification(); + void onClickNotificationButton(const std::string& name); + void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); + void onClickIgnore(LLUICtrl* ctrl); + + LLNotificationPtr mNotification; + LLSD mNotificationResponse; +}; + +LLWindowShade::LLWindowShade(const LLWindowShade::Params& params) +: LLView(params), + mNotification(params.notification) +{ +} + +void LLWindowShade::initFromParams(const LLWindowShade::Params& params) +{ + LLView::initFromParams(params); + + LLLayoutStack::Params layout_p; + layout_p.name = "notification_stack"; + layout_p.rect = LLRect(0,getLocalRect().mTop,getLocalRect().mRight, 30); + layout_p.follows.flags = FOLLOWS_ALL; + layout_p.mouse_opaque = false; + layout_p.orientation = "vertical"; + + LLLayoutStack* stackp = LLUICtrlFactory::create(layout_p); + addChild(stackp); + + LLLayoutPanel::Params panel_p; + panel_p.rect = LLRect(0, 30, 800, 0); + panel_p.min_height = 30; + panel_p.name = "notification_area"; + panel_p.visible = false; + panel_p.user_resize = false; + panel_p.background_visible = true; + panel_p.bg_alpha_image = params.bg_image; + panel_p.auto_resize = false; + LLLayoutPanel* notification_panel = LLUICtrlFactory::create(panel_p); + stackp->addChild(notification_panel); + + panel_p = LLUICtrlFactory::getDefaultParams(); + panel_p.auto_resize = true; + panel_p.mouse_opaque = false; + LLLayoutPanel* dummy_panel = LLUICtrlFactory::create(panel_p); + stackp->addChild(dummy_panel); + + layout_p = LLUICtrlFactory::getDefaultParams(); + layout_p.rect = LLRect(0, 30, 800, 0); + layout_p.follows.flags = FOLLOWS_ALL; + layout_p.orientation = "horizontal"; + stackp = LLUICtrlFactory::create(layout_p); + notification_panel->addChild(stackp); + + panel_p = LLUICtrlFactory::getDefaultParams(); + panel_p.rect.height = 30; + LLLayoutPanel* panel = LLUICtrlFactory::create(panel_p); + stackp->addChild(panel); + + LLIconCtrl::Params icon_p; + icon_p.name = "notification_icon"; + icon_p.rect = LLRect(5, 23, 21, 8); + panel->addChild(LLUICtrlFactory::create(icon_p)); + + LLTextBox::Params text_p; + text_p.rect = LLRect(31, 20, 430, 0); + text_p.text_color = LLColor4::black; + text_p.font = LLFontGL::getFontSansSerif(); + text_p.font.style = "BOLD"; + text_p.name = "notification_text"; + text_p.use_ellipses = true; + panel->addChild(LLUICtrlFactory::create(text_p)); + + panel_p = LLUICtrlFactory::getDefaultParams(); + panel_p.auto_resize = false; + panel_p.user_resize = false; + panel_p.name="form_elements"; + panel_p.rect = LLRect(0, 30, 130, 0); + LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create(panel_p); + stackp->addChild(form_elements_panel); + + panel_p = LLUICtrlFactory::getDefaultParams(); + panel_p.auto_resize = false; + panel_p.user_resize = false; + panel_p.rect = LLRect(0, 30, 25, 0); + LLLayoutPanel* close_panel = LLUICtrlFactory::create(panel_p); + stackp->addChild(close_panel); + + LLButton::Params button_p; + button_p.name = "close_notification"; + button_p.rect = LLRect(5, 23, 21, 7); + button_p.image_color=LLUIColorTable::instance().getColor("DkGray_66"); + button_p.image_unselected.name="Icon_Close_Foreground"; + button_p.image_selected.name="Icon_Close_Press"; + button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this); + + close_panel->addChild(LLUICtrlFactory::create(button_p)); + + LLSD payload = mNotification->getPayload(); + + LLNotificationFormPtr formp = mNotification->getForm(); + LLLayoutPanel& notification_area = getChildRef("notification_area"); + notification_area.getChild("notification_icon")->setValue(mNotification->getIcon()); + notification_area.getChild("notification_text")->setValue(mNotification->getMessage()); + notification_area.getChild("notification_text")->setToolTip(mNotification->getMessage()); + LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); + LLLayoutPanel& form_elements = notification_area.getChildRef("form_elements"); + form_elements.deleteAllChildren(); + + const S32 FORM_PADDING_HORIZONTAL = 10; + const S32 FORM_PADDING_VERTICAL = 3; + S32 cur_x = FORM_PADDING_HORIZONTAL; + + if (ignore_type != LLNotificationForm::IGNORE_NO) + { + LLCheckBoxCtrl::Params checkbox_p; + checkbox_p.name = "ignore_check"; + checkbox_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); + checkbox_p.label = formp->getIgnoreMessage(); + checkbox_p.label_text.text_color = LLColor4::black; + checkbox_p.commit_callback.function = boost::bind(&LLWindowShade::onClickIgnore, this, _1); + checkbox_p.initial_value = formp->getIgnored(); + + LLCheckBoxCtrl* check = LLUICtrlFactory::create(checkbox_p); + check->setRect(check->getBoundingRect()); + form_elements.addChild(check); + cur_x = check->getRect().mRight + FORM_PADDING_HORIZONTAL; + } + + for (S32 i = 0; i < formp->getNumElements(); i++) + { + LLSD form_element = formp->getElement(i); + std::string type = form_element["type"].asString(); + if (type == "button") + { + LLButton::Params button_p; + button_p.name = form_element["name"]; + button_p.label = form_element["text"]; + button_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); + button_p.click_callback.function = boost::bind(&LLWindowShade::onClickNotificationButton, this, form_element["name"].asString()); + button_p.auto_resize = true; + + LLButton* button = LLUICtrlFactory::create(button_p); + button->autoResize(); + form_elements.addChild(button); + + cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL; + } + else if (type == "text" || type == "password") + { + LLTextBox::Params label_p; + label_p.name = form_element["name"].asString() + "_label"; + label_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); + label_p.initial_value = form_element["text"]; + label_p.text_color = LLColor4::black; + LLTextBox* textbox = LLUICtrlFactory::create(label_p); + textbox->reshapeToFitText(); + form_elements.addChild(textbox); + cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL; + + LLLineEditor::Params line_p; + line_p.name = form_element["name"]; + line_p.commit_callback.function = boost::bind(&LLWindowShade::onEnterNotificationText, this, _1, form_element["name"].asString()); + line_p.commit_on_focus_lost = true; + line_p.is_password = type == "password"; + line_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); + + LLLineEditor* line_editor = LLUICtrlFactory::create(line_p); + form_elements.addChild(line_editor); + cur_x = line_editor->getRect().mRight + FORM_PADDING_HORIZONTAL; + } + } + + form_elements.reshape(cur_x, form_elements.getRect().getHeight()); +} + +void LLWindowShade::show() +{ + LLLayoutPanel& panel = getChildRef("notification_area"); + panel.setVisible(true); +} + +void LLWindowShade::draw() +{ + LLView::draw(); + if (mNotification && !mNotification->isActive()) + { + hide(); + } +} + +void LLWindowShade::hide() +{ + LLLayoutPanel& panel = getChildRef("notification_area"); + panel.setVisible(false); +} + +void LLWindowShade::onCloseNotification() +{ + LLNotifications::instance().cancel(mNotification); +} + +void LLWindowShade::onClickIgnore(LLUICtrl* ctrl) +{ + bool check = ctrl->getValue().asBoolean(); + if (mNotification && mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) + { + // question was "show again" so invert value to get "ignore" + check = !check; + } + mNotification->setIgnored(check); +} + +void LLWindowShade::onClickNotificationButton(const std::string& name) +{ + if (!mNotification) return; + + mNotificationResponse[name] = true; + + mNotification->respond(mNotificationResponse); +} + +void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) +{ + mNotificationResponse[name] = ctrl->getValue().asString(); +} + + LLMediaCtrl::Params::Params() : start_url("start_url"), border_visible("border_visible", true), @@ -97,7 +348,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mTextureHeight ( 1024 ), mClearCache(false), mHomePageMimeType(p.initial_mime_type), - mTrusted(p.trusted_content) + mTrusted(p.trusted_content), + mWindowShade(NULL) { { LLColor4 color = p.caret_color().get(); @@ -343,85 +595,6 @@ void LLMediaCtrl::onFocusLost() // BOOL LLMediaCtrl::postBuild () { - LLLayoutStack::Params layout_p; - layout_p.name = "notification_stack"; - layout_p.rect = LLRect(0,getLocalRect().mTop,getLocalRect().mRight, 30); - layout_p.follows.flags = FOLLOWS_ALL; - layout_p.mouse_opaque = false; - layout_p.orientation = "vertical"; - - LLLayoutStack* stackp = LLUICtrlFactory::create(layout_p); - addChild(stackp); - - LLLayoutPanel::Params panel_p; - panel_p.rect = LLRect(0, 30, 800, 0); - panel_p.min_height = 30; - panel_p.name = "notification_area"; - panel_p.visible = false; - panel_p.user_resize = false; - panel_p.background_visible = true; - panel_p.bg_alpha_image.name = "Yellow_Gradient"; - panel_p.auto_resize = false; - LLLayoutPanel* notification_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(notification_panel); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = true; - panel_p.mouse_opaque = false; - LLLayoutPanel* dummy_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(dummy_panel); - - layout_p = LLUICtrlFactory::getDefaultParams(); - layout_p.rect = LLRect(0, 30, 800, 0); - layout_p.follows.flags = FOLLOWS_ALL; - layout_p.orientation = "horizontal"; - stackp = LLUICtrlFactory::create(layout_p); - notification_panel->addChild(stackp); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.rect.height = 30; - LLLayoutPanel* panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(panel); - - LLIconCtrl::Params icon_p; - icon_p.name = "notification_icon"; - icon_p.rect = LLRect(5, 23, 21, 8); - panel->addChild(LLUICtrlFactory::create(icon_p)); - - LLTextBox::Params text_p; - text_p.rect = LLRect(31, 20, 430, 0); - text_p.text_color = LLColor4::black; - text_p.font = LLFontGL::getFontSansSerif(); - text_p.font.style = "BOLD"; - text_p.name = "notification_text"; - text_p.use_ellipses = true; - panel->addChild(LLUICtrlFactory::create(text_p)); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = false; - panel_p.user_resize = false; - panel_p.name="form_elements"; - panel_p.rect = LLRect(0, 30, 130, 0); - LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(form_elements_panel); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = false; - panel_p.user_resize = false; - panel_p.rect = LLRect(0, 30, 25, 0); - LLLayoutPanel* close_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(close_panel); - - LLButton::Params button_p; - button_p.name = "close_notification"; - button_p.rect = LLRect(5, 23, 21, 7); - button_p.image_color=LLUIColorTable::instance().getColor("DkGray_66"); - button_p.image_unselected.name="Icon_Close_Foreground"; - button_p.image_selected.name="Icon_Close_Press"; - button_p.click_callback.function = boost::bind(&LLMediaCtrl::onCloseNotification, this); - - close_panel->addChild(LLUICtrlFactory::create(button_p)); - setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); return TRUE; } @@ -923,11 +1096,6 @@ void LLMediaCtrl::draw() if ( mBorder && mBorder->getVisible() ) mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus( this ) ); - if (mCurNotification && !mCurNotification->isActive()) - { - hideNotification(); - } - LLPanel::draw(); // Restore the previous values @@ -1139,122 +1307,30 @@ void LLMediaCtrl::onAuthSubmit(const LLSD& notification, const LLSD& response) } -void LLMediaCtrl::onCloseNotification() -{ - LLNotifications::instance().cancel(mCurNotification); -} - -void LLMediaCtrl::onClickIgnore(LLUICtrl* ctrl) -{ - bool check = ctrl->getValue().asBoolean(); - if (mCurNotification && mCurNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) - { - // question was "show again" so invert value to get "ignore" - check = !check; - } - mCurNotification->setIgnored(check); -} - -void LLMediaCtrl::onClickNotificationButton(const std::string& name) -{ - if (!mCurNotification) return; - - mCurNotificationResponse[name] = true; - - mCurNotification->respond(mCurNotificationResponse); -} - -void LLMediaCtrl::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) -{ - mCurNotificationResponse[name] = ctrl->getValue().asString(); -} - void LLMediaCtrl::showNotification(LLNotificationPtr notify) { - mCurNotification = notify; - mCurNotificationResponse = notify->getResponseTemplate(); - - // add popup here - LLSD payload = notify->getPayload(); - - LLNotificationFormPtr formp = notify->getForm(); - LLLayoutPanel& panel = getChildRef("notification_area"); - panel.setVisible(true); - panel.getChild("notification_icon")->setValue(notify->getIcon()); - panel.getChild("notification_text")->setValue(notify->getMessage()); - panel.getChild("notification_text")->setToolTip(notify->getMessage()); - LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); - LLLayoutPanel& form_elements = panel.getChildRef("form_elements"); - form_elements.deleteAllChildren(); - - const S32 FORM_PADDING_HORIZONTAL = 10; - const S32 FORM_PADDING_VERTICAL = 3; - S32 cur_x = FORM_PADDING_HORIZONTAL; - - if (ignore_type != LLNotificationForm::IGNORE_NO) + delete mWindowShade; + + LLWindowShade::Params params; + params.rect = getLocalRect(); + params.follows.flags = FOLLOWS_ALL; + params.notification = notify; + //HACK: don't hardcode this + if (notify->getName() == "PopupAttempt") { - LLCheckBoxCtrl::Params checkbox_p; - checkbox_p.name = "ignore_check"; - checkbox_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); - checkbox_p.label = formp->getIgnoreMessage(); - checkbox_p.label_text.text_color = LLColor4::black; - checkbox_p.commit_callback.function = boost::bind(&LLMediaCtrl::onClickIgnore, this, _1); - checkbox_p.initial_value = formp->getIgnored(); - - LLCheckBoxCtrl* check = LLUICtrlFactory::create(checkbox_p); - check->setRect(check->getBoundingRect()); - form_elements.addChild(check); - cur_x = check->getRect().mRight + FORM_PADDING_HORIZONTAL; + params.bg_image.name = "Yellow_Gradient"; } - for (S32 i = 0; i < formp->getNumElements(); i++) - { - LLSD form_element = formp->getElement(i); - if (form_element["type"].asString() == "button") - { - LLButton::Params button_p; - button_p.name = form_element["name"]; - button_p.label = form_element["text"]; - button_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); - button_p.click_callback.function = boost::bind(&LLMediaCtrl::onClickNotificationButton, this, form_element["name"].asString()); - button_p.auto_resize = true; - - LLButton* button = LLUICtrlFactory::create(button_p); - button->autoResize(); - form_elements.addChild(button); + mWindowShade = LLUICtrlFactory::create(params); - cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - else if (form_element["type"].asString() == "text") - { - LLTextBox::Params label_p; - label_p.name = form_element["name"].asString() + "_label"; - label_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); - label_p.initial_value = form_element["text"]; - LLTextBox* textbox = LLUICtrlFactory::create(label_p); - textbox->reshapeToFitText(); - form_elements.addChild(textbox); - cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL; - - LLLineEditor::Params line_p; - line_p.name = form_element["name"]; - line_p.commit_callback.function = boost::bind(&LLMediaCtrl::onEnterNotificationText, this, _1, form_element["name"].asString()); - line_p.commit_on_focus_lost = true; - line_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); - - LLLineEditor* line_editor = LLUICtrlFactory::create(line_p); - form_elements.addChild(line_editor); - cur_x = line_editor->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - } - - form_elements.reshape(cur_x, form_elements.getRect().getHeight()); + addChild(mWindowShade); + mWindowShade->show(); } void LLMediaCtrl::hideNotification() { - LLLayoutPanel& panel = getChildRef("notification_area"); - panel.setVisible(FALSE); - - mCurNotification.reset(); + if (mWindowShade) + { + mWindowShade->hide(); + } } -- cgit v1.2.3 From ab34a6328026e61db5758f246773e29d5bf6d506 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 22 Nov 2010 17:51:48 -0800 Subject: SOCIAL-266 WIP HTTP AUTH dialogs no longer work in LLQtWebKit 4.7.1 llwindowshade no longer blocks mouse events --- indra/newview/llmediactrl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index cdbcee2668..6595ee2bcc 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -70,7 +70,9 @@ public: Params() : bg_image("bg_image") - {} + { + mouse_opaque = false; + } }; void show(); -- cgit v1.2.3 From f8d08af9f1e810c977626e4131baf771d2b3655c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 23 Nov 2010 16:25:10 -0800 Subject: SOCIAL-266 WIP HTTP AUTH dialogs no longer work in LLQtWebKit 4.7.1 converted LLLayoutStack orientation param to use named enums --- indra/newview/llmediactrl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 6595ee2bcc..54c7d361b7 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -109,7 +109,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) layout_p.rect = LLRect(0,getLocalRect().mTop,getLocalRect().mRight, 30); layout_p.follows.flags = FOLLOWS_ALL; layout_p.mouse_opaque = false; - layout_p.orientation = "vertical"; + layout_p.orientation = LLLayoutStack::VERTICAL; LLLayoutStack* stackp = LLUICtrlFactory::create(layout_p); addChild(stackp); @@ -135,7 +135,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) layout_p = LLUICtrlFactory::getDefaultParams(); layout_p.rect = LLRect(0, 30, 800, 0); layout_p.follows.flags = FOLLOWS_ALL; - layout_p.orientation = "horizontal"; + layout_p.orientation = LLLayoutStack::HORIZONTAL; stackp = LLUICtrlFactory::create(layout_p); notification_panel->addChild(stackp); -- cgit v1.2.3 From 880110eb9303ecb4426e6d3598075c4c12280061 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 1 Dec 2010 18:15:59 -0800 Subject: OCIAL-231 FIX Enable tooltips (for links and images) Added the necessary plumbing to get link_hovered events from the webkit plugin through to the viewer UI. This requires a llqtwebkit library built from revision 1799a899e06d or later in http://hg.secondlife.com/llqtwebkit to function. The viewer source changes are backwards-compatible with earlier versions of llqtwebkit, it just won't see any link_hovered events with previous revisions. Reviewed by Callum. --- indra/newview/llmediactrl.cpp | 48 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 54c7d361b7..08d07f9540 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -25,7 +25,7 @@ */ #include "llviewerprecompiledheaders.h" - +#include "lltooltip.h" #include "llmediactrl.h" @@ -351,7 +351,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mClearCache(false), mHomePageMimeType(p.initial_mime_type), mTrusted(p.trusted_content), - mWindowShade(NULL) + mWindowShade(NULL), + mHoverTextChanged(false) { { LLColor4 color = p.caret_color().get(); @@ -433,6 +434,13 @@ BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) mMediaSource->mouseMove(x, y, mask); gViewerWindow->setCursor(mMediaSource->getLastSetCursor()); } + + // TODO: Is this the right way to handle hover text changes driven by the plugin? + if(mHoverTextChanged) + { + mHoverTextChanged = false; + handleToolTip(x, y, mask); + } return TRUE; } @@ -448,6 +456,35 @@ BOOL LLMediaCtrl::handleScrollWheel( S32 x, S32 y, S32 clicks ) return TRUE; } +//////////////////////////////////////////////////////////////////////////////// +// virtual +BOOL LLMediaCtrl::handleToolTip(S32 x, S32 y, MASK mask) +{ + std::string hover_text; + + if (mMediaSource && mMediaSource->hasMedia()) + hover_text = mMediaSource->getMediaPlugin()->getHoverText(); + + if(hover_text.empty()) + { + return FALSE; + } + else + { + S32 screen_x, screen_y; + + localPointToScreen(x, y, &screen_x, &screen_y); + LLRect sticky_rect_screen; + sticky_rect_screen.setCenterAndSize(screen_x, screen_y, 20, 20); + + LLToolTipMgr::instance().show(LLToolTip::Params() + .message(hover_text) + .sticky_rect(sticky_rect_screen)); + } + + return TRUE; +} + //////////////////////////////////////////////////////////////////////////////// // BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask ) @@ -1270,6 +1307,13 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) LLNotifications::instance().add(auth_request_params); }; break; + + case MEDIA_EVENT_LINK_HOVERED: + { + LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LINK_HOVERED, hover text is: " << self->getHoverText() << LL_ENDL; + mHoverTextChanged = true; + }; + break; }; // chain all events to any potential observers of this object. -- cgit v1.2.3 From 84a50386be1ef34100e153666389ffacf03e8e8b Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 2 Dec 2010 18:46:26 -0800 Subject: SOCIAL-317 FIX LLWebContentFloater opens popups in the media browser --- indra/newview/llmediactrl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 08d07f9540..eaa2a60938 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -55,6 +55,8 @@ #include "llcheckboxctrl.h" #include "llnotifications.h" #include "lllineeditor.h" +#include "llfloatermediabrowser.h" +#include "llfloaterwebcontent.h" extern BOOL gRestoreGL; @@ -1331,7 +1333,16 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) { if (response["open"]) { - LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); + std::string floater_name = gFloaterView->getParentFloater(this)->getInstanceName(); + if ( floater_name == "media_browser" ) + { + LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); + } + else + if ( floater_name == "web_content" ) + { + LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); + } } else { -- cgit v1.2.3 From 8044661bd581fd7b6a25bd04d4c4f7e32e421faf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 10 Dec 2010 10:11:03 -0800 Subject: WIP XUI HTTP Auth dialog refactored LLWindowShade into seperate file improved layout of dialog improved dialog resizing logic Tab and Enter keys now work as expected in windowshade form added "modal" capability to window shade added HTTP Auth notifications to MOAP --- indra/newview/llmediactrl.cpp | 280 ++---------------------------------------- 1 file changed, 12 insertions(+), 268 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index eaa2a60938..6ae95a9039 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -57,264 +57,12 @@ #include "lllineeditor.h" #include "llfloatermediabrowser.h" #include "llfloaterwebcontent.h" +#include "llwindowshade.h" extern BOOL gRestoreGL; static LLDefaultChildRegistry::Register r("web_browser"); -class LLWindowShade : public LLView -{ -public: - struct Params : public LLInitParam::Block - { - Mandatory notification; - Optional bg_image; - - Params() - : bg_image("bg_image") - { - mouse_opaque = false; - } - }; - - void show(); - /*virtual*/ void draw(); - void hide(); - -private: - friend class LLUICtrlFactory; - - LLWindowShade(const Params& p); - void initFromParams(const Params& params); - - void onCloseNotification(); - void onClickNotificationButton(const std::string& name); - void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); - void onClickIgnore(LLUICtrl* ctrl); - - LLNotificationPtr mNotification; - LLSD mNotificationResponse; -}; - -LLWindowShade::LLWindowShade(const LLWindowShade::Params& params) -: LLView(params), - mNotification(params.notification) -{ -} - -void LLWindowShade::initFromParams(const LLWindowShade::Params& params) -{ - LLView::initFromParams(params); - - LLLayoutStack::Params layout_p; - layout_p.name = "notification_stack"; - layout_p.rect = LLRect(0,getLocalRect().mTop,getLocalRect().mRight, 30); - layout_p.follows.flags = FOLLOWS_ALL; - layout_p.mouse_opaque = false; - layout_p.orientation = LLLayoutStack::VERTICAL; - - LLLayoutStack* stackp = LLUICtrlFactory::create(layout_p); - addChild(stackp); - - LLLayoutPanel::Params panel_p; - panel_p.rect = LLRect(0, 30, 800, 0); - panel_p.min_height = 30; - panel_p.name = "notification_area"; - panel_p.visible = false; - panel_p.user_resize = false; - panel_p.background_visible = true; - panel_p.bg_alpha_image = params.bg_image; - panel_p.auto_resize = false; - LLLayoutPanel* notification_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(notification_panel); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = true; - panel_p.mouse_opaque = false; - LLLayoutPanel* dummy_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(dummy_panel); - - layout_p = LLUICtrlFactory::getDefaultParams(); - layout_p.rect = LLRect(0, 30, 800, 0); - layout_p.follows.flags = FOLLOWS_ALL; - layout_p.orientation = LLLayoutStack::HORIZONTAL; - stackp = LLUICtrlFactory::create(layout_p); - notification_panel->addChild(stackp); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.rect.height = 30; - LLLayoutPanel* panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(panel); - - LLIconCtrl::Params icon_p; - icon_p.name = "notification_icon"; - icon_p.rect = LLRect(5, 23, 21, 8); - panel->addChild(LLUICtrlFactory::create(icon_p)); - - LLTextBox::Params text_p; - text_p.rect = LLRect(31, 20, 430, 0); - text_p.text_color = LLColor4::black; - text_p.font = LLFontGL::getFontSansSerif(); - text_p.font.style = "BOLD"; - text_p.name = "notification_text"; - text_p.use_ellipses = true; - panel->addChild(LLUICtrlFactory::create(text_p)); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = false; - panel_p.user_resize = false; - panel_p.name="form_elements"; - panel_p.rect = LLRect(0, 30, 130, 0); - LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(form_elements_panel); - - panel_p = LLUICtrlFactory::getDefaultParams(); - panel_p.auto_resize = false; - panel_p.user_resize = false; - panel_p.rect = LLRect(0, 30, 25, 0); - LLLayoutPanel* close_panel = LLUICtrlFactory::create(panel_p); - stackp->addChild(close_panel); - - LLButton::Params button_p; - button_p.name = "close_notification"; - button_p.rect = LLRect(5, 23, 21, 7); - button_p.image_color=LLUIColorTable::instance().getColor("DkGray_66"); - button_p.image_unselected.name="Icon_Close_Foreground"; - button_p.image_selected.name="Icon_Close_Press"; - button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this); - - close_panel->addChild(LLUICtrlFactory::create(button_p)); - - LLSD payload = mNotification->getPayload(); - - LLNotificationFormPtr formp = mNotification->getForm(); - LLLayoutPanel& notification_area = getChildRef("notification_area"); - notification_area.getChild("notification_icon")->setValue(mNotification->getIcon()); - notification_area.getChild("notification_text")->setValue(mNotification->getMessage()); - notification_area.getChild("notification_text")->setToolTip(mNotification->getMessage()); - LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); - LLLayoutPanel& form_elements = notification_area.getChildRef("form_elements"); - form_elements.deleteAllChildren(); - - const S32 FORM_PADDING_HORIZONTAL = 10; - const S32 FORM_PADDING_VERTICAL = 3; - S32 cur_x = FORM_PADDING_HORIZONTAL; - - if (ignore_type != LLNotificationForm::IGNORE_NO) - { - LLCheckBoxCtrl::Params checkbox_p; - checkbox_p.name = "ignore_check"; - checkbox_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); - checkbox_p.label = formp->getIgnoreMessage(); - checkbox_p.label_text.text_color = LLColor4::black; - checkbox_p.commit_callback.function = boost::bind(&LLWindowShade::onClickIgnore, this, _1); - checkbox_p.initial_value = formp->getIgnored(); - - LLCheckBoxCtrl* check = LLUICtrlFactory::create(checkbox_p); - check->setRect(check->getBoundingRect()); - form_elements.addChild(check); - cur_x = check->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - - for (S32 i = 0; i < formp->getNumElements(); i++) - { - LLSD form_element = formp->getElement(i); - std::string type = form_element["type"].asString(); - if (type == "button") - { - LLButton::Params button_p; - button_p.name = form_element["name"]; - button_p.label = form_element["text"]; - button_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); - button_p.click_callback.function = boost::bind(&LLWindowShade::onClickNotificationButton, this, form_element["name"].asString()); - button_p.auto_resize = true; - - LLButton* button = LLUICtrlFactory::create(button_p); - button->autoResize(); - form_elements.addChild(button); - - cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - else if (type == "text" || type == "password") - { - LLTextBox::Params label_p; - label_p.name = form_element["name"].asString() + "_label"; - label_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); - label_p.initial_value = form_element["text"]; - label_p.text_color = LLColor4::black; - LLTextBox* textbox = LLUICtrlFactory::create(label_p); - textbox->reshapeToFitText(); - form_elements.addChild(textbox); - cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL; - - LLLineEditor::Params line_p; - line_p.name = form_element["name"]; - line_p.commit_callback.function = boost::bind(&LLWindowShade::onEnterNotificationText, this, _1, form_element["name"].asString()); - line_p.commit_on_focus_lost = true; - line_p.is_password = type == "password"; - line_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x + 120, FORM_PADDING_VERTICAL); - - LLLineEditor* line_editor = LLUICtrlFactory::create(line_p); - form_elements.addChild(line_editor); - cur_x = line_editor->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - } - - form_elements.reshape(cur_x, form_elements.getRect().getHeight()); -} - -void LLWindowShade::show() -{ - LLLayoutPanel& panel = getChildRef("notification_area"); - panel.setVisible(true); -} - -void LLWindowShade::draw() -{ - LLView::draw(); - if (mNotification && !mNotification->isActive()) - { - hide(); - } -} - -void LLWindowShade::hide() -{ - LLLayoutPanel& panel = getChildRef("notification_area"); - panel.setVisible(false); -} - -void LLWindowShade::onCloseNotification() -{ - LLNotifications::instance().cancel(mNotification); -} - -void LLWindowShade::onClickIgnore(LLUICtrl* ctrl) -{ - bool check = ctrl->getValue().asBoolean(); - if (mNotification && mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) - { - // question was "show again" so invert value to get "ignore" - check = !check; - } - mNotification->setIgnored(check); -} - -void LLWindowShade::onClickNotificationButton(const std::string& name) -{ - if (!mNotification) return; - - mNotificationResponse[name] = true; - - mNotification->respond(mNotificationResponse); -} - -void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) -{ - mNotificationResponse[name] = ctrl->getValue().asString(); -} - - LLMediaCtrl::Params::Params() : start_url("start_url"), border_visible("border_visible", true), @@ -1305,7 +1053,7 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) LLNotification::Params auth_request_params; auth_request_params.name = "AuthRequest"; auth_request_params.payload = LLSD().with("media_id", mMediaTextureID); - auth_request_params.functor.function = boost::bind(&LLMediaCtrl::onAuthSubmit, this, _1, _2); + auth_request_params.functor.function = boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2, mMediaSource->getMediaPlugin()); LLNotifications::instance().add(auth_request_params); }; break; @@ -1351,31 +1099,27 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) } } -void LLMediaCtrl::onAuthSubmit(const LLSD& notification, const LLSD& response) -{ - if (response["ok"]) - { - mMediaSource->getMediaPlugin()->sendAuthResponse(true, response["username"], response["password"]); - } - else - { - mMediaSource->getMediaPlugin()->sendAuthResponse(false, "", ""); - } -} - - void LLMediaCtrl::showNotification(LLNotificationPtr notify) { delete mWindowShade; LLWindowShade::Params params; + params.name = "notification_shade"; params.rect = getLocalRect(); params.follows.flags = FOLLOWS_ALL; params.notification = notify; + params.modal = true; //HACK: don't hardcode this - if (notify->getName() == "PopupAttempt") + if (notify->getIcon() == "Popup_Caution") { params.bg_image.name = "Yellow_Gradient"; + params.text_color = LLColor4::black; + } + else + { + //HACK: make this a property of the notification itself, "cancellable" + params.can_close = false; + params.text_color.control = "LabelTextColor"; } mWindowShade = LLUICtrlFactory::create(params); -- cgit v1.2.3 From 5f01d6a6861fdcd4c9c09e60a631ed92d2b15a82 Mon Sep 17 00:00:00 2001 From: callum Date: Fri, 10 Dec 2010 12:42:21 -0800 Subject: SOCIAL-364 FIX Viewer Crash when selecting Browse Linden Homes button from side panel --- indra/newview/llmediactrl.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index eaa2a60938..276ffffec4 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1333,7 +1333,27 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) { if (response["open"]) { - std::string floater_name = gFloaterView->getParentFloater(this)->getInstanceName(); + // name of default floater to open + std::string floater_name = "web_content"; + + // look for parent floater name + if ( gFloaterView ) + { + if ( gFloaterView->getParentFloater(this) ) + { + floater_name = gFloaterView->getParentFloater(this)->getInstanceName(); + } + else + { + lldebugs << "No gFloaterView->getParentFloater(this) for onPopuup()" << llendl; + }; + } + else + { + lldebugs << "No gFloaterView for onPopuup()" << llendl; + }; + + // open the same kind of floater as parent if possible if ( floater_name == "media_browser" ) { LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); -- cgit v1.2.3 From 4bf715c512cf431dd2af7fc2d9256c1823b051d6 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 13 Dec 2010 14:21:30 -0800 Subject: SOCIAL-367 FIX HTTP Auth dialog does not indicate what server a user is entering a user name and password for in Webkit 4.7 --- indra/newview/llmediactrl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 7fb75bd42a..69e0e12a36 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1052,6 +1052,14 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) { LLNotification::Params auth_request_params; auth_request_params.name = "AuthRequest"; + + // pass in host name and realm for site (may be zero length but will always exist) + LLSD args; + LLURL raw_url( self->getAuthURL().c_str() ); + args["HOST_NAME"] = raw_url.getAuthority(); + args["REALM"] = self->getAuthRealm(); + + auth_request_params.substitutions = args; auth_request_params.payload = LLSD().with("media_id", mMediaTextureID); auth_request_params.functor.function = boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2, mMediaSource->getMediaPlugin()); LLNotifications::instance().add(auth_request_params); -- cgit v1.2.3 From f32f26a1e17a5175863431db83edc2349568d588 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 13 Dec 2010 14:23:36 -0800 Subject: SOCIAL-364 FIX(2) Viewer Crash when selecting Browse Linden Homes button from side panel Changed default floater that opens if no parent found as per comments in task --- indra/newview/llmediactrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 69e0e12a36..e916f3251e 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1090,7 +1090,7 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) if (response["open"]) { // name of default floater to open - std::string floater_name = "web_content"; + std::string floater_name = "media_browser"; // look for parent floater name if ( gFloaterView ) -- cgit v1.2.3 From d0c7ecb10355940f4e94a72a85e8cb9367d52a57 Mon Sep 17 00:00:00 2001 From: callum Date: Tue, 14 Dec 2010 12:57:04 -0800 Subject: SOCIAL-366 FIX UI Issues with HTTP Dialogs in Webkit 4.7 --- indra/newview/llmediactrl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index e916f3251e..340c9e7d5c 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1144,6 +1144,14 @@ void LLMediaCtrl::showNotification(LLNotificationPtr notify) params.text_color = LLColor4::black; } else + //HACK: another one since XUI doesn't support what we need right now + if (notify->getName() == "AuthRequest") + { + params.bg_image.name = "Yellow_Gradient"; + params.text_color = LLColor4::black; + params.can_close = false; + } + else { //HACK: make this a property of the notification itself, "cancellable" params.can_close = false; -- cgit v1.2.3 From 95a4a2d387dfebe72537915614b40e253ac28f79 Mon Sep 17 00:00:00 2001 From: callum Date: Wed, 15 Dec 2010 16:36:41 -0800 Subject: SOCIAL-387 FIX Clicking on links in TOS during account activation in the viewer do not launch browser in Webkit 4.7 Mis-assumption about floaters that spawn web-content --- indra/newview/llmediactrl.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 340c9e7d5c..5834d0503b 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1115,7 +1115,6 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } else - if ( floater_name == "web_content" ) { LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } -- cgit v1.2.3 From 836bbd8395ec5ec450cee326cdffcb7e7ed0532e Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 16 Dec 2010 15:40:02 -0800 Subject: SOCIAL-370 FIX (2) Links to External Web Pages not working in Floaters such as Search in Webkit 4.7 branch --- indra/newview/llmediactrl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 5834d0503b..92fb578e81 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1109,14 +1109,15 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) lldebugs << "No gFloaterView for onPopuup()" << llendl; }; - // open the same kind of floater as parent if possible - if ( floater_name == "media_browser" ) + // (for now) open web content floater if that's our parent, otherwise, open the current media floater + // (this will change soon) + if ( floater_name == "web_content" ) { - LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); + LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } else { - LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); + LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } } else -- cgit v1.2.3 From 0af2c1a48261c301a1f030eb092e4a23674ee8b6 Mon Sep 17 00:00:00 2001 From: callum Date: Fri, 17 Dec 2010 15:54:20 -0800 Subject: SOCIAL-371 (PARTIAL) HTTP Auth sites do not load / allow login on Media on a Prim faces in Webkit 4.7 Fixes broken text substituition of realm/host only. --- indra/newview/llmediactrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 92fb578e81..1629cadda8 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1058,8 +1058,8 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) LLURL raw_url( self->getAuthURL().c_str() ); args["HOST_NAME"] = raw_url.getAuthority(); args["REALM"] = self->getAuthRealm(); - auth_request_params.substitutions = args; + auth_request_params.payload = LLSD().with("media_id", mMediaTextureID); auth_request_params.functor.function = boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2, mMediaSource->getMediaPlugin()); LLNotifications::instance().add(auth_request_params); -- cgit v1.2.3 From d275251138932e8c6c10e4c5a0d05a003ffced90 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 20 Dec 2010 16:33:25 -0800 Subject: SOCIAL-399 FIX Viewer crash when canceling http auth on a media prim Reviewed by Callum at http://codereview.lindenlab.com/5636001 --- indra/newview/llmediactrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llmediactrl.cpp') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 8d8f9dbebb..9493fddf50 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1055,7 +1055,7 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) auth_request_params.substitutions = args; auth_request_params.payload = LLSD().with("media_id", mMediaTextureID); - auth_request_params.functor.function = boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2, mMediaSource->getMediaPlugin()); + auth_request_params.functor.function = boost::bind(&LLViewerMedia::onAuthSubmit, _1, _2); LLNotifications::instance().add(auth_request_params); }; break; -- cgit v1.2.3