From 4a2a9ba80ad4974ff1c52d83420e959240278c7e Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 16 Dec 2010 15:34:46 -0800 Subject: SOCIAL-392 FIX Web Content Panel does not save location history between sessions --- indra/newview/llfloaterwebcontent.cpp | 53 +++++++++++++++++++++++++++-------- indra/newview/llfloaterwebcontent.h | 2 ++ 2 files changed, 44 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index ca8533abc5..9eb5d1e883 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -33,6 +33,7 @@ #include "llpluginclassmedia.h" #include "llprogressbar.h" #include "lltextbox.h" +#include "llurlhistory.h" #include "llviewercontrol.h" #include "llweb.h" #include "llwindow.h" @@ -68,9 +69,35 @@ BOOL LLFloaterWebContent::postBuild() // cache image for secure browsing mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag"); + // initialize the URL history using the system URL History manager + initializeURLHistory(); + return TRUE; } +void LLFloaterWebContent::initializeURLHistory() +{ + // start with an empty list + LLCtrlListInterface* url_list = childGetListInterface("address"); + if (url_list) + { + url_list->operateOnAll(LLCtrlListInterface::OP_DELETE); + } + + // Get all of the entries in the "browser" collection + LLSD browser_history = LLURLHistory::getURLHistory("browser"); + LLSD::array_iterator iter_history = + browser_history.beginArray(); + LLSD::array_iterator end_history = + browser_history.endArray(); + for(; iter_history != end_history; ++iter_history) + { + std::string url = (*iter_history).asString(); + if(! url.empty()) + url_list->addSimpleElement(url); + } +} + //static void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid ) { @@ -255,17 +282,17 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent mStatusBarText->setText( end_str ); // decide if secure browsing icon should be displayed - std::string prefix = std::string("https://"); - std::string test_prefix = mCurrentURL.substr(0, prefix.length()); - LLStringUtil::toLower(test_prefix); - if(test_prefix == prefix) - { - mSecureLockIcon->setVisible(true); - } - else - { - mSecureLockIcon->setVisible(false); - } + std::string prefix = std::string("https://"); + std::string test_prefix = mCurrentURL.substr(0, prefix.length()); + LLStringUtil::toLower(test_prefix); + if(test_prefix == prefix) + { + mSecureLockIcon->setVisible(true); + } + else + { + mSecureLockIcon->setVisible(false); + } } else if(event == MEDIA_EVENT_CLOSE_REQUEST) { @@ -307,6 +334,10 @@ void LLFloaterWebContent::set_current_url(const std::string& url) { mCurrentURL = url; + // serialize url history into the system URL History manager + LLURLHistory::removeURL("browser", mCurrentURL); + LLURLHistory::addURL("browser", mCurrentURL); + mAddressCombo->remove( mCurrentURL ); mAddressCombo->add( mCurrentURL ); mAddressCombo->selectByValue( mCurrentURL ); diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 4bd10342fa..001d822ada 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -44,6 +44,8 @@ public: LOG_CLASS(LLFloaterWebContent); LLFloaterWebContent(const LLSD& key); + void initializeURLHistory(); + static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null); static void closeRequest(const std::string &uuid); -- cgit v1.2.3