diff options
Diffstat (limited to 'indra/llui/llnotifications.h')
-rw-r--r-- | indra/llui/llnotifications.h | 97 |
1 files changed, 57 insertions, 40 deletions
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index bb379121cc..de86f5daa2 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -100,6 +100,7 @@ // and we need this to manage the notification callbacks #include "llfunctorregistry.h" #include "llui.h" +#include "llmemory.h" class LLNotification; typedef boost::shared_ptr<LLNotification> LLNotificationPtr; @@ -280,6 +281,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; @@ -322,42 +328,49 @@ friend class LLNotifications; public: // parameter object used to instantiate a new notification - class Params : public LLParamBlock<Params> + struct Params : public LLInitParam::Block<Params> { friend class LLNotification; - public: - Params(const std::string& _name) - : name(_name), - mTemporaryResponder(false), - functor_name(_name), - priority(NOTIFICATION_PRIORITY_UNSPECIFIED), - timestamp(LLDate::now()) + + Mandatory<std::string> name; + + // optional + Optional<LLSD> substitutions; + Optional<LLSD> payload; + Optional<ENotificationPriority> priority; + Optional<LLSD> form_elements; + Optional<LLDate> timestamp; + Optional<LLNotificationContext*> context; + + struct Functor : public LLInitParam::Choice<Functor> { + Option<std::string> name; + Option<LLNotificationFunctorRegistry::ResponseFunctor> function; + + Functor() + : name("functor_name"), + function("functor") + {} + }; + Optional<Functor> 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<std::string> name; - - // optional - LLOptionalParam<LLSD> substitutions; - LLOptionalParam<LLSD> payload; - LLOptionalParam<ENotificationPriority> priority; - LLOptionalParam<LLSD> form_elements; - LLOptionalParam<LLDate> timestamp; - LLOptionalParam<LLNotificationContext*> context; - LLOptionalParam<std::string> functor_name; - - private: - bool mTemporaryResponder; }; private: @@ -410,10 +423,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 @@ -505,16 +514,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 @@ -813,7 +827,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(), |