llpaneldirpeople.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 #include "llpaneldirpeople.h"
00035 #include "llviewerwindow.h"
00036 
00037 // linden library includes
00038 #include "message.h"
00039 
00040 // viewer project includes
00041 #include "llqueryflags.h"
00042 
00043 LLPanelDirPeople::LLPanelDirPeople(const std::string& name, LLFloaterDirectory* floater)
00044 :       LLPanelDirBrowser(name, floater)
00045 {
00046         mMinSearchChars = 3;
00047 }
00048 
00049 BOOL LLPanelDirPeople::postBuild()
00050 {
00051         LLPanelDirBrowser::postBuild();
00052 
00053         childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this);
00054 
00055         childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this);
00056         childDisable("Search");
00057         setDefaultBtn( "Search" );
00058 
00059         return TRUE;
00060 }
00061 
00062 LLPanelDirPeople::~LLPanelDirPeople()
00063 {
00064         // Children all cleaned up by default view destructor.
00065 }
00066 
00067 
00068 // virtual
00069 void LLPanelDirPeople::performQuery()
00070 {
00071         if (childGetValue("name").asString().length() < mMinSearchChars)
00072         {
00073                 return;
00074         }
00075 
00076         // filter short words out of the query string
00077         // and indidate if we did have to filter it
00078         // The shortest username is 2 characters long.
00079         const S32 SHORTEST_WORD_LEN = 2;
00080         bool query_was_filtered = false;
00081         std::string query_string = LLPanelDirBrowser::filterShortWords( 
00082                         childGetValue("name").asString(), 
00083                                 SHORTEST_WORD_LEN, 
00084                                         query_was_filtered );
00085 
00086         // possible we threw away all the short words in the query so check length
00087         if ( query_string.length() < mMinSearchChars )
00088         {
00089                 gViewerWindow->alertXml("SeachFilteredOnShortWordsEmpty");
00090                 return;
00091         };
00092 
00093         // if we filtered something out, display a popup
00094         if ( query_was_filtered )
00095         {
00096                 LLString::format_map_t args;
00097                 args["[FINALQUERY]"] = query_string;
00098                 gViewerWindow->alertXml("SeachFilteredOnShortWords", args);
00099         };
00100 
00101         setupNewSearch();
00102 
00103         U32 scope = DFQ_PEOPLE;
00104 
00105         // send the message
00106         sendDirFindQuery(
00107                 gMessageSystem,
00108                 mSearchID,
00109                 query_string,
00110                 scope,
00111                 mSearchStart);
00112 }

Generated on Fri May 16 08:33:50 2008 for SecondLife by  doxygen 1.5.5