summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfolderview.cpp6
-rw-r--r--indra/llui/llfolderview.h3
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.cpp22
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.h6
-rw-r--r--indra/newview/llfloaterimcontainer.cpp2
-rw-r--r--indra/newview/llimview.cpp2
-rw-r--r--indra/newview/llinventoryfunctions.cpp22
-rw-r--r--indra/newview/llinventoryfunctions.h1
8 files changed, 50 insertions, 14 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 324142f6c3..7c1ca017d7 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -399,6 +399,10 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void )
return NULL;
}
+LLFolderView::selected_items_t& LLFolderView::getSelectedItems( void )
+{
+ return mSelectedItems;
+}
// Record the selected item and pass it down the hierachy.
BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
@@ -752,8 +756,8 @@ void LLFolderView::removeSelectedItems()
{
// change selection on successful delete
setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
- }
}
+ }
arrangeAll();
}
else if (count > 1)
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index a6e0a3b4c0..05b2abb9d3 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -101,6 +101,7 @@ public:
};
friend class LLFolderViewScrollContainer;
+ typedef std::deque<LLFolderViewItem*> selected_items_t;
LLFolderView(const Params&);
virtual ~LLFolderView( void );
@@ -138,6 +139,7 @@ public:
// Get the last selected item
virtual LLFolderViewItem* getCurSelectedItem( void );
+ selected_items_t& getSelectedItems( void );
// Record the selected item and pass it down the hierarchy.
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
@@ -261,7 +263,6 @@ protected:
protected:
LLHandle<LLView> mPopupMenuHandle;
- typedef std::deque<LLFolderViewItem*> selected_items_t;
selected_items_t mSelectedItems;
BOOL mKeyboardSelection;
BOOL mAllowMultiSelect;
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 824ff67972..abceb5c10d 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -43,7 +43,8 @@
#include "lluuid.h"
static const F32 DND_TIMER = 3.0;
-const std::string toastName = "IMToast";
+const char * LLDoNotDisturbNotificationStorage::toastName = "IMToast";
+const char * LLDoNotDisturbNotificationStorage::offerName = "UserGiveItem";
LLDoNotDisturbNotificationStorageTimer::LLDoNotDisturbNotificationStorageTimer() : LLEventTimer(DND_TIMER)
{
@@ -72,6 +73,8 @@ LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "dnd_notifications.xml"))
, mDirty(false)
{
+ nameToPayloadParameterMap[toastName] = "SESSION_ID";
+ nameToPayloadParameterMap[offerName] = "object_id";
}
LLDoNotDisturbNotificationStorage::~LLDoNotDisturbNotificationStorage()
@@ -234,15 +237,16 @@ LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChan
return channelPtr;
}
-void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& session_id)
+void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, const LLUUID& id)
{
LLNotifications& instance = LLNotifications::instance();
LLNotificationChannelPtr channelPtr = getCommunicationChannel();
LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
LLNotificationPtr notification;
- LLSD substitutions;
- LLUUID notificationSessionID;
+ LLSD payload;
+ LLUUID notificationObjectID;
std::string notificationName;
+ std::string payloadVariable = nameToPayloadParameterMap[name];
LLCommunicationChannel::history_list_t::iterator it;
std::vector<LLCommunicationChannel::history_list_t::iterator> itemsToRemove;
@@ -252,18 +256,18 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi
++it)
{
notification = it->second;
- substitutions = notification->getSubstitutions();
- notificationSessionID = substitutions["SESSION_ID"].asUUID();
+ payload = notification->getPayload();
+ notificationObjectID = payload[payloadVariable].asUUID();
notificationName = notification->getName();
- if(notificationName == toastName
- && session_id == notificationSessionID)
+ if(notificationName == name
+ && id == notificationObjectID)
{
itemsToRemove.push_back(it);
}
}
-
+
//Remove the notifications
if(itemsToRemove.size())
{
diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h
index fd7cc7ee82..6e68b0d1be 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.h
+++ b/indra/newview/lldonotdisturbnotificationstorage.h
@@ -49,6 +49,9 @@ class LLDoNotDisturbNotificationStorage : public LLSingleton<LLDoNotDisturbNotif
{
LOG_CLASS(LLDoNotDisturbNotificationStorage);
public:
+ static const char * toastName;
+ static const char * offerName;
+
LLDoNotDisturbNotificationStorage();
~LLDoNotDisturbNotificationStorage();
@@ -58,7 +61,7 @@ public:
void saveNotifications();
void loadNotifications();
void updateNotifications();
- void removeIMNotification(const LLUUID& session_id);
+ void removeNotification(const char * name, const LLUUID& id);
protected:
@@ -68,6 +71,7 @@ private:
LLNotificationChannelPtr getCommunicationChannel() const;
bool onChannelChanged(const LLSD& pPayload);
+ std::map<std::string, std::string> nameToPayloadParameterMap;
};
#endif // LL_LLDONOTDISTURBNOTIFICATIONSTORAGE_H
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index f73db6b166..6e9f7a380f 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1316,7 +1316,7 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
//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);
+ LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, session_id);
}
}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index d0a8dfc0c8..cb03c1d234 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -144,7 +144,7 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
args["FROM"] = av_name.getCompleteName();
args["FROM_ID"] = msg["from_id"];
args["SESSION_ID"] = msg["session_id"];
- LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
+ LLNotificationsUtil::add("IMToast", args, args, boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
}
void on_new_message(const LLSD& msg)
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 6474d56414..7f9474ae70 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -46,6 +46,7 @@
#include "llappearancemgr.h"
#include "llappviewer.h"
#include "llclipboard.h"
+#include "lldonotdisturbnotificationstorage.h"
#include "llfloaterinventory.h"
#include "llfloatersidepanelcontainer.h"
#include "llfocusmgr.h"
@@ -1132,11 +1133,32 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
}
}
+void LLInventoryAction::removeItemFromDND(LLFolderView* root)
+{
+ //Get selected items
+ LLFolderView::selected_items_t selectedItems = root->getSelectedItems();
+ LLFolderViewModelItemInventory * viewModel = NULL;
+
+ //If user is in DND and deletes item, make sure the notification is not displayed by removing the notification
+ //from DND history and .xml file. Once this is done, upon exit of DND mode the item deleted will not show a notification.
+ for(LLFolderView::selected_items_t::iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
+ {
+ viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*it)->getViewModelItem());
+
+ if(viewModel && viewModel->getUUID().notNull())
+ {
+ //Will remove the item offer notification
+ LLDoNotDisturbNotificationStorage::instance().removeNotification(LLDoNotDisturbNotificationStorage::offerName, viewModel->getUUID());
+ }
+ }
+}
+
void LLInventoryAction::onItemsRemovalConfirmation( const LLSD& notification, const LLSD& response, LLFolderView* root )
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0)
{
+ removeItemFromDND(root);
root->removeSelectedItems();
}
}
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 11fc17ce9b..f1066a4dc9 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -433,6 +433,7 @@ struct LLInventoryAction
static void doToSelected(class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLFolderView* root);
+ static void removeItemFromDND(LLFolderView* root);
};