Optional V3 Web Search and support for search SLURLs
Added "Use web-based search instead of legacy v1 search" checkbox to System->General preferences Unified all functions to display search floater into toggle_search_floater and LLFloaterSearch::showInstance Added UseWebSearch and UseWebSearchSLURL debug settings for flexible configurations - SLURLs with legacy search cannot always present the same results as web Added SearchURL debug setting, a separate setting from the one used in the all tab, slightly different and always set by response["search"] on OSGrid logins to detect if websearch is supported Cleaned up llfloaterdirectory includes and added "Search.WebFloater" to the CommitCallbackRegistrar in case we ever want to add a button or something to open web search (couldn't find a nice place for it, sadly), also added more functions to show specific tabs and performQueryOn to search a tab with specific query on LLPanelDirBrowser's
This commit is contained in:
@@ -246,6 +246,7 @@ set(viewer_SOURCE_FILES
|
||||
llfloaterreporter.cpp
|
||||
llfloaterscriptdebug.cpp
|
||||
llfloaterscriptlimits.cpp
|
||||
llfloatersearch.cpp
|
||||
llfloatersearchreplace.cpp
|
||||
llfloatersellland.cpp
|
||||
llfloatersettingsdebug.cpp
|
||||
@@ -757,6 +758,7 @@ set(viewer_HEADER_FILES
|
||||
llfloaterreporter.h
|
||||
llfloaterscriptdebug.h
|
||||
llfloaterscriptlimits.h
|
||||
llfloatersearch.h
|
||||
llfloatersearchreplace.h
|
||||
llfloatersellland.h
|
||||
llfloatersettingsdebug.h
|
||||
|
||||
@@ -7310,6 +7310,22 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<integer>0</integer>
|
||||
</array>
|
||||
</map>
|
||||
<key>FloaterSearchRect</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Rectangle for web search browser window</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Rect</string>
|
||||
<key>Value</key>
|
||||
<array>
|
||||
<integer>16</integer>
|
||||
<integer>650</integer>
|
||||
<integer>600</integer>
|
||||
<integer>128</integer>
|
||||
</array>
|
||||
</map>
|
||||
<key>FloaterSnapshotRect</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -8215,6 +8231,17 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<key>Value</key>
|
||||
<string>help/index.html</string>
|
||||
</map>
|
||||
<key>SearchURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>URL for Search website, displayed in the Find floater</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string>http://search.secondlife.com/viewer/[CATEGORY]/?q=[QUERY]&p=[AUTH_TOKEN]&r=[MATURITY]&lang=[LANGUAGE]&g=[GODLIKE]&sid=[SESSION_ID]&rid=[REGION_ID]&pid=[PARCEL_ID]&channel=[CHANNEL]&version=[VERSION]&major=[VERSION_MAJOR]&minor=[VERSION_MINOR]&patch=[VERSION_PATCH]&build=[VERSION_BUILD]</string>
|
||||
</map>
|
||||
<key>WebProfileURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -620,5 +620,27 @@
|
||||
<key>Value</key>
|
||||
<boolean>0</boolean>
|
||||
</map>
|
||||
<key>UseWebSearch</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Always use web-based search instead of legacy search.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<boolean>0</boolean>
|
||||
</map>
|
||||
<key>UseWebSearchSLURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When clicking search SLURLs, or using an SLapp that uses these, display the web-based search (When false, some search SLURLs may display somewhat improperly).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<boolean>0</boolean>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
||||
@@ -53,7 +53,6 @@ LLPrefsAscentSys::LLPrefsAscentSys()
|
||||
//General -----------------------------------------------------------------------------
|
||||
getChild<LLUICtrl>("speed_rez_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2));
|
||||
getChild<LLUICtrl>("double_click_teleport_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2));
|
||||
getChild<LLUICtrl>("system_folder_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2));
|
||||
getChild<LLUICtrl>("show_look_at_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2));
|
||||
getChild<LLUICtrl>("enable_clouds")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2));
|
||||
getChild<LLUICtrl>("power_user_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2));
|
||||
@@ -111,10 +110,6 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value)
|
||||
childSetEnabled("center_after_teleport_check", enabled);
|
||||
childSetEnabled("offset_teleport_check", enabled);
|
||||
}
|
||||
else if (name == "system_folder_check")
|
||||
{
|
||||
childSetEnabled("temp_in_system_check", enabled);
|
||||
}
|
||||
else if (name == "enable_clouds")
|
||||
{
|
||||
childSetEnabled("enable_classic_clouds", enabled);
|
||||
@@ -225,6 +220,7 @@ void LLPrefsAscentSys::refreshValues()
|
||||
mSpeedRez = gSavedSettings.getBOOL("SpeedRez");
|
||||
mSpeedRezInterval = gSavedSettings.getU32("SpeedRezInterval");
|
||||
mUseWebProfiles = gSavedSettings.getBOOL("UseWebProfiles");
|
||||
mUseWebSearch = gSavedSettings.getBOOL("UseWebSearch");
|
||||
|
||||
//Command Line ------------------------------------------------------------------------
|
||||
mCmdLine = gSavedSettings.getBOOL("AscentCmdLine");
|
||||
@@ -376,6 +372,7 @@ void LLPrefsAscentSys::cancel()
|
||||
gSavedSettings.setBOOL("SpeedRez", mSpeedRez);
|
||||
gSavedSettings.setU32("SpeedRezInterval", mSpeedRezInterval);
|
||||
gSavedSettings.setBOOL("UseWebProfiles", mUseWebProfiles);
|
||||
gSavedSettings.setBOOL("UseWebSearch", mUseWebSearch);
|
||||
|
||||
//Command Line ------------------------------------------------------------------------
|
||||
gSavedSettings.setBOOL("AscentCmdLine", mCmdLine);
|
||||
|
||||
@@ -73,6 +73,7 @@ protected:
|
||||
BOOL mSpeedRez;
|
||||
U32 mSpeedRezInterval;
|
||||
bool mUseWebProfiles;
|
||||
bool mUseWebSearch;
|
||||
|
||||
//Command Line ------------------------------------------------------------------------
|
||||
BOOL mCmdLine;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "llfloaterdirectory.h"
|
||||
|
||||
#include "llfloatersearch.h" // For callback to open web search
|
||||
#include "llpaneldirfind.h"
|
||||
#include "llpaneldirevents.h"
|
||||
#include "llpaneldirland.h"
|
||||
@@ -42,36 +43,19 @@
|
||||
#include "llpaneldirgroups.h"
|
||||
#include "llpaneldirplaces.h"
|
||||
#include "llpaneldirclassified.h"
|
||||
#include "llresizehandle.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llscrollbar.h"
|
||||
#include "llbutton.h"
|
||||
|
||||
#include "llkeyboard.h"
|
||||
#include "llscrollcontainer.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "lluiconstants.h"
|
||||
#include "llviewercontrol.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llpanelavatar.h"
|
||||
#include "llpanelevent.h"
|
||||
#include "llpanelclassified.h"
|
||||
#include "llpanelgroup.h"
|
||||
#include "llpanelpick.h"
|
||||
#include "llpanelplace.h"
|
||||
#include "llpaneldirland.h"
|
||||
#include "llfloateravatarinfo.h"
|
||||
#include "lldir.h"
|
||||
#include "lluictrlfactory.h"
|
||||
|
||||
#include "hippogridmanager.h"
|
||||
#include "llenvmanager.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llwindow.h"
|
||||
|
||||
#include "llnotifications.h"
|
||||
|
||||
const char* market_panel = "market_panel";
|
||||
|
||||
@@ -140,7 +124,7 @@ public:
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("MarketplaceURLChanged", LLSD(), LLSD(),
|
||||
boost::bind(&LLPanelDirMarket::onConfirmChangeMarketplaceURL, this, boost::bind(LLNotification::getSelectedOption, _1, _2), url));
|
||||
boost::bind(&LLPanelDirMarket::onConfirmChangeMarketplaceURL, this, boost::bind(LLNotificationsUtil::getSelectedOption, _1, _2), url));
|
||||
}
|
||||
}
|
||||
else if (!mMarketplaceURL.empty())
|
||||
@@ -239,6 +223,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
|
||||
|
||||
if (enableWebSearch)
|
||||
{
|
||||
mCommitCallbackRegistrar.add("Search.WebFloater", boost::bind(&LLFloaterSearch::open, boost::bind(LLFloaterSearch::getInstance)));
|
||||
if (enableClassicAllSearch)
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory3.xml", &factory_map);
|
||||
else
|
||||
@@ -452,6 +437,11 @@ void LLFloaterDirectory::showClassified(const LLUUID& classified_id)
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showClassified(const std::string& search_text)
|
||||
{
|
||||
performQueryOn("classified_panel", search_text);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showEvents(S32 event_id)
|
||||
@@ -470,6 +460,12 @@ void LLFloaterDirectory::showEvents(S32 event_id)
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showEvents(const std::string& search_text)
|
||||
{
|
||||
performQueryOn("events_panel", search_text);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showLandForSale(const LLUUID& parcel_id)
|
||||
{
|
||||
@@ -482,9 +478,37 @@ void LLFloaterDirectory::showLandForSale(const LLUUID& parcel_id)
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showGroups()
|
||||
void LLFloaterDirectory::showDestinations()
|
||||
{
|
||||
showPanel("groups_panel");
|
||||
showPanel("showcase_panel");
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showGroups(const std::string& search_text)
|
||||
{
|
||||
performQueryOn("groups_panel", search_text);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showPeople(const std::string& search_text)
|
||||
{
|
||||
performQueryOn("people_panel", search_text);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterDirectory::showPlaces(const std::string& search_text)
|
||||
{
|
||||
performQueryOn("places_panel", search_text);
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterDirectory::performQueryOn(const std::string& name, const std::string& search_text)
|
||||
{
|
||||
showPanel(name);
|
||||
if (search_text.empty()) return; // We're done here.
|
||||
LLPanelDirBrowser* panel = sInstance->getChild<LLPanelDirBrowser>(name);
|
||||
panel->getChild<LLUICtrl>("name")->setValue(search_text);
|
||||
panel->performQuery();
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -73,9 +73,14 @@ public:
|
||||
// selected.
|
||||
static void showFindAll(const std::string& search_text);
|
||||
static void showClassified(const LLUUID& classified_id);
|
||||
static void showClassified(const std::string& search_text = "");
|
||||
static void showEvents(S32 event_id);
|
||||
static void showEvents(const std::string& search_text = "");
|
||||
static void showLandForSale(const LLUUID& parcel_id);
|
||||
static void showGroups();
|
||||
static void showDestinations();
|
||||
static void showGroups(const std::string& search_text = "");
|
||||
static void showPeople(const std::string& search_text = "");
|
||||
static void showPlaces(const std::string& search_text = "");
|
||||
static void refreshGroup(const LLUUID& group_id);
|
||||
static void hide(void*);
|
||||
|
||||
@@ -86,6 +91,7 @@ public:
|
||||
void hideAllDetailPanels();
|
||||
|
||||
private:
|
||||
static void performQueryOn(const std::string& name, const std::string& search_text);
|
||||
static void showPanel(const std::string& tabname);
|
||||
/*virtual*/ void onClose(bool app_quitting);
|
||||
void focusCurrentPanel();
|
||||
|
||||
279
indra/newview/llfloatersearch.cpp
Executable file
279
indra/newview/llfloatersearch.cpp
Executable file
@@ -0,0 +1,279 @@
|
||||
/**
|
||||
* @file llfloatersearch.cpp
|
||||
* @author Martin Reddy
|
||||
* @brief Search floater - uses an embedded web browser control
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llcommandhandler.h"
|
||||
#include "llfloatersearch.h"
|
||||
#include "llfloaterdirectory.h"
|
||||
#include "llmediactrl.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lluserauth.h"
|
||||
#include "lluri.h"
|
||||
#include "llagent.h"
|
||||
#include "llui.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llweb.h"
|
||||
|
||||
void toggle_search_floater()
|
||||
{
|
||||
if (!gSavedSettings.getString("SearchURL").empty() && gSavedSettings.getBOOL("UseWebSearch"))
|
||||
{
|
||||
if (LLFloaterSearch::instanceExists() && LLFloaterSearch::instance().getVisible())
|
||||
LLFloaterSearch::instance().close();
|
||||
else
|
||||
LLFloaterSearch::getInstance()->open();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterDirectory::toggleFind(0);
|
||||
}
|
||||
}
|
||||
|
||||
// support secondlife:///app/search/{CATEGORY}/{QUERY} SLapps
|
||||
class LLSearchHandler : public LLCommandHandler
|
||||
{
|
||||
public:
|
||||
// requires trusted browser to trigger
|
||||
LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_THROTTLE) { }
|
||||
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
|
||||
{
|
||||
/*if (!LLUI::sSettingGroups["config"]->getBOOL("EnableSearch"))
|
||||
{
|
||||
LLNotificationsUtil::add("NoSearch", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
|
||||
return true;
|
||||
}*/
|
||||
|
||||
const size_t parts = tokens.size();
|
||||
|
||||
// get the (optional) category for the search
|
||||
std::string category;
|
||||
if (parts > 0)
|
||||
{
|
||||
category = tokens[0].asString();
|
||||
}
|
||||
|
||||
// get the (optional) search string
|
||||
std::string search_text;
|
||||
if (parts > 1)
|
||||
{
|
||||
search_text = tokens[1].asString();
|
||||
}
|
||||
|
||||
// create the LLSD arguments for the search floater
|
||||
LLFloaterSearch::Params p;
|
||||
p.search.category = category;
|
||||
p.search.query = LLURI::unescape(search_text);
|
||||
|
||||
// open the search floater and perform the requested search
|
||||
//LLFloaterReg::showInstance("search", p);
|
||||
LLFloaterSearch::showInstance(p.search, gSavedSettings.getBOOL("UseWebSearchSLURL"));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
LLSearchHandler gSearchHandler;
|
||||
|
||||
LLFloaterSearch::SearchQuery::SearchQuery()
|
||||
: category("category", ""),
|
||||
query("query")
|
||||
{}
|
||||
|
||||
// Singu Note: We use changeDefault instead of setting these in onOpen
|
||||
LLFloaterSearch::_Params::_Params()
|
||||
{
|
||||
changeDefault(trusted_content, true);
|
||||
changeDefault(allow_address_entry, false);
|
||||
changeDefault(window_class, "search"); // Don't include this in the count with "web_content"
|
||||
}
|
||||
|
||||
LLFloaterSearch::LLFloaterSearch(const Params& key) :
|
||||
LLFloaterWebContent(key),
|
||||
mSearchGodLevel(0)
|
||||
{
|
||||
// declare a map that transforms a category name into
|
||||
// the URL suffix that is used to search that category
|
||||
mCategoryPaths = LLSD::emptyMap();
|
||||
mCategoryPaths["all"] = "search";
|
||||
mCategoryPaths["people"] = "search/people";
|
||||
mCategoryPaths["places"] = "search/places";
|
||||
mCategoryPaths["events"] = "search/events";
|
||||
mCategoryPaths["groups"] = "search/groups";
|
||||
mCategoryPaths["wiki"] = "search/wiki";
|
||||
mCategoryPaths["destinations"] = "destinations";
|
||||
mCategoryPaths["classifieds"] = "classifieds";
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_web_content.xml");
|
||||
}
|
||||
|
||||
BOOL LLFloaterSearch::postBuild()
|
||||
{
|
||||
LLFloaterWebContent::postBuild();
|
||||
mWebBrowser->addObserver(this);
|
||||
// Singu Note: Initialize ui and browser now
|
||||
mWebBrowser->setTrustedContent(true);
|
||||
mWebBrowser->setFocus(true);
|
||||
getChild<LLPanel>("status_bar")->setVisible(true);
|
||||
getChild<LLPanel>("nav_controls")->setVisible(true);
|
||||
getChildView("address")->setEnabled(false);
|
||||
getChildView("popexternal")->setEnabled(false);
|
||||
setRectControl("FloaterSearchRect");
|
||||
applyRectControl();
|
||||
search(SearchQuery());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterSearch::showInstance(const SearchQuery& search, bool web)
|
||||
{
|
||||
if (!gSavedSettings.getString("SearchURL").empty() && (web || gSavedSettings.getBOOL("UseWebSearch")))
|
||||
{
|
||||
LLFloaterSearch* floater = getInstance();
|
||||
floater->open(); // May not be open
|
||||
floater->search(search);
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string category(search.category());
|
||||
if (category.empty() || category == "all")
|
||||
LLFloaterDirectory::showFindAll(search.query);
|
||||
else if (category == "people")
|
||||
LLFloaterDirectory::showPeople(search.query);
|
||||
else if (category == "places")
|
||||
LLFloaterDirectory::showPlaces(search.query);
|
||||
else if (category == "events")
|
||||
LLFloaterDirectory::showEvents(search.query);
|
||||
else if (category == "groups")
|
||||
LLFloaterDirectory::showGroups(search.query);
|
||||
/* Singu TODO: Wiki tab in secondlife legacy search floater?
|
||||
else if (category == "wiki")
|
||||
LLFloaterDirectory::showWiki(search.query);*/
|
||||
else if (category == "destinations")
|
||||
LLFloaterDirectory::showDestinations();
|
||||
else if (category == "classifieds")
|
||||
LLFloaterDirectory::showClassified(search.query);
|
||||
else
|
||||
LLNotificationsUtil::add("UnsupportedCommandSLURL"); // Singu Note: Perhaps we should use a special notification here?
|
||||
}
|
||||
}
|
||||
|
||||
/*void LLFloaterSearch::onOpen(const LLSD& key)
|
||||
{
|
||||
Params p(key);
|
||||
p.trusted_content = true;
|
||||
p.allow_address_entry = false;
|
||||
|
||||
LLFloaterWebContent::onOpen(p);
|
||||
search(p.search);
|
||||
}*/
|
||||
|
||||
void LLFloaterSearch::onClose(bool app_quitting)
|
||||
{
|
||||
if (!app_quitting) // Singu Note: Copy the behavior of the legacy search singleton retaining last search when reopened
|
||||
{
|
||||
setVisible(false);
|
||||
return;
|
||||
}
|
||||
LLFloaterWebContent::onClose(app_quitting);
|
||||
// tear down the web view so we don't show the previous search
|
||||
// result when the floater is opened next time
|
||||
destroy();
|
||||
}
|
||||
|
||||
void LLFloaterSearch::godLevelChanged(U8 godlevel)
|
||||
{
|
||||
// search results can change based upon god level - if the user
|
||||
// changes god level, then give them a warning (we don't refresh
|
||||
// the search as this might undo any page navigation or
|
||||
// AJAX-driven changes since the last search).
|
||||
|
||||
//FIXME: set status bar text
|
||||
|
||||
//getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel));
|
||||
}
|
||||
|
||||
void LLFloaterSearch::search(const SearchQuery &p)
|
||||
{
|
||||
if (! mWebBrowser || !p.validateBlock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// reset the god level warning as we're sending the latest state
|
||||
//getChildView("refresh_search")->setVisible(FALSE);
|
||||
mSearchGodLevel = gAgent.getGodLevel();
|
||||
|
||||
// work out the subdir to use based on the requested category
|
||||
LLSD subs;
|
||||
if (mCategoryPaths.has(p.category))
|
||||
{
|
||||
subs["CATEGORY"] = mCategoryPaths[p.category].asString();
|
||||
}
|
||||
else
|
||||
{
|
||||
subs["CATEGORY"] = mCategoryPaths["all"].asString();
|
||||
}
|
||||
|
||||
// add the search query string
|
||||
subs["QUERY"] = LLURI::escape(p.query);
|
||||
|
||||
// add the permissions token that login.cgi gave us
|
||||
// We use "search_token", and fallback to "auth_token" if not present.
|
||||
LLSD search_token = LLUserAuth::getInstance()->getResponse("search_token");
|
||||
if (search_token.asString().empty())
|
||||
{
|
||||
search_token = LLUserAuth::getInstance()->getResponse("auth_token");
|
||||
}
|
||||
subs["AUTH_TOKEN"] = search_token.asString();
|
||||
|
||||
// add the user's preferred maturity (can be changed via prefs)
|
||||
std::string maturity;
|
||||
if (gAgent.prefersAdult())
|
||||
{
|
||||
maturity = "42"; // PG,Mature,Adult
|
||||
}
|
||||
else if (gAgent.prefersMature())
|
||||
{
|
||||
maturity = "21"; // PG,Mature
|
||||
}
|
||||
else
|
||||
{
|
||||
maturity = "13"; // PG
|
||||
}
|
||||
subs["MATURITY"] = maturity;
|
||||
|
||||
// add the user's god status
|
||||
subs["GODLIKE"] = gAgent.isGodlike() ? "1" : "0";
|
||||
|
||||
// get the search URL and expand all of the substitutions
|
||||
// (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
|
||||
std::string url = gSavedSettings.getString("SearchURL");
|
||||
url = LLWeb::expandURLSubstitutions(url, subs);
|
||||
|
||||
// and load the URL in the web view
|
||||
mWebBrowser->navigateTo(url, "text/html");
|
||||
}
|
||||
97
indra/newview/llfloatersearch.h
Executable file
97
indra/newview/llfloatersearch.h
Executable file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @file llfloatersearch.h
|
||||
* @author Martin Reddy
|
||||
* @brief Search floater - uses an embedded web browser control
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLFLOATERSEARCH_H
|
||||
#define LL_LLFLOATERSEARCH_H
|
||||
|
||||
#include "llfloaterwebcontent.h"
|
||||
#include "llviewermediaobserver.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class LLMediaCtrl;
|
||||
|
||||
///
|
||||
/// The search floater allows users to perform all search operations.
|
||||
/// All search functionality is now implemented via web services and
|
||||
/// so this floater simply embeds a web view and displays the search
|
||||
/// web page. The browser control is explicitly marked as "trusted"
|
||||
/// so that the user can click on teleport links in search results.
|
||||
///
|
||||
class LLFloaterSearch :
|
||||
public LLFloaterWebContent, public LLSingleton<LLFloaterSearch>
|
||||
{
|
||||
public:
|
||||
struct SearchQuery : public LLInitParam::Block<SearchQuery>
|
||||
{
|
||||
Optional<std::string> category;
|
||||
Optional<std::string> query;
|
||||
|
||||
SearchQuery();
|
||||
};
|
||||
|
||||
struct _Params : public LLInitParam::Block<_Params, LLFloaterWebContent::Params>
|
||||
{
|
||||
Optional<SearchQuery> search;
|
||||
_Params(); // Singu Note: We use changeDefault instead of setting these in onOpen
|
||||
};
|
||||
|
||||
typedef LLSDParamAdapter<_Params> Params;
|
||||
|
||||
LLFloaterSearch(const Params& key = Params());
|
||||
|
||||
using LLSingleton<LLFloaterSearch>::getInstance;
|
||||
static void showInstance(const SearchQuery& p, bool web = false);
|
||||
|
||||
/// show the search floater with a new search
|
||||
/// see search() for details on the key parameter.
|
||||
/// Singu Note: Leave the browser (and position) alone, here, we'll call search() directly with a SearchQuery if opening the floater through showInstance()
|
||||
/*virtual*/ void onOpen(/*const LLSD& key*/) {}
|
||||
|
||||
/*virtual*/ void onClose(bool app_quitting);
|
||||
|
||||
/// perform a search with the specific search term.
|
||||
/// The key should be a map that can contain the following keys:
|
||||
/// - "id": specifies the text phrase to search for
|
||||
/// - "category": one of "all" (default), "people", "places",
|
||||
/// "events", "groups", "wiki", "destinations", "classifieds"
|
||||
void search(const SearchQuery &query);
|
||||
|
||||
/// changing godmode can affect the search results that are
|
||||
/// returned by the search website - use this method to tell the
|
||||
/// search floater that the user has changed god level.
|
||||
void godLevelChanged(U8 godlevel);
|
||||
|
||||
private:
|
||||
/*virtual*/ BOOL postBuild();
|
||||
|
||||
LLSD mCategoryPaths;
|
||||
U8 mSearchGodLevel;
|
||||
};
|
||||
|
||||
#endif // LL_LLFLOATERSEARCH_H
|
||||
|
||||
@@ -1718,11 +1718,9 @@ void LLFloaterWorldMap::onChangeMaturity()
|
||||
bool can_access_adult = gAgent.canAccessAdult();
|
||||
|
||||
getChildView("events_mature_icon")->setVisible( can_access_mature);
|
||||
getChildView("event_mature_label")->setVisible( can_access_mature);
|
||||
getChildView("event_mature_chk")->setVisible( can_access_mature);
|
||||
|
||||
getChildView("events_adult_icon")->setVisible( can_access_adult);
|
||||
getChildView("event_adult_label")->setVisible( can_access_adult);
|
||||
getChildView("event_adult_chk")->setVisible( can_access_adult);
|
||||
|
||||
// disable mature / adult events.
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#include "llagent.h"
|
||||
#include "llcommandhandler.h"
|
||||
#include "llfloaterchatterbox.h" // for LLFloaterMyFriends
|
||||
#include "llfloaterdirectory.h"
|
||||
#include "llfloatergroupinfo.h"
|
||||
#include "llfloatersearch.h"
|
||||
#include "llgroupmgr.h"
|
||||
#include "llimview.h" // for gIMMgr
|
||||
#include "llnotificationsutil.h"
|
||||
@@ -125,7 +125,9 @@ LLGroupHandler gGroupHandler;
|
||||
void LLGroupActions::search()
|
||||
{
|
||||
//LLFloaterReg::showInstance("search", LLSD().with("category", "groups"));
|
||||
LLFloaterDirectory::showGroups();
|
||||
LLFloaterSearch::SearchQuery search;
|
||||
search.category = "groups";
|
||||
LLFloaterSearch::showInstance(search);
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
#include "llworldmap.h"
|
||||
#include "llfocusmgr.h"
|
||||
|
||||
void toggle_search_floater();
|
||||
|
||||
void handle_track_avatar(const LLUUID& agent_id, const std::string& name)
|
||||
{
|
||||
LLAvatarTracker::instance().track(agent_id, name);
|
||||
@@ -97,7 +99,7 @@ void handle_mini_map(void*)
|
||||
|
||||
void handle_find(void*)
|
||||
{
|
||||
LLFloaterDirectory::toggleFind(NULL);
|
||||
toggle_search_floater();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void LLPanelDirEvents::performQueryOrDelete(U32 event_id)
|
||||
U32 cat_id = childGetValue("category combo").asInteger();
|
||||
|
||||
params << cat_id << "|";
|
||||
params << childGetValue("event_search_text").asString();
|
||||
params << childGetValue("name").asString();
|
||||
|
||||
// send the message
|
||||
if (0 == event_id)
|
||||
|
||||
@@ -4151,6 +4151,7 @@ bool process_login_success_response(std::string& password)
|
||||
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setPasswordUrl(tmp);
|
||||
tmp = response["search"].asString();
|
||||
if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setSearchUrl(tmp);
|
||||
if (gHippoGridManager->getConnectedGrid()->isOpenSimulator()) gSavedSettings.setString("SearchURL", tmp); // Singu Note: For web search purposes, always set this setting
|
||||
tmp = response["currency"].asString();
|
||||
if (!tmp.empty())
|
||||
{
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
#include "llenvmanager.h"
|
||||
#include "llfloaterbuycurrency.h"
|
||||
#include "llfloaterchat.h"
|
||||
#include "llfloaterdirectory.h" // to spawn search
|
||||
#include "llfloaterinventory.h"
|
||||
#include "llfloaterlagmeter.h"
|
||||
#include "llfloaterland.h"
|
||||
#include "llfloaterregioninfo.h"
|
||||
#include "llfloaterscriptdebug.h"
|
||||
#include "llfloatersearch.h"
|
||||
#include "llhudicon.h"
|
||||
#include "llkeyboard.h"
|
||||
#include "lllineeditor.h"
|
||||
@@ -994,8 +994,9 @@ void LLStatusBar::onCommitSearch(LLUICtrl*, void* data)
|
||||
void LLStatusBar::onClickSearch(void* data)
|
||||
{
|
||||
LLStatusBar* self = (LLStatusBar*)data;
|
||||
std::string search_text = self->childGetText("search_editor");
|
||||
LLFloaterDirectory::showFindAll(search_text);
|
||||
LLFloaterSearch::SearchQuery search;
|
||||
search.query = self->childGetText("search_editor");
|
||||
LLFloaterSearch::showInstance(search);
|
||||
}
|
||||
|
||||
// static
|
||||
|
||||
@@ -188,6 +188,8 @@
|
||||
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
void toggle_search_floater();
|
||||
|
||||
using namespace LLOldEvents;
|
||||
using namespace LLAvatarAppearanceDefines;
|
||||
void init_client_menu(LLMenuGL* menu);
|
||||
@@ -5546,7 +5548,7 @@ class LLEditSearch : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLFloaterDirectory::toggleFind(NULL);
|
||||
toggle_search_floater();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
</text>
|
||||
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="-24"
|
||||
follows="left|right|top" font="SansSerif" height="18" left="56"
|
||||
max_length="63" mouse_opaque="true" name="event_search_text" width="160" spell_check="true" />
|
||||
max_length="63" mouse_opaque="true" name="name" width="160" spell_check="true" />
|
||||
<radio_group bottom="-40" draw_border="false" follows="right|top" height="40" left="560"
|
||||
mouse_opaque="true" name="date_mode" width="300">
|
||||
<radio_item bottom="-20" follows="left|top" height="20" left="0" mouse_opaque="true"
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
</text>
|
||||
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="-24"
|
||||
follows="left|right|top" font="SansSerif" height="18" left="56"
|
||||
max_length="63" mouse_opaque="true" name="event_search_text" width="160" spell_check="true" />
|
||||
max_length="63" mouse_opaque="true" name="name" width="160" spell_check="true" />
|
||||
<radio_group bottom="-40" draw_border="false" follows="right|top" height="40" left="560"
|
||||
mouse_opaque="true" name="date_mode" width="300">
|
||||
<radio_item bottom="-20" follows="left|top" height="20" left="0" mouse_opaque="true"
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
</text>
|
||||
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="-24"
|
||||
follows="left|right|top" font="SansSerif" height="18" left="56"
|
||||
max_length="63" mouse_opaque="true" name="event_search_text" width="160" spell_check="true" />
|
||||
max_length="63" mouse_opaque="true" name="name" width="160" spell_check="true" />
|
||||
<radio_group bottom="-40" draw_border="false" follows="right|top" height="40" left="560"
|
||||
mouse_opaque="true" name="date_mode" width="300">
|
||||
<radio_item bottom="-20" follows="left|top" height="20" left="0" mouse_opaque="true"
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
label="Draw distance stepping interval:" label_width="180" max_val="60" min_val="5" initial_val="20" increment="5" name="speed_rez_interval" />
|
||||
<text bottom_delta="0" left_delta="235" follows="left|top" height="16" name="speed_rez_seconds">seconds</text>
|
||||
<check_box bottom_delta="-18" control_name="UseWebProfiles" follows="top" left="10" name="use_web_profiles" label="Use web profiles instead of legacy v1 profiles" tool_tip="May not be available on certain grids"/>
|
||||
<check_box bottom_delta="-18" control_name="UseWebSearch" follows="top" left="10" name="use_web_search" label="Use web-based search instead of legacy v1 search" tool_tip="May not be available on certain grids"/>
|
||||
</panel>
|
||||
|
||||
<panel border="true" bottom="-580" height="525" label="Command Line" left="1" name="Command Line" width="418">
|
||||
|
||||
@@ -116,7 +116,6 @@
|
||||
<text name="text2">
|
||||
Trouver
|
||||
</text>
|
||||
<line_editor name="event_search_text"/>
|
||||
<radio_group name="date_mode">
|
||||
<radio_item name="current">
|
||||
En cours et futurs
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<text name="text2" width="60">
|
||||
Encontrar:
|
||||
</text>
|
||||
<line_editor left="69" name="event_search_text" width="150" />
|
||||
<line_editor left="69" name="name" width="150" />
|
||||
<radio_group name="date_mode">
|
||||
<radio_item name="current">
|
||||
Em progresso e processando
|
||||
|
||||
Reference in New Issue
Block a user