diff options
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | indra/newview/llcommanddispatcherlistener.cpp | 47 | ||||
| -rw-r--r-- | indra/newview/llcommanddispatcherlistener.h | 30 | ||||
| -rw-r--r-- | indra/newview/llcommandhandler.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.h | 5 | ||||
| -rw-r--r-- | indra/newview/llpanelloginlistener.cpp | 34 | ||||
| -rw-r--r-- | indra/newview/llpanelloginlistener.h | 30 | ||||
| -rw-r--r-- | indra/newview/llurldispatcher.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llurldispatcherlistener.cpp | 58 | ||||
| -rw-r--r-- | indra/newview/llurldispatcherlistener.h | 32 | 
11 files changed, 254 insertions, 2 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index be6bce8054..72630cc413 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -104,6 +104,7 @@ set(viewer_SOURCE_FILES      llclassifiedstatsresponder.cpp      llcloud.cpp      llcolorswatch.cpp +    llcommanddispatcherlistener.cpp      llcommandhandler.cpp      llcommandlineparser.cpp      llcompilequeue.cpp @@ -324,6 +325,7 @@ set(viewer_SOURCE_FILES      llpanellandmarks.cpp      llpanellandmedia.cpp      llpanellogin.cpp +    llpanelloginlistener.cpp      llpanellookinfo.cpp      llpanelmaininventory.cpp      llpanelmediasettingsgeneral.cpp @@ -444,6 +446,7 @@ set(viewer_SOURCE_FILES      lluploaddialog.cpp      llurl.cpp      llurldispatcher.cpp +    llurldispatcherlistener.cpp      llurlhistory.cpp      llurllineeditorctrl.cpp      llurlsimstring.cpp @@ -611,6 +614,7 @@ set(viewer_HEADER_FILES      llclassifiedstatsresponder.h      llcloud.h      llcolorswatch.h +    llcommanddispatcherlistener.h      llcommandhandler.h      llcommandlineparser.h      llcompilequeue.h @@ -826,6 +830,7 @@ set(viewer_HEADER_FILES      llpanellandmarks.h      llpanellandmedia.h      llpanellogin.h +    llpanelloginlistener.h      llpanellookinfo.h      llpanelmaininventory.h      llpanelmediasettingsgeneral.h @@ -950,6 +955,7 @@ set(viewer_HEADER_FILES      lluploaddialog.h      llurl.h      llurldispatcher.h +    llurldispatcherlistener.h      llurlhistory.h      llurllineeditorctrl.h      llurlsimstring.h diff --git a/indra/newview/llcommanddispatcherlistener.cpp b/indra/newview/llcommanddispatcherlistener.cpp new file mode 100644 index 0000000000..00a20de30e --- /dev/null +++ b/indra/newview/llcommanddispatcherlistener.cpp @@ -0,0 +1,47 @@ +/** + * @file   llcommanddispatcherlistener.cpp + * @author Nat Goodspeed + * @date   2009-12-10 + * @brief  Implementation for llcommanddispatcherlistener. + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "llcommanddispatcherlistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llcommandhandler.h" + +LLCommandDispatcherListener::LLCommandDispatcherListener(/* LLCommandDispatcher* instance */): +    LLEventAPI("LLCommandDispatcher", "Access to LLCommandHandler commands") /* , +    mDispatcher(instance) */ +{ +    add("dispatch", +        "Execute a command registered as an LLCommandHandler,\n" +        "passing any required parameters:\n" +        "[\"cmd\"] string command name\n" +        "[\"params\"] array of parameters, as if from components of URL path\n" +        "[\"query\"] map of parameters, as if from ?key1=val&key2=val\n" +        "[\"trusted\"] boolean indicating trusted browser [default true]", +        &LLCommandDispatcherListener::dispatch); +} + +void LLCommandDispatcherListener::dispatch(const LLSD& params) const +{ +    // For most purposes, we expect callers to want to be trusted. +    bool trusted_browser = true; +    if (params.has("trusted")) +    { +        // But for testing, allow a caller to specify untrusted. +        trusted_browser = params["trusted"].asBoolean(); +    } +    LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], NULL, +                                  trusted_browser); +} diff --git a/indra/newview/llcommanddispatcherlistener.h b/indra/newview/llcommanddispatcherlistener.h new file mode 100644 index 0000000000..d0070ddd71 --- /dev/null +++ b/indra/newview/llcommanddispatcherlistener.h @@ -0,0 +1,30 @@ +/** + * @file   llcommanddispatcherlistener.h + * @author Nat Goodspeed + * @date   2009-12-10 + * @brief  LLEventAPI for LLCommandDispatcher + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLCOMMANDDISPATCHERLISTENER_H) +#define LL_LLCOMMANDDISPATCHERLISTENER_H + +#include "lleventapi.h" +class LLCommandDispatcher; +class LLSD; + +class LLCommandDispatcherListener: public LLEventAPI +{ +public: +    LLCommandDispatcherListener(/* LLCommandDispatcher* instance */); // all static members + +private: +    void dispatch(const LLSD& params) const; + +    //LLCommandDispatcher* mDispatcher; +}; + +#endif /* ! defined(LL_LLCOMMANDDISPATCHERLISTENER_H) */ diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp index 1d92661ea2..8c7e7bea83 100644 --- a/indra/newview/llcommandhandler.cpp +++ b/indra/newview/llcommandhandler.cpp @@ -35,12 +35,15 @@  #include "llcommandhandler.h"  #include "llnotificationsutil.h" +#include "llcommanddispatcherlistener.h"  // system includes  #include <boost/tokenizer.hpp>  #define THROTTLE_PERIOD    15    // required secs between throttled commands +static LLCommandDispatcherListener sCommandDispatcherListener; +  //---------------------------------------------------------------------------  // Underlying registry for command handlers, not directly accessible.  //--------------------------------------------------------------------------- diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index af8db31fad..a5bfa18851 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -73,6 +73,11 @@  #include "llfloatertos.h"  #include "lltrans.h"  #include "llglheaders.h" +#include "llpanelloginlistener.h" + +#if LL_WINDOWS +#pragma warning(disable: 4355)      // 'this' used in initializer list +#endif  // LL_WINDOWS  #define USE_VIEWER_AUTH 0 @@ -166,7 +171,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,  	mLogoImage(),  	mCallback(callback),  	mCallbackData(cb_data), -	mHtmlAvailable( TRUE ) +	mHtmlAvailable( TRUE ), +	mListener(new LLPanelLoginListener(this))  {  	setFocusRoot(TRUE); diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index e3d30d7d0c..97350ce5c7 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -36,10 +36,11 @@  #include "llpanel.h"  #include "llpointer.h"			// LLPointer<>  #include "llmediactrl.h"	// LLMediaCtrlObserver +#include <boost/scoped_ptr.hpp>  class LLLineEditor;  class LLUIImage; - +class LLPanelLoginListener;  class LLPanelLogin:	  	public LLPanel, @@ -90,6 +91,7 @@ public:  	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);  private: +	friend class LLPanelLoginListener;  	void reshapeBrowser();  	static void onClickConnect(void*);  	static void onClickNewAccount(void*); @@ -103,6 +105,7 @@ private:  private:  	LLPointer<LLUIImage> mLogoImage; +	boost::scoped_ptr<LLPanelLoginListener> mListener;  	void			(*mCallback)(S32 option, void *userdata);  	void*			mCallbackData; diff --git a/indra/newview/llpanelloginlistener.cpp b/indra/newview/llpanelloginlistener.cpp new file mode 100644 index 0000000000..f7e59aaf54 --- /dev/null +++ b/indra/newview/llpanelloginlistener.cpp @@ -0,0 +1,34 @@ +/** + * @file   llpanelloginlistener.cpp + * @author Nat Goodspeed + * @date   2009-12-10 + * @brief  Implementation for llpanelloginlistener. + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "llpanelloginlistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llpanellogin.h" + +LLPanelLoginListener::LLPanelLoginListener(LLPanelLogin* instance): +    LLEventAPI("LLPanelLogin", "Access to LLPanelLogin methods"), +    mPanel(instance) +{ +    add("onClickConnect", +        "Pretend user clicked the \"Log In\" button", +        &LLPanelLoginListener::onClickConnect); +} + +void LLPanelLoginListener::onClickConnect(const LLSD&) const +{ +    mPanel->onClickConnect(NULL); +} diff --git a/indra/newview/llpanelloginlistener.h b/indra/newview/llpanelloginlistener.h new file mode 100644 index 0000000000..0a56c75422 --- /dev/null +++ b/indra/newview/llpanelloginlistener.h @@ -0,0 +1,30 @@ +/** + * @file   llpanelloginlistener.h + * @author Nat Goodspeed + * @date   2009-12-10 + * @brief  LLEventAPI for LLPanelLogin + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLPANELLOGINLISTENER_H) +#define LL_LLPANELLOGINLISTENER_H + +#include "lleventapi.h" +class LLPanelLogin; +class LLSD; + +class LLPanelLoginListener: public LLEventAPI +{ +public: +    LLPanelLoginListener(LLPanelLogin* instance); + +private: +    void onClickConnect(const LLSD&) const; + +    LLPanelLogin* mPanel; +}; + +#endif /* ! defined(LL_LLPANELLOGINLISTENER_H) */ diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 46618d4026..f8c82f8b22 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -47,11 +47,14 @@  #include "llurlsimstring.h"  #include "llweb.h"  #include "llworldmapmessage.h" +#include "llurldispatcherlistener.h"  // library includes  #include "llnotificationsutil.h"  #include "llsd.h" +static LLURLDispatcherListener sURLDispatcherListener; +  class LLURLDispatcherImpl  {  public: diff --git a/indra/newview/llurldispatcherlistener.cpp b/indra/newview/llurldispatcherlistener.cpp new file mode 100644 index 0000000000..fea6a769c5 --- /dev/null +++ b/indra/newview/llurldispatcherlistener.cpp @@ -0,0 +1,58 @@ +/** + * @file   llurldispatcherlistener.cpp + * @author Nat Goodspeed + * @date   2009-12-10 + * @brief  Implementation for llurldispatcherlistener. + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "llurldispatcherlistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llurldispatcher.h" + +LLURLDispatcherListener::LLURLDispatcherListener(/* LLURLDispatcher* instance */): +    LLEventAPI("LLURLDispatcher", "Internal URL handling") /* , +    mDispatcher(instance) */ +{ +    add("dispatch", +        "At startup time or on clicks in internal web browsers,\n" +        "teleport, open map, or run requested command.\n" +        "[\"url\"] string url to dispatch\n" +        "[\"trusted\"] boolean indicating trusted browser [default true]", +        &LLURLDispatcherListener::dispatch); +    add("dispatchRightClick", "Dispatch [\"url\"] as if from a right-click on a hot link.", +        &LLURLDispatcherListener::dispatchRightClick); +    add("dispatchFromTextEditor", "Dispatch [\"url\"] as if from an edit field.", +        &LLURLDispatcherListener::dispatchFromTextEditor); +} + +void LLURLDispatcherListener::dispatch(const LLSD& params) const +{ +    // For most purposes, we expect callers to want to be trusted. +    bool trusted_browser = true; +    if (params.has("trusted")) +    { +        // But for testing, allow a caller to specify untrusted. +        trusted_browser = params["trusted"].asBoolean(); +    } +    LLURLDispatcher::dispatch(params["url"], NULL, trusted_browser); +} + +void LLURLDispatcherListener::dispatchRightClick(const LLSD& params) const +{ +    LLURLDispatcher::dispatchRightClick(params["url"]); +} + +void LLURLDispatcherListener::dispatchFromTextEditor(const LLSD& params) const +{ +    LLURLDispatcher::dispatchFromTextEditor(params["url"]); +} diff --git a/indra/newview/llurldispatcherlistener.h b/indra/newview/llurldispatcherlistener.h new file mode 100644 index 0000000000..894afcbb51 --- /dev/null +++ b/indra/newview/llurldispatcherlistener.h @@ -0,0 +1,32 @@ +/** + * @file   llurldispatcherlistener.h + * @author Nat Goodspeed + * @date   2009-12-10 + * @brief  LLEventAPI for LLURLDispatcher + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLURLDISPATCHERLISTENER_H) +#define LL_LLURLDISPATCHERLISTENER_H + +#include "lleventapi.h" +class LLURLDispatcher; +class LLSD; + +class LLURLDispatcherListener: public LLEventAPI +{ +public: +    LLURLDispatcherListener(/* LLURLDispatcher* instance */); // all static members + +private: +    void dispatch(const LLSD& params) const; +    void dispatchRightClick(const LLSD& params) const; +    void dispatchFromTextEditor(const LLSD& params) const; + +    //LLURLDispatcher* mDispatcher; +}; + +#endif /* ! defined(LL_LLURLDISPATCHERLISTENER_H) */  | 
