From 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 08:04:56 +0000 Subject: merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3 ignore-dead-branch --- indra/llui/llnotifications.h | 97 ++++++++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 40 deletions(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index d01296c89e..5c8d146e0c 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -101,6 +101,7 @@ #include "llevents.h" #include "llfunctorregistry.h" #include "llui.h" +#include "llmemory.h" class LLNotification; typedef boost::shared_ptr LLNotificationPtr; @@ -235,6 +236,11 @@ struct LLNotificationTemplate // that URL. Obsolete this and eliminate the buttons for affected // messages when we allow clickable URLs in the UI U32 mURLOption; + + U32 mURLOpenExternally; + //This is a flag that tells if the url needs to open externally dispite + //what the user setting is. + // does this notification persist across sessions? if so, it will be // serialized to disk on first receipt and read on startup bool mPersist; @@ -277,42 +283,49 @@ friend class LLNotifications; public: // parameter object used to instantiate a new notification - class Params : public LLParamBlock + struct Params : public LLInitParam::Block { friend class LLNotification; - public: - Params(const std::string& _name) - : name(_name), - mTemporaryResponder(false), - functor_name(_name), - priority(NOTIFICATION_PRIORITY_UNSPECIFIED), - timestamp(LLDate::now()) + + Mandatory name; + + // optional + Optional substitutions; + Optional payload; + Optional priority; + Optional form_elements; + Optional timestamp; + Optional context; + + struct Functor : public LLInitParam::Choice { + Option name; + Option function; + + Functor() + : name("functor_name"), + function("functor") + {} + }; + Optional functor; + + Params() + : name("name"), + priority("priority", NOTIFICATION_PRIORITY_UNSPECIFIED), + timestamp("time_stamp") + { + timestamp = LLDate::now(); } - // pseudo-param - Params& functor(LLNotificationFunctorRegistry::ResponseFunctor f) - { - functor_name = LLUUID::generateNewID().asString(); - LLNotificationFunctorRegistry::instance().registerFunctor(functor_name, f); - - mTemporaryResponder = true; - return *this; + Params(const std::string& _name) + : name("name"), + priority("priority", NOTIFICATION_PRIORITY_UNSPECIFIED), + timestamp("time_stamp") + { + functor.name = _name; + name = _name; + timestamp = LLDate::now(); } - - LLMandatoryParam name; - - // optional - LLOptionalParam substitutions; - LLOptionalParam payload; - LLOptionalParam priority; - LLOptionalParam form_elements; - LLOptionalParam timestamp; - LLOptionalParam context; - LLOptionalParam functor_name; - - private: - bool mTemporaryResponder; }; private: @@ -365,10 +378,6 @@ public: // constructor from a saved notification LLNotification(const LLSD& sd); - // This is a string formatter for substituting into the message directly - // from LLSD without going through the hopefully-to-be-obsoleted LLString - static std::string format(const std::string& text, const LLSD& substitutions); - void setResponseFunctor(std::string const &responseFunctorName); typedef enum e_response_template_type @@ -460,16 +469,21 @@ public: std::string getMessage() const; std::string getLabel() const; - std::string getURL() const - { - return (mTemplatep ? mTemplatep->mURL : ""); - } + std::string getURL() const; +// { +// return (mTemplatep ? mTemplatep->mURL : ""); +// } S32 getURLOption() const { return (mTemplatep ? mTemplatep->mURLOption : -1); } - + + S32 getURLOpenExternally() const + { + return(mTemplatep? mTemplatep->mURLOpenExternally : -1); + } + const LLNotificationFormPtr getForm(); const LLDate getExpiration() const @@ -798,7 +812,10 @@ public: // OK to call more than once because it will reload bool loadTemplates(); LLXMLNodePtr checkForXMLTemplate(LLXMLNodePtr item); - + + // Add a simple notification (from XUI) + void addFromCallback(const LLSD& name); + // we provide a collection of simple add notification functions so that it's reasonable to create notifications in one line LLNotificationPtr add(const std::string& name, const LLSD& substitutions = LLSD(), -- cgit v1.2.3