From 7b5e0f297726bf58fd4dfd3ed2725af891952835 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Wed, 10 Nov 2010 20:10:13 +0200 Subject: Fix #700: View -> Web Browser does nothing Also made the "Home" and "Set Home" buttons work. "Send current URL to parcel" is still broken in SL, since it relies on the ParcelNavigateMedia capability which was never implemented by LL. --- linden/indra/newview/llfloatermediabrowser.cpp | 43 ++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'linden/indra/newview/llfloatermediabrowser.cpp') diff --git a/linden/indra/newview/llfloatermediabrowser.cpp b/linden/indra/newview/llfloatermediabrowser.cpp index def0159..d658a11 100644 --- a/linden/indra/newview/llfloatermediabrowser.cpp +++ b/linden/indra/newview/llfloatermediabrowser.cpp @@ -35,6 +35,8 @@ #include "llfloatermediabrowser.h" #include "llfloaterhtml.h" +#include "llchat.h" +#include "llfloaterchat.h" #include "llparcel.h" #include "llpluginclassmedia.h" #include "lluictrlfactory.h" @@ -43,6 +45,7 @@ #include "llviewercontrol.h" #include "llviewerparcelmgr.h" #include "llweb.h" +#include "lltrans.h" #include "llui.h" #include "roles_constants.h" @@ -64,12 +67,14 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& media_data) void LLFloaterMediaBrowser::draw() { - childSetEnabled("go", !mAddressCombo->getValue().asString().empty()); + BOOL url_exists = !mAddressCombo->getValue().asString().empty(); + childSetEnabled("go", url_exists); + childSetEnabled("set_home", url_exists); LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if(parcel) { childSetVisible("parcel_owner_controls", LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA)); - childSetEnabled("assign", !mAddressCombo->getValue().asString().empty()); + childSetEnabled("assign", url_exists); } bool show_time_controls = false; bool media_playing = false; @@ -118,8 +123,11 @@ BOOL LLFloaterMediaBrowser::postBuild() childSetAction("close", onClickClose, this); childSetAction("open_browser", onClickOpenWebBrowser, this); childSetAction("assign", onClickAssign, this); + childSetAction("home", onClickHome, this); + childSetAction("set_home", onClickSetHome, this); buildURLHistory(); + return TRUE; } @@ -283,6 +291,37 @@ void LLFloaterMediaBrowser::onClickAssign(void* user_data) } LLViewerParcelMedia::sendMediaNavigateMessage(media_url); } + +// static +void LLFloaterMediaBrowser::onClickHome(void* user_data) +{ + LLFloaterMediaBrowser* self = (LLFloaterMediaBrowser*)user_data; + if (self) + { + if (self->mBrowser) + { + std::string home_url = gSavedSettings.getString("BrowserHome"); + self->mBrowser->navigateTo(home_url); + } + } +} + +// static +void LLFloaterMediaBrowser::onClickSetHome(void* user_data) +{ + LLFloaterMediaBrowser* self = (LLFloaterMediaBrowser*)user_data; + std::string url = self->mCurrentURL; + if(!url.empty()) + { + LLChat chat; + std::string log_message = LLTrans::getString("new_home_page") + " "; + log_message += url; + chat.mText = log_message; + LLFloaterChat::addChat(chat, FALSE, FALSE); + gSavedSettings.setString("BrowserHome", url); + } +} + //static void LLFloaterMediaBrowser::onClickRewind(void* user_data) { -- cgit v1.1