aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldirplaces.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpaneldirplaces.cpp156
1 files changed, 16 insertions, 140 deletions
diff --git a/linden/indra/newview/llpaneldirplaces.cpp b/linden/indra/newview/llpaneldirplaces.cpp
index 3e79ec0..3980fb4 100644
--- a/linden/indra/newview/llpaneldirplaces.cpp
+++ b/linden/indra/newview/llpaneldirplaces.cpp
@@ -33,161 +33,37 @@
33 33
34#include "llpaneldirplaces.h" 34#include "llpaneldirplaces.h"
35 35
36// linden library includes 36#include "llwebbrowserctrl.h"
37#include "llfontgl.h"
38#include "message.h"
39#include "lldir.h"
40#include "llparcel.h"
41#include "llregionflags.h"
42#include "llqueryflags.h"
43
44// viewer project includes
45#include "llagent.h"
46#include "llbutton.h"
47#include "llcheckboxctrl.h"
48#include "llcombobox.h"
49#include "llfloaterdirectory.h"
50#include "lllineeditor.h"
51#include "llviewerwindow.h"
52#include "llpaneldirbrowser.h"
53#include "lltextbox.h"
54#include "lluiconstants.h"
55#include "llviewercontrol.h"
56#include "llviewermessage.h"
57#include "llworldmap.h"
58 37
59LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater) 38LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater)
60 : LLPanelDirBrowser(name, floater) 39: LLPanelDirFind(name, floater, "places_browser")
61{
62 mMinSearchChars = 3;
63}
64
65BOOL LLPanelDirPlaces::postBuild()
66{
67 LLPanelDirBrowser::postBuild();
68
69 childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this);
70
71 childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this);
72 childDisable("Search");
73
74 mCurrentSortColumn = "dwell";
75 mCurrentSortAscending = FALSE;
76
77 // Don't prepopulate the places list, as it hurts the database as of 2006-12-04. JC
78 // initialQuery();
79
80 return TRUE;
81}
82
83LLPanelDirPlaces::~LLPanelDirPlaces()
84{ 40{
85 // Children all cleaned up by default view destructor.
86} 41}
87 42
88 43
89// virtual 44void LLPanelDirPlaces::search(const std::string& search_text)
90void LLPanelDirPlaces::draw()
91{
92 // You only have a choice if you are mature
93 childSetVisible("incmature", !gAgent.isTeen());
94 childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureSims"));
95
96 LLPanelDirBrowser::draw();
97}
98
99// virtual
100void LLPanelDirPlaces::performQuery()
101{ 45{
102 LLString place_name = childGetValue("name").asString(); 46 if (!search_text.empty())
103 if (place_name.length() < mMinSearchChars)
104 { 47 {
105 return; 48 bool mature = childGetValue( "mature_check" ).asBoolean();
106 } 49 std::string selected_collection = "Places";
107 50 std::string url = buildSearchURL(search_text, selected_collection, mature);
108 // "hi " is three chars but not a long-enough search 51 if (mWebBrowser)
109 std::string query_string = place_name; 52 {
110 LLString::trim( query_string ); 53 mWebBrowser->navigateTo(url);
111 bool query_was_filtered = (query_string != place_name); 54 }
112
113 // possible we threw away all the short words in the query so check length
114 if ( query_string.length() < mMinSearchChars )
115 {
116 gViewerWindow->alertXml("SeachFilteredOnShortWordsEmpty");
117 return;
118 };
119
120 // if we filtered something out, display a popup
121 if ( query_was_filtered )
122 {
123 LLString::format_map_t args;
124 args["[FINALQUERY]"] = query_string;
125 gViewerWindow->alertXml("SeachFilteredOnShortWords", args);
126 };
127
128 LLString catstring = childGetValue("Category").asString();
129
130 // Because LLParcel::C_ANY is -1, must do special check
131 S32 category = 0;
132 if (catstring == "any")
133 {
134 category = LLParcel::C_ANY;
135 } 55 }
136 else 56 else
137 { 57 {
138 category = LLParcel::getCategoryFromString(catstring.c_str()); 58 // empty search text
59 navigateToDefaultPage();
139 } 60 }
140 61
141 BOOL pg_only = !gSavedSettings.getBOOL("ShowMatureSims") 62 childSetText("search_editor", search_text);
142 || gAgent.isTeen();
143
144 queryCore(query_string, category, pg_only);
145} 63}
146 64
147void LLPanelDirPlaces::initialQuery() 65LLPanelDirPlaces::~LLPanelDirPlaces()
148{
149 // All Linden locations in PG/Mature sims, any name.
150 const BOOL pg_only = FALSE;
151 queryCore("", LLParcel::C_LINDEN, pg_only);
152}
153
154void LLPanelDirPlaces::queryCore(const LLString& name,
155 S32 category,
156 BOOL pg_only)
157{ 66{
158 setupNewSearch(); 67 // Children all cleaned up by default view destructor.
159
160 // send the message
161 U32 flags = 0x0;
162
163 if (pg_only)
164 {
165 flags |= DFQ_PG_PARCELS_ONLY;
166 }
167
168// JC: Sorting by dwell severely impacts the performance of the query.
169// Instead of sorting on the dataserver, we sort locally once the results
170// are received.
171// IW: Re-enabled dwell sort based on new 3-character minimum description
172// Hopefully we'll move to next-gen Find before this becomes a big problem
173
174 flags |= DFQ_DWELL_SORT;
175
176 LLMessageSystem* msg = gMessageSystem;
177
178 msg->newMessage("DirPlacesQuery");
179 msg->nextBlock("AgentData");
180 msg->addUUID("AgentID", gAgent.getID());
181 msg->addUUID("SessionID", gAgent.getSessionID());
182 msg->nextBlock("QueryData");
183 msg->addUUID("QueryID", getSearchID());
184 msg->addString("QueryText", name);
185 msg->addU32("QueryFlags", flags);
186 msg->addS8("Category", (S8)category);
187 // No longer support queries by region name, too many regions
188 // for combobox, no easy way to do autocomplete. JC
189 msg->addString("SimName", "");
190 msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
191 gAgent.sendReliableMessage();
192} 68}
193 69