diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llui/llfloater.cpp | 7 | ||||
| -rw-r--r-- | indra/newview/lldonotdisturbnotificationstorage.cpp | 62 | ||||
| -rw-r--r-- | indra/newview/lldonotdisturbnotificationstorage.h | 3 | ||||
| -rw-r--r-- | indra/newview/llfloaterimcontainer.cpp | 16 | ||||
| -rw-r--r-- | indra/newview/llimview.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llnotificationstorage.cpp | 93 | ||||
| -rw-r--r-- | indra/newview/lltoastnotifypanel.cpp | 15 | ||||
| -rwxr-xr-x | indra/newview/llviewermessage.cpp | 11 | 
8 files changed, 93 insertions, 117 deletions
| diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8f9be5285d..d2aae11191 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -655,7 +655,7 @@ void LLFloater::openFloater(const LLSD& key)  {  	llinfos << "Opening floater " << getName() << llendl;  	mKey = key; // in case we need to open ourselves again -	 +  	if (getSoundFlags() != SILENT   	// don't play open sound for hosted (tabbed) windows  		&& !getHost()  @@ -2394,6 +2394,11 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)  {  	if (mFrontChild == child)  	{ + +		if (give_focus && !gFocusMgr.childHasKeyboardFocus(child)) +		{ +			child->setFocus(TRUE); +		}  		return;  	} diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 42b455c1ce..824ff67972 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -43,15 +43,16 @@  #include "lluuid.h"  static const F32 DND_TIMER = 3.0; +const std::string toastName = "IMToast";  LLDoNotDisturbNotificationStorageTimer::LLDoNotDisturbNotificationStorageTimer() : LLEventTimer(DND_TIMER)  { -    mEventTimer.start(); +  }  LLDoNotDisturbNotificationStorageTimer::~LLDoNotDisturbNotificationStorageTimer()  { -    mEventTimer.stop(); +  }  BOOL LLDoNotDisturbNotificationStorageTimer::tick() @@ -152,27 +153,27 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()          std::string notificationName = notification_params["name"];          LLNotificationPtr notification = instance.find(notificationID); -        if(notificationName == "IMToast") +        if(notificationName == toastName)          {              imToastExists = true;          }          //New notification needs to be added -            notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true)); -			LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]); -			if (responder == NULL) -			{ -				LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '" -					<< notification->getType() << "'" << LL_ENDL; -			} -			else -			{ -				LLNotificationResponderPtr responderPtr(responder); -				notification->setResponseFunctor(responderPtr); -			} -			 -			instance.add(notification); +        notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true)); +		LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]); +		if (responder == NULL) +		{ +			LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '" +				<< notification->getType() << "'" << LL_ENDL;  		} +		else +		{ +			LLNotificationResponderPtr responderPtr(responder); +			notification->setResponseFunctor(responderPtr); +		} +			 +		instance.add(notification); +	}      if(imToastExists)      { @@ -200,7 +201,7 @@ void LLDoNotDisturbNotificationStorage::updateNotifications()          LLNotificationPtr notification = it->second;          std::string notificationName = notification->getName(); -        if(notificationName == "IMToast") +        if(notificationName == toastName)          {              imToastExists = true;          } @@ -221,9 +222,9 @@ void LLDoNotDisturbNotificationStorage::updateNotifications()      //When exit DND mode, write empty notifications file      if(commChannel->getHistorySize())      { -	commChannel->clearHistory(); -	saveNotifications(); -} +	    commChannel->clearHistory(); +	    saveNotifications(); +    }  }  LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const @@ -241,6 +242,7 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi      LLNotificationPtr notification;      LLSD substitutions;      LLUUID notificationSessionID; +    std::string notificationName;      LLCommunicationChannel::history_list_t::iterator it;      std::vector<LLCommunicationChannel::history_list_t::iterator> itemsToRemove; @@ -252,8 +254,10 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi          notification = it->second;          substitutions = notification->getSubstitutions();          notificationSessionID = substitutions["SESSION_ID"].asUUID(); +        notificationName = notification->getName(); -        if(session_id == notificationSessionID) +        if(notificationName == toastName +            && session_id == notificationSessionID)          {              itemsToRemove.push_back(it);          } @@ -263,14 +267,14 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi      //Remove the notifications      if(itemsToRemove.size())      { -    while(itemsToRemove.size()) -    { -        it = itemsToRemove.back(); -        notification = it->second; +        while(itemsToRemove.size()) +        { +            it = itemsToRemove.back(); +            notification = it->second;              commChannel->removeItemFromHistory(notification); -        instance.cancel(notification); -        itemsToRemove.pop_back(); -    } +            instance.cancel(notification); +            itemsToRemove.pop_back(); +        }          //Trigger saving of notifications to xml once all have been removed          saveNotifications();      } diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h index fd03b71357..fd7cc7ee82 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.h +++ b/indra/newview/lldonotdisturbnotificationstorage.h @@ -42,9 +42,6 @@ public:      ~LLDoNotDisturbNotificationStorageTimer();  public: -    void startTimer(); -    void stopTimer(); -    bool isRunning();      BOOL tick();  }; diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index cc23449449..8f290ae7c1 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1299,11 +1299,14 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool      	if (widget && widget->getParentFolder())      	{      		widget->getParentFolder()->setSelection(widget, FALSE, FALSE); -            if(gAgent.isDoNotDisturb()) -            { -                LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id); -            }      	} + +        //When in DND mode, remove stored IM notifications +        //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal +        if(gAgent.isDoNotDisturb() && session_id.notNull()) +        { +            LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id); +        }      }      /* floater processing */ @@ -1324,11 +1327,6 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool  				// Switch to the conversation floater that is being selected  				selectFloater(session_floater);  			} - -            if(gAgent.isDoNotDisturb()) -            { -                LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id); -            }  		}  		// Set the focus on the selected floater diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ff171fc0f8..d0a8dfc0c8 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2620,8 +2620,9 @@ void LLIMMgr::addMessage(  	if (is_offline_msg)      {          LLFloaterReg::showInstance("im_container"); +	    LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")-> +	    		flashConversationItemWidget(session_id, true);      } -  }  void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args) diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index 4c5b7cc198..b6184f09bf 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -38,30 +38,43 @@  #include "llsd.h"  #include "llsdserialize.h"  #include "llsingleton.h" -#include "llviewermessage.h" +#include "llregistry.h" +#include "llviewermessage.h"  +typedef boost::function<LLNotificationResponderInterface * (const LLSD& pParams)> responder_constructor_t; -class LLResponderRegistry : public LLSingleton<LLResponderRegistry> +class LLResponderRegistry : public LLRegistrySingleton<std::string, responder_constructor_t, LLResponderRegistry>  { -public: -	LLResponderRegistry(); -	~LLResponderRegistry(); -	 -	LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams); -	 -protected: -	 -private: -	template<typename RESPONDER_TYPE> static LLNotificationResponderInterface* create(const LLSD& pParams); -	 -	typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t; -	 -	void add(const std::string& pNotificationName, const responder_constructor_t& pConstructor); -	 -	typedef std::map<std::string, responder_constructor_t> build_map_t; -	build_map_t mBuildMap; +    public: +        template<typename RESPONDER_TYPE> static LLNotificationResponderInterface * create(const LLSD& pParams); +        LLNotificationResponderInterface * createResponder(const std::string& pNotificationName, const LLSD& pParams);  }; +template<typename RESPONDER_TYPE> LLNotificationResponderInterface * LLResponderRegistry::create(const LLSD& pParams) +{ +    RESPONDER_TYPE* responder = new RESPONDER_TYPE(); +    responder->fromLLSD(pParams); +    return responder; +} + + +LLNotificationResponderInterface * LLResponderRegistry::createResponder(const std::string& pNotificationName, const LLSD& pParams) +{ +    responder_constructor_t * factoryFunc = (LLResponderRegistry::getValue(pNotificationName)); + +    if(factoryFunc) +    { +        return (*factoryFunc)(pParams); +    } +     +    return NULL; +} + +LLResponderRegistry::StaticRegistrar sRegisterObjectGiveItem("ObjectGiveItem", &LLResponderRegistry::create<LLOfferInfo>); +LLResponderRegistry::StaticRegistrar sRegisterUserGiveItem("UserGiveItem", &LLResponderRegistry::create<LLOfferInfo>); +LLResponderRegistry::StaticRegistrar sRegisterOfferInfo("offer_info", &LLResponderRegistry::create<LLOfferInfo>); + +  LLNotificationStorage::LLNotificationStorage(std::string pFileName)  	: mFileName(pFileName)  { @@ -116,47 +129,7 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData) const  	return didFileRead;  } -LLNotificationResponderInterface* LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const +LLNotificationResponderInterface * LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const  {  	return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);  } - -LLResponderRegistry::LLResponderRegistry() -	: LLSingleton<LLResponderRegistry>() -	, mBuildMap() -{ -	add("ObjectGiveItem", &create<LLOfferInfo>); -	add("UserGiveItem", &create<LLOfferInfo>); -    add("offer_info", &create<LLOfferInfo>); -} - -LLResponderRegistry::~LLResponderRegistry() -{ -} - -LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& pNotificationName, const LLSD& pParams) -{ -	build_map_t::const_iterator it = mBuildMap.find(pNotificationName); -	if(mBuildMap.end() == it) -	{ -		return NULL; -	} -	responder_constructor_t ctr = it->second; -	return ctr(pParams); -} - -template<typename RESPONDER_TYPE> LLNotificationResponderInterface* LLResponderRegistry::create(const LLSD& pParams) -{ -	RESPONDER_TYPE* responder = new RESPONDER_TYPE(); -	responder->fromLLSD(pParams); -	return responder; -} -	 -void LLResponderRegistry::add(const std::string& pNotificationName, const responder_constructor_t& pConstructor) -{ -	if (mBuildMap.find(pNotificationName) != mBuildMap.end()) -	{ -		LL_ERRS("LLResponderRegistry") << "Responder is already registered : " << pNotificationName << LL_ENDL; -	} -	mBuildMap.insert(std::make_pair<std::string, responder_constructor_t>(pNotificationName, pConstructor)); -} diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index d494d12903..268b68b539 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -356,9 +356,8 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )      if(rect != LLRect::null)      {          this->setShape(rect); -    }		  +    }      mInfoPanel = getChild<LLPanel>("info_panel"); -    mInfoPanel->setFollowsAll();      mControlPanel = getChild<LLPanel>("control_panel");      BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); @@ -453,10 +452,10 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )              if(h_pad < 2*HPAD)              {                  /* -                * Probably it is a scriptdialog toast -                * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. -                * In last case set default h_pad to avoid heaping of buttons  -                */ +                 * Probably it is a scriptdialog toast +                 * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. +                 * In last case set default h_pad to avoid heaping of buttons  +                 */                  S32 button_per_row = button_panel_width / BUTTON_WIDTH;                  h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1  because we do not need space after last button in a row                     if(h_pad < 2*HPAD) // still not enough space between buttons ? @@ -491,10 +490,10 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )              //mButtons.assign(buttons.begin(), buttons.end());          }      } +      // adjust panel's height to the text size +    mInfoPanel->setFollowsAll();      snapToMessageHeight(mTextBox, MAX_LENGTH); - -  } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index db81e057de..9878f9bc81 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1618,12 +1618,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&  			{  				opener = discard_agent_offer;  			} -			 -			 -			if (gAgent.isDoNotDisturb() && (!mFromGroup && !mFromObject)) -			{ -				send_do_not_disturb_message(gMessageSystem, mFromID); -			}  			if (modified_form != NULL)  			{ @@ -1991,6 +1985,11 @@ void inventory_offer_handler(LLOfferInfo* info)  		// In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages).  		info->send_auto_receive_response(); +        if (gAgent.isDoNotDisturb())  +        { +            send_do_not_disturb_message(gMessageSystem, info->mFromID); +        } +  		// Inform user that there is a script floater via toast system  		{  			payload["give_inventory_notification"] = TRUE; | 
