diff options
author | Oz Linden <oz@lindenlab.com> | 2012-06-26 13:28:19 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2012-06-26 13:28:19 -0400 |
commit | ec730b66004bf9120bb5ee3eba59f0253a78d364 (patch) | |
tree | 38f9a2eb0a8b5915b147aa2e92ea5488c9541fdd /indra/newview/llfloaterpathfindingobjects.cpp | |
parent | 5c2c85c6f7f7552a184169bc5959a84efac05895 (diff) | |
parent | b3ccf0f2adb666d558cddd3cad1e548a99ea401f (diff) |
merge to latest viewer-development-havokai
Diffstat (limited to 'indra/newview/llfloaterpathfindingobjects.cpp')
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.cpp | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index cd6d0851b9..9bfbc582bd 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -41,6 +41,8 @@ #include "llcheckboxctrl.h" #include "llenvmanager.h" #include "llfloater.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" #include "llpathfindingmanager.h" #include "llresmgr.h" #include "llscrolllistctrl.h" @@ -281,13 +283,14 @@ void LLFloaterPathfindingObjects::handleNewObjectList(LLPathfindingManager::requ void LLFloaterPathfindingObjects::handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList) { + // We current assume that handleUpdateObjectList is called only when objects are being SET llassert(pRequestId <= mMessagingRequestId); if (pRequestId == mMessagingRequestId) { switch (pRequestStatus) { case LLPathfindingManager::kRequestStarted : - setMessagingState(kMessagingGetRequestSent); + setMessagingState(kMessagingSetRequestSent); break; case LLPathfindingManager::kRequestCompleted : if (mObjectList == NULL) @@ -581,14 +584,42 @@ void LLFloaterPathfindingObjects::onTakeCopyClicked() void LLFloaterPathfindingObjects::onReturnClicked() { - handle_object_return(); - requestGetObjects(); + LLNotification::Params params("PathfindingReturnMultipleItems"); + params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleReturnItemsResponse, this, _1, _2)); + + LLSD substitutions; + int numItems = getNumSelectedObjects(); + substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems); + params.substitutions = substitutions; + + if (numItems == 1) + { + LLNotifications::getInstance()->forceResponse(params, 0); + } + else if (numItems > 1) + { + LLNotifications::getInstance()->add(params); + } } void LLFloaterPathfindingObjects::onDeleteClicked() { - handle_object_delete(); - requestGetObjects(); + LLNotification::Params params("PathfindingDeleteMultipleItems"); + params.functor.function(boost::bind(&LLFloaterPathfindingObjects::handleDeleteItemsResponse, this, _1, _2)); + + LLSD substitutions; + int numItems = getNumSelectedObjects(); + substitutions["NUM_ITEMS"] = static_cast<LLSD::Integer>(numItems); + params.substitutions = substitutions; + + if (numItems == 1) + { + LLNotifications::getInstance()->forceResponse(params, 0); + } + else if (numItems > 1) + { + LLNotifications::getInstance()->add(params); + } } void LLFloaterPathfindingObjects::onTeleportClicked() @@ -768,6 +799,24 @@ void LLFloaterPathfindingObjects::selectScrollListItemsInWorld() } } +void LLFloaterPathfindingObjects::handleReturnItemsResponse(const LLSD &pNotification, const LLSD &pResponse) +{ + if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0) + { + handle_object_return(); + requestGetObjects(); + } +} + +void LLFloaterPathfindingObjects::handleDeleteItemsResponse(const LLSD &pNotification, const LLSD &pResponse) +{ + if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0) + { + handle_object_delete(); + requestGetObjects(); + } +} + LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollListItem *pListItem) const { LLPathfindingObjectPtr objectPtr; |