From e03d469bcff93074f8598e0c095c41050a8d7d61 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 25 Jul 2013 12:43:22 -0400 Subject: [PATCH] Feature Request: Provide a way to open SLURLs without needing to post them in chat Adds chatbar as commandline command /open, which also allows opening urls as a bonus. --- indra/newview/app_settings/settings_ascent.xml | 11 +++++++++++ indra/newview/ascentprefssys.cpp | 6 ++++++ indra/newview/ascentprefssys.h | 1 + indra/newview/chatbar_as_cmdline.cpp | 13 +++++++++++-- .../xui/en-us/panel_preferences_ascent_system.xml | 6 ++++-- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index d5c0fd2e3..04ee95bdb 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -598,6 +598,17 @@ Value /away + SinguCmdLineURL + + Comment + Open SLURLS and URLs from chatbar. + Persist + 1 + Type + String + Value + /open + SinguCompleteNameProfiles Comment diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index aaafd84ae..d4d25fcbc 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -74,6 +74,7 @@ LLPrefsAscentSys::LLPrefsAscentSys() getChild("AscentCmdLineMapTo")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); getChild("AscentCmdLineTP2")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); getChild("SinguCmdLineAway")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("SinguCmdLineURL")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); //Security ---------------------------------------------------------------------------- getChild("disable_click_sit_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); @@ -179,6 +180,7 @@ void LLPrefsAscentSys::onCommitCmdLine(LLUICtrl* ctrl, const LLSD& value) childSetEnabled("map_to_keep_pos", enabled); childSetEnabled("AscentCmdLineTP2", enabled); childSetEnabled("SinguCmdLineAway", enabled); + childSetEnabled("SinguCmdLineURL", enabled); } else { @@ -240,6 +242,7 @@ void LLPrefsAscentSys::refreshValues() mCmdMapToKeepPos = gSavedSettings.getBOOL("AscentMapToKeepPos"); mCmdLineTP2 = gSavedSettings.getString("AscentCmdLineTP2"); mCmdLineAway = gSavedSettings.getString("SinguCmdLineAway"); + mCmdLineURL = gSavedSettings.getString("SinguCmdLineURL"); //Security ---------------------------------------------------------------------------- mBroadcastViewerEffects = gSavedSettings.getBOOL("BroadcastViewerEffects"); @@ -314,6 +317,7 @@ void LLPrefsAscentSys::refresh() childSetEnabled("map_to_keep_pos", mCmdLine); childSetEnabled("AscentCmdLineTP2", mCmdLine); childSetEnabled("SinguCmdLineAway", mCmdLine); + childSetEnabled("SinguCmdLineURL", mCmdLine); //Security ---------------------------------------------------------------------------- childSetValue("AscentCmdLinePos", mCmdLinePos); @@ -330,6 +334,7 @@ void LLPrefsAscentSys::refresh() childSetValue("AscentCmdLineMapTo", mCmdLineMapTo); childSetValue("AscentCmdLineTP2", mCmdLineTP2); childSetValue("SinguCmdLineAway", mCmdLineAway); + childSetValue("SinguCmdLineURL", mCmdLineURL); //Build ------------------------------------------------------------------------------- childSetValue("alpha", mAlpha); @@ -392,6 +397,7 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setBOOL("AscentMapToKeepPos", mCmdMapToKeepPos); gSavedSettings.setString("AscentCmdLineTP2", mCmdLineTP2); gSavedSettings.setString("SinguCmdLineAway", mCmdLineAway); + gSavedSettings.setString("SinguCmdLineURL", mCmdLineURL); //Security ---------------------------------------------------------------------------- gSavedSettings.setBOOL("BroadcastViewerEffects", mBroadcastViewerEffects); diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 7e60d42c9..701a8e582 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -93,6 +93,7 @@ protected: BOOL mCmdMapToKeepPos; std::string mCmdLineTP2; std::string mCmdLineAway; + std::string mCmdLineURL; //Security ---------------------------------------------------------------------------- BOOL mBroadcastViewerEffects; diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 522be26a0..83b1f3709 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -237,8 +237,9 @@ bool cmd_line_chat(std::string revised_text, EChatType type) static LLCachedControl sAscentCmdLineMapToKeepPos(gSavedSettings, "AscentMapToKeepPos"); static LLCachedControl sAscentCmdLineCalc(gSavedSettings, "AscentCmdLineCalc"); static LLCachedControl sAscentCmdLineTP2(gSavedSettings, "AscentCmdLineTP2"); - static LLCachedControl sSinguCmdLineClearChat(gSavedSettings, "SinguCmdLineAway"); static LLCachedControl sAscentCmdLineClearChat(gSavedSettings, "AscentCmdLineClearChat"); + static LLCachedControl sSinguCmdLineAway(gSavedSettings, "SinguCmdLineAway"); + static LLCachedControl sSinguCmdLineURL(gSavedSettings, "SinguCmdLineURL"); if(sAscentCmdLine) { @@ -423,11 +424,19 @@ bool cmd_line_chat(std::string revised_text, EChatType type) } return false; } - else if(command == utf8str_tolower(sSinguCmdLineClearChat)) + else if(command == utf8str_tolower(sSinguCmdLineAway)) { handle_fake_away_status(NULL); return false; } + else if(command == utf8str_tolower(sSinguCmdLineURL)) + { + if (revised_text.length() > command.length() + 1) + { + LLUrlAction::clickAction(revised_text.substr(command.length()+1)); + } + return false; + } else if(command == "typingstop") { std::string text; diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml index b848f8313..ee2057ffa 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml @@ -59,10 +59,12 @@ Clear the chat history (usage: cmd) + Open url/slurl (usage: cmd slurl) + - - Change Draw Distance (usage: cmd meters) + Change Draw Distance (usage: cmd meters) Teleport to cam position (usage: cmd)