diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpaneldirfind.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llpaneldirfind.cpp')
-rw-r--r-- | linden/indra/newview/llpaneldirfind.cpp | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/linden/indra/newview/llpaneldirfind.cpp b/linden/indra/newview/llpaneldirfind.cpp new file mode 100644 index 0000000..433cb76 --- /dev/null +++ b/linden/indra/newview/llpaneldirfind.cpp | |||
@@ -0,0 +1,160 @@ | |||
1 | /** | ||
2 | * @file llpaneldirfind.cpp | ||
3 | * @brief The "Find All" panel in the Find directory. | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llpaneldirfind.h" | ||
31 | |||
32 | // linden library includes | ||
33 | #include "llclassifiedflags.h" | ||
34 | #include "llfontgl.h" | ||
35 | #include "llparcel.h" | ||
36 | #include "llqueryflags.h" | ||
37 | #include "message.h" | ||
38 | |||
39 | // viewer project includes | ||
40 | #include "llagent.h" | ||
41 | #include "llbutton.h" | ||
42 | #include "llcheckboxctrl.h" | ||
43 | #include "llcombobox.h" | ||
44 | #include "llviewercontrol.h" | ||
45 | #include "lllineeditor.h" | ||
46 | #include "llmenucommands.h" | ||
47 | #include "llmenugl.h" | ||
48 | #include "llscrolllistctrl.h" | ||
49 | #include "lltextbox.h" | ||
50 | #include "lluiconstants.h" | ||
51 | #include "llviewerimagelist.h" | ||
52 | #include "llviewermessage.h" | ||
53 | #include "llfloateravatarinfo.h" | ||
54 | #include "lldir.h" | ||
55 | #include "llvieweruictrlfactory.h" | ||
56 | #include "llfloaterdirectory.h" | ||
57 | #include "llpaneldirbrowser.h" | ||
58 | |||
59 | LLPanelDirFind::LLPanelDirFind(const std::string& name, LLFloaterDirectory* floater) | ||
60 | : LLPanelDirBrowser(name, floater) | ||
61 | { | ||
62 | mMinSearchChars = 3; | ||
63 | } | ||
64 | |||
65 | BOOL LLPanelDirFind::postBuild() | ||
66 | { | ||
67 | LLPanelDirBrowser::postBuild(); | ||
68 | |||
69 | childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); | ||
70 | |||
71 | childSetAction("Search", onClickSearch, this); | ||
72 | childDisable("Search"); | ||
73 | setDefaultBtn( "Search" ); | ||
74 | |||
75 | return TRUE; | ||
76 | } | ||
77 | |||
78 | // virtual | ||
79 | void LLPanelDirFind::draw() | ||
80 | { | ||
81 | // You only have a choice if you are mature | ||
82 | childSetVisible("incmature", gAgent.mAccess >= SIM_ACCESS_MATURE); | ||
83 | childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureFindAll")); | ||
84 | |||
85 | LLPanelDirBrowser::draw(); | ||
86 | } | ||
87 | |||
88 | LLPanelDirFind::~LLPanelDirFind() | ||
89 | { | ||
90 | // Children all cleaned up by default view destructor. | ||
91 | } | ||
92 | |||
93 | // static | ||
94 | void LLPanelDirFind::onCommitScope(LLUICtrl* ctrl, void* data) | ||
95 | { | ||
96 | LLPanelDirFind* self = (LLPanelDirFind*)data; | ||
97 | self->setFocus(TRUE); | ||
98 | } | ||
99 | |||
100 | // static | ||
101 | void LLPanelDirFind::onClickSearch(void *userdata) | ||
102 | { | ||
103 | LLPanelDirFind *self = (LLPanelDirFind *)userdata; | ||
104 | |||
105 | if (self->childGetValue("name").asString().length() < self->mMinSearchChars) | ||
106 | { | ||
107 | return; | ||
108 | }; | ||
109 | |||
110 | self->setupNewSearch(); | ||
111 | |||
112 | // Figure out scope | ||
113 | U32 scope = 0x0; | ||
114 | scope |= DFQ_PEOPLE; // people (not just online = 0x01 | 0x02) | ||
115 | // places handled below | ||
116 | scope |= DFQ_EVENTS; // events | ||
117 | scope |= DFQ_GROUPS; // groups | ||
118 | |||
119 | if (!gSavedSettings.getBOOL("ShowMatureFindAll") || gAgent.mAccess <= SIM_ACCESS_PG) scope |= DFQ_PG_SIMS_ONLY; | ||
120 | |||
121 | // send the message | ||
122 | LLMessageSystem *msg = gMessageSystem; | ||
123 | S32 start_row = 0; | ||
124 | sendDirFindQuery(msg, self->mSearchID, self->childGetValue("name").asString(), scope, start_row); | ||
125 | |||
126 | // Also look up classified ads. JC 12/2005 | ||
127 | BOOL filter_mature = !gSavedSettings.getBOOL("ShowMatureFindAll"); | ||
128 | if (gAgent.mAccess <= SIM_ACCESS_PG) filter_mature = TRUE; | ||
129 | BOOL filter_auto_renew = FALSE; | ||
130 | U32 classified_flags = pack_classified_flags(filter_mature, filter_auto_renew); | ||
131 | msg->newMessage("DirClassifiedQuery"); | ||
132 | msg->nextBlock("AgentData"); | ||
133 | msg->addUUID("AgentID", gAgent.getID()); | ||
134 | msg->addUUID("SessionID", gAgent.getSessionID()); | ||
135 | msg->nextBlock("QueryData"); | ||
136 | msg->addUUID("QueryID", self->mSearchID); | ||
137 | msg->addString("QueryText", self->childGetValue("name").asString()); | ||
138 | msg->addU32("QueryFlags", classified_flags); | ||
139 | msg->addU32("Category", 0); // all categories | ||
140 | msg->addS32("QueryStart", 0); | ||
141 | gAgent.sendReliableMessage(); | ||
142 | |||
143 | U32 query_flags = DFQ_DWELL_SORT; | ||
144 | if (!gSavedSettings.getBOOL("ShowMatureFindAll") || gAgent.mAccess <= SIM_ACCESS_PG) query_flags |= DFQ_PG_SIMS_ONLY; | ||
145 | |||
146 | // Need to use separate find places query because places are | ||
147 | // sent using the more compact DirPlacesReply message. | ||
148 | msg->newMessage("DirPlacesQuery"); | ||
149 | msg->nextBlock("AgentData"); | ||
150 | msg->addUUID("AgentID", gAgent.getID() ); | ||
151 | msg->addUUID("SessionID", gAgent.getSessionID()); | ||
152 | msg->nextBlock("QueryData"); | ||
153 | msg->addUUID("QueryID", self->mSearchID ); | ||
154 | msg->addString("QueryText", self->childGetValue("name").asString()); | ||
155 | msg->addU32("QueryFlags", query_flags ); | ||
156 | msg->addS32("QueryStart", 0 ); // Always get the first 100 when using find ALL | ||
157 | msg->addS8("Category", LLParcel::C_ANY); | ||
158 | msg->addString("SimName", NULL); | ||
159 | gAgent.sendReliableMessage(); | ||
160 | } | ||