aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldirclassified.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpaneldirclassified.cpp
parentREADME.txt (diff)
downloadmeta-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/llpaneldirclassified.cpp')
-rw-r--r--linden/indra/newview/llpaneldirclassified.cpp201
1 files changed, 201 insertions, 0 deletions
diff --git a/linden/indra/newview/llpaneldirclassified.cpp b/linden/indra/newview/llpaneldirclassified.cpp
new file mode 100644
index 0000000..f2b8d2d
--- /dev/null
+++ b/linden/indra/newview/llpaneldirclassified.cpp
@@ -0,0 +1,201 @@
1/**
2 * @file llpaneldirclassified.cpp
3 * @brief Classified 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 "llenum.h"
31
32#include "llpaneldirclassified.h"
33
34#include "llclassifiedflags.h"
35
36// linden library includes
37#include "llfontgl.h"
38#include "message.h"
39#include "llqueryflags.h"
40
41// viewer project includes
42#include "llagent.h"
43#include "llbutton.h"
44#include "llcontrol.h"
45#include "llcombobox.h"
46#include "llclassifiedinfo.h"
47#include "lluiconstants.h"
48#include "llpaneldirbrowser.h"
49#include "lltextbox.h"
50
51#include "llcheckboxctrl.h"
52#include "llfloaterdirectory.h"
53#include "lllineeditor.h"
54#include "llpaneldirbrowser.h"
55#include "lltextbox.h"
56#include "llviewermessage.h"
57#include "llworldmap.h"
58
59//
60#include "llfloateravatarinfo.h"
61#include "llviewermenu.h"
62
63//-----------------------------------------------------------------------------
64// Constants
65//-----------------------------------------------------------------------------
66
67LLPanelDirClassified::LLPanelDirClassified(const char* name, LLFloaterDirectory* floater)
68: LLPanelDirBrowser(name, floater)
69{
70}
71
72BOOL LLPanelDirClassified::postBuild()
73{
74 LLPanelDirBrowser::postBuild();
75
76 // Teens don't get mature checkbox
77 if (gAgent.mAccess < SIM_ACCESS_MATURE)
78 {
79 childSetValue("incmature", FALSE);
80 childHide("incmature");
81 }
82
83 // 0 or 3+ character searches allowed, exciting
84 childSetKeystrokeCallback("name", onKeystrokeNameClassified, this);
85
86 childSetAction("Search", onClickSearchCore, this);
87 setDefaultBtn( "Search" );
88
89 childSetAction("Place an Ad...", onClickCreateNewClassified, this);
90
91 childSetAction("Delete", onClickDelete, this);
92 childDisable("Delete");
93 childHide("Delete");
94
95 // Don't do this every time we open find, it's expensive; require clicking 'search'
96 //requestClassified();
97
98 return TRUE;
99}
100
101
102LLPanelDirClassified::~LLPanelDirClassified()
103{
104 // Children all cleaned up by default view destructor.
105}
106
107
108void LLPanelDirClassified::draw()
109{
110 refresh();
111
112 LLPanelDirBrowser::draw();
113}
114
115void LLPanelDirClassified::refresh()
116{
117 BOOL godlike = gAgent.isGodlike();
118 childSetVisible("Delete", godlike);
119 childSetEnabled("Delete", godlike);
120}
121
122//Open Profile to Classifieds tab
123void LLPanelDirClassified::onClickCreateNewClassified(void *userdata)
124{
125 LLFloaterAvatarInfo::showFromObject(gAgent.getID(), "Classified");
126}
127
128// static
129void LLPanelDirClassified::onClickDelete(void *userdata)
130{
131 LLPanelDirClassified *self = (LLPanelDirClassified *)userdata;
132
133 LLUUID classified_id;
134 S32 type;
135
136 self->getSelectedInfo(&classified_id, &type);
137
138 // Clear out the list. Deleting a classified will cause a refresh to be
139 // sent.
140 self->setupNewSearch();
141
142 LLMessageSystem* msg = gMessageSystem;
143
144 msg->newMessageFast(_PREHASH_ClassifiedGodDelete);
145 msg->nextBlockFast(_PREHASH_AgentData);
146 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
147 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
148 msg->nextBlockFast(_PREHASH_Data);
149 msg->addUUIDFast(_PREHASH_ClassifiedID, classified_id);
150 msg->addUUIDFast(_PREHASH_QueryID, self->mSearchID);
151 gAgent.sendReliableMessage();
152}
153
154
155void LLPanelDirClassified::performQuery()
156{
157 lldebugs << "LLPanelDirClassified::performQuery()" << llendl;
158 // This sets mSearchID and clears the list of results
159 setupNewSearch();
160
161 // send the message
162 LLMessageSystem *msg = gMessageSystem;
163 msg->newMessageFast(_PREHASH_DirClassifiedQuery);
164 msg->nextBlockFast(_PREHASH_AgentData);
165 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
166 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
167
168 BOOL filter_mature = !childGetValue("incmature").asBoolean();
169 BOOL filter_auto_renew = FALSE;
170 U32 query_flags = pack_classified_flags(filter_mature, filter_auto_renew);
171 //if (gAgent.mAccess <= SIM_ACCESS_PG) query_flags |= DFQ_PG_SIMS_ONLY;
172
173 U32 category = childGetValue("Category").asInteger();
174
175 msg->nextBlockFast(_PREHASH_QueryData);
176 msg->addUUIDFast(_PREHASH_QueryID, mSearchID );
177 msg->addStringFast(_PREHASH_QueryText, childGetValue("name").asString());
178 msg->addU32Fast(_PREHASH_QueryFlags, query_flags);
179 msg->addU32Fast(_PREHASH_Category, category);
180 msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
181
182 gAgent.sendReliableMessage();
183}
184
185void LLPanelDirClassified::onKeystrokeNameClassified(LLLineEditor* line, void* data)
186{
187 LLPanelDirClassified *self = (LLPanelDirClassified*)data;
188 S32 len = line->getLength();
189 if (len == 0
190 || len >= 3)
191 {
192 // no text searches are cheap, as are longer searches
193 self->setDefaultBtn( "Search" );
194 self->childEnable("Search");
195 }
196 else
197 {
198 self->setDefaultBtn();
199 self->childDisable("Search");
200 }
201}