Skip to content

Commit c222f5a

Browse files
authored
Merge pull request #312 from gwigz/gwigz/preferences-search-slurl
Add support for preference search SLurl
2 parents c67861f + 9e735bb commit c222f5a

4 files changed

Lines changed: 33 additions & 3 deletions

File tree

indra/newview/llfloaterpreference.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "llagent.h"
4141
#include "llagentcamera.h"
4242
#include "llcheckboxctrl.h"
43+
#include "llclipboard.h"
4344
#include "llcolorswatch.h"
4445
#include "llcombobox.h"
4546
#include "llcommandhandler.h"
@@ -74,6 +75,7 @@
7475
#include "llsliderctrl.h"
7576
#include "lltabcontainer.h"
7677
#include "lltrans.h"
78+
#include "lluri.h"
7779
#include "llviewercontrol.h"
7880
#include "llviewercamera.h"
7981
#include "llviewereventrecorder.h"
@@ -396,6 +398,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
396398
mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance()));
397399
mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this));
398400
mCommitCallbackRegistrar.add("UpdateFilter", boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); // <FS:ND/> Hook up for filtering
401+
mCommitCallbackRegistrar.add("Pref.CopySearchAsSLURL", boost::bind(&LLFloaterPreference::onCopySearch, this));
399402
#ifdef LL_DISCORD
400403
gSavedSettings.getControl("EnableDiscord")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity));
401404
gSavedSettings.getControl("ShowDiscordActivityDetails")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity));
@@ -1411,7 +1414,12 @@ void LLFloaterPreference::onOpen(const LLSD& key)
14111414
}
14121415

14131416
collectSearchableItems();
1414-
if (!mFilterEdit->getText().empty())
1417+
if (key.has("search"))
1418+
{
1419+
mFilterEdit->setText(key["search"].asString());
1420+
onUpdateFilterTerm(true);
1421+
}
1422+
else if (!mFilterEdit->getText().empty())
14151423
{
14161424
mFilterEdit->setText(LLStringExplicit(""));
14171425
onUpdateFilterTerm(true);
@@ -4269,6 +4277,12 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force)
42694277
pRoot->selectFirstTab();
42704278
}
42714279

4280+
void LLFloaterPreference::onCopySearch()
4281+
{
4282+
std::string search_query = "secondlife:///app/openfloater/preferences?search=" + LLURI::escape(mFilterEdit->getText());
4283+
LLClipboard::instance().copyToClipboard(utf8str_to_wstring(search_query), 0, static_cast<S32>(search_query.size()));
4284+
}
4285+
42724286
void LLFloaterPreference::filterIgnorableNotifications()
42734287
{
42744288
bool visible = mEnabledPopups->highlightMatchingItems(mFilterEdit->getValue());

indra/newview/llfloaterpreference.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver,
288288
boost::signals2::connection mAutoResponseNonFriendsConnection;
289289

290290
void onUpdateFilterTerm( bool force = false );
291+
void onCopySearch();
291292
void collectSearchableItems();
292293
void filterIgnorableNotifications();
293294

indra/newview/llviewerfloaterreg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class LLFloaterOpenHandler : public LLCommandHandler
334334
}
335335

336336
const std::string floater_name = LLURI::unescape(params[0].asString());
337-
LLSD key;
337+
LLSD key = query_map;
338338
if (floater_name == FLOATER_PROFILE)
339339
{
340340
key["id"] = gAgentID;

indra/newview/skins/default/xui/en/floater_preferences.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
left="0"
5757
max_length_bytes="255"
5858
name="search_prefs_edit"
59-
right="-1"
59+
right="-28"
6060
text_pad_left="6"
6161
tool_tip="Type the search term you are interested in here. Results will be displayed for partial fulltext matches within the setting's name or comment."
6262
top="0">
@@ -71,6 +71,21 @@
7171
rect.width="12"
7272
rect.bottom="-1" />
7373
</search_editor>
74+
<button
75+
height="18"
76+
width="24"
77+
follows="right|top"
78+
image_overlay="Icon_Copy"
79+
image_unselected="Toolbar_Middle_Off"
80+
image_selected="Toolbar_Middle_Selected"
81+
layout="topleft"
82+
left_pad="4"
83+
top_delta="0"
84+
name="copy_search_slurl_btn"
85+
tool_tip="Copy search query as SLURL">
86+
<button.commit_callback
87+
function="Pref.CopySearchAsSLURL" />
88+
</button>
7489
</panel>
7590

7691
<tab_container

0 commit comments

Comments
 (0)