diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpaneldirgroups.cpp | 100 |
1 files changed, 15 insertions, 85 deletions
diff --git a/linden/indra/newview/llpaneldirgroups.cpp b/linden/indra/newview/llpaneldirgroups.cpp index 0a0a14d..b765e99 100644 --- a/linden/indra/newview/llpaneldirgroups.cpp +++ b/linden/indra/newview/llpaneldirgroups.cpp | |||
@@ -33,101 +33,31 @@ | |||
33 | 33 | ||
34 | #include "llpaneldirgroups.h" | 34 | #include "llpaneldirgroups.h" |
35 | 35 | ||
36 | // linden library includes | 36 | #include "llwebbrowserctrl.h" |
37 | #include "llagent.h" | ||
38 | //#include "llfontgl.h" | ||
39 | #include "message.h" | ||
40 | #include "llqueryflags.h" | ||
41 | #include "llviewercontrol.h" | ||
42 | #include "llviewerwindow.h" | ||
43 | |||
44 | // viewer project includes | ||
45 | 37 | ||
46 | LLPanelDirGroups::LLPanelDirGroups(const std::string& name, LLFloaterDirectory* floater) | 38 | LLPanelDirGroups::LLPanelDirGroups(const std::string& name, LLFloaterDirectory* floater) |
47 | : LLPanelDirBrowser(name, floater) | 39 | : LLPanelDirFind(name, floater, "groups_browser") |
48 | { | ||
49 | mMinSearchChars = 3; | ||
50 | } | ||
51 | |||
52 | |||
53 | BOOL LLPanelDirGroups::postBuild() | ||
54 | { | 40 | { |
55 | LLPanelDirBrowser::postBuild(); | ||
56 | |||
57 | childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this); | ||
58 | |||
59 | childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this); | ||
60 | childDisable("Search"); | ||
61 | setDefaultBtn( "Search" ); | ||
62 | |||
63 | return TRUE; | ||
64 | } | 41 | } |
65 | 42 | ||
66 | LLPanelDirGroups::~LLPanelDirGroups() | ||
67 | { | ||
68 | // Children all cleaned up by default view destructor. | ||
69 | } | ||
70 | 43 | ||
71 | // virtual | 44 | void LLPanelDirGroups::search(const std::string& search_text) |
72 | void LLPanelDirGroups::draw() | ||
73 | { | 45 | { |
74 | // You only have a choice if you are mature | 46 | if (!search_text.empty()) |
75 | childSetVisible("incmature", !gAgent.isTeen()); | ||
76 | childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureGroups")); | ||
77 | |||
78 | LLPanelDirBrowser::draw(); | ||
79 | } | ||
80 | |||
81 | |||
82 | // virtual | ||
83 | void LLPanelDirGroups::performQuery() | ||
84 | { | ||
85 | std::string group_name = childGetValue("name").asString(); | ||
86 | if (group_name.length() < mMinSearchChars) | ||
87 | { | 47 | { |
88 | return; | 48 | bool mature = childGetValue( "mature_check" ).asBoolean(); |
49 | std::string selected_collection = "Groups"; | ||
50 | std::string url = buildSearchURL(search_text, selected_collection, mature); | ||
51 | if (mWebBrowser) | ||
52 | { | ||
53 | mWebBrowser->navigateTo(url); | ||
54 | } | ||
89 | } | 55 | } |
90 | 56 | else | |
91 | // "hi " is three chars but not a long-enough search | ||
92 | std::string query_string = group_name; | ||
93 | LLString::trim( query_string ); | ||
94 | bool query_was_filtered = (query_string != group_name); | ||
95 | |||
96 | // possible we threw away all the short words in the query so check length | ||
97 | if ( query_string.length() < mMinSearchChars ) | ||
98 | { | ||
99 | gViewerWindow->alertXml("SeachFilteredOnShortWordsEmpty"); | ||
100 | return; | ||
101 | }; | ||
102 | |||
103 | // if we filtered something out, display a popup | ||
104 | if ( query_was_filtered ) | ||
105 | { | 57 | { |
106 | LLString::format_map_t args; | 58 | // empty search text |
107 | args["[FINALQUERY]"] = query_string; | 59 | navigateToDefaultPage(); |
108 | gViewerWindow->alertXml("SeachFilteredOnShortWords", args); | ||
109 | }; | ||
110 | |||
111 | setupNewSearch(); | ||
112 | |||
113 | // groups | ||
114 | U32 scope = DFQ_GROUPS; | ||
115 | |||
116 | // Check group mature filter. | ||
117 | if ( !gSavedSettings.getBOOL("ShowMatureGroups") | ||
118 | || gAgent.isTeen() ) | ||
119 | { | ||
120 | scope |= DFQ_FILTER_MATURE; | ||
121 | } | 60 | } |
122 | 61 | ||
123 | mCurrentSortColumn = "score"; | 62 | childSetText("search_editor", search_text); |
124 | mCurrentSortAscending = FALSE; | ||
125 | |||
126 | // send the message | ||
127 | sendDirFindQuery( | ||
128 | gMessageSystem, | ||
129 | mSearchID, | ||
130 | query_string, | ||
131 | scope, | ||
132 | mSearchStart); | ||
133 | } | 63 | } |