00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034 #include "llpaneldirplaces.h"
00035
00036
00037 #include "llfontgl.h"
00038 #include "message.h"
00039 #include "lldir.h"
00040 #include "llparcel.h"
00041 #include "llregionflags.h"
00042 #include "llqueryflags.h"
00043
00044
00045 #include "llagent.h"
00046 #include "llbutton.h"
00047 #include "llcheckboxctrl.h"
00048 #include "llcombobox.h"
00049 #include "llfloaterdirectory.h"
00050 #include "lllineeditor.h"
00051 #include "llpaneldirbrowser.h"
00052 #include "lltextbox.h"
00053 #include "lluiconstants.h"
00054 #include "llviewercontrol.h"
00055 #include "llviewermessage.h"
00056 #include "llworldmap.h"
00057
00058 LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater)
00059 : LLPanelDirBrowser(name, floater)
00060 {
00061 mMinSearchChars = 3;
00062 }
00063
00064 BOOL LLPanelDirPlaces::postBuild()
00065 {
00066 LLPanelDirBrowser::postBuild();
00067
00068 childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this);
00069
00070 childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this);
00071 childDisable("Search");
00072
00073 mCurrentSortColumn = "dwell";
00074 mCurrentSortAscending = FALSE;
00075
00076
00077
00078
00079 return TRUE;
00080 }
00081
00082 LLPanelDirPlaces::~LLPanelDirPlaces()
00083 {
00084
00085 }
00086
00087
00088
00089 void LLPanelDirPlaces::draw()
00090 {
00091
00092 childSetVisible("incmature", !gAgent.isTeen());
00093 childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureSims"));
00094
00095 LLPanelDirBrowser::draw();
00096 }
00097
00098
00099 void LLPanelDirPlaces::performQuery()
00100 {
00101 LLString name = childGetValue("name").asString();
00102 if (name.length() < mMinSearchChars)
00103 {
00104 return;
00105 }
00106
00107 LLString catstring = childGetValue("Category").asString();
00108
00109
00110 S32 category = 0;
00111 if (catstring == "any")
00112 {
00113 category = LLParcel::C_ANY;
00114 }
00115 else
00116 {
00117 category = LLParcel::getCategoryFromString(catstring.c_str());
00118 }
00119
00120 BOOL pg_only = !gSavedSettings.getBOOL("ShowMatureSims")
00121 || gAgent.isTeen();
00122
00123 queryCore(name, category, pg_only);
00124 }
00125
00126 void LLPanelDirPlaces::initialQuery()
00127 {
00128
00129 const BOOL pg_only = FALSE;
00130 queryCore("", LLParcel::C_LINDEN, pg_only);
00131 }
00132
00133 void LLPanelDirPlaces::queryCore(const LLString& name,
00134 S32 category,
00135 BOOL pg_only)
00136 {
00137 setupNewSearch();
00138
00139
00140 U32 flags = 0x0;
00141
00142 if (pg_only)
00143 {
00144 flags |= DFQ_PG_PARCELS_ONLY;
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 flags |= DFQ_DWELL_SORT;
00154
00155 LLMessageSystem* msg = gMessageSystem;
00156
00157 msg->newMessage("DirPlacesQuery");
00158 msg->nextBlock("AgentData");
00159 msg->addUUID("AgentID", gAgent.getID());
00160 msg->addUUID("SessionID", gAgent.getSessionID());
00161 msg->nextBlock("QueryData");
00162 msg->addUUID("QueryID", getSearchID());
00163 msg->addString("QueryText", name);
00164 msg->addU32("QueryFlags", flags);
00165 msg->addS8("Category", (S8)category);
00166
00167
00168 msg->addString("SimName", "");
00169 msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
00170 gAgent.sendReliableMessage();
00171 }
00172