From b76c4399833c202f6cc8a6fb903fee82e8fcd3f3 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 15 Dec 2009 16:25:11 -0800 Subject: EXT-2649 Replace 'Advanced > Set Away After 30 Minutes' with Away time options EXT-2649 [BSI] Confirm on Drop EXT-3416 Can't name a new gesture on creation (and renaming is HARD) reviewed by James --- indra/newview/llviewermenu.cpp | 79 ++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 29 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0be0b56bc3..91d305bee7 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5851,47 +5851,68 @@ void confirm_replace_attachment(S32 option, void* user_data) } } -class LLAttachmentDrop : public view_listener_t +bool callback_attachment_drop(const LLSD& notification, const LLSD& response) { - bool handleEvent(const LLSD& userdata) + // Called when the user clicked on an object attached to them + // and selected "Drop". + LLUUID object_id = notification["payload"]["object_id"].asUUID(); + LLViewerObject *object = gObjectList.findObject(object_id); + + if (!object) { - // Called when the user clicked on an object attached to them - // and selected "Drop". - LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (!object) - { - llwarns << "handle_drop_attachment() - no object to drop" << llendl; - return true; - } + llwarns << "handle_drop_attachment() - no object to drop" << llendl; + return true; + } - LLViewerObject *parent = (LLViewerObject*)object->getParent(); - while (parent) + LLViewerObject *parent = (LLViewerObject*)object->getParent(); + while (parent) + { + if(parent->isAvatar()) { - if(parent->isAvatar()) - { - break; - } - object = parent; - parent = (LLViewerObject*)parent->getParent(); + break; } + object = parent; + parent = (LLViewerObject*)parent->getParent(); + } - if (!object) + if (!object) + { + llwarns << "handle_detach() - no object to detach" << llendl; + return true; + } + + if (object->isAvatar()) + { + llwarns << "Trying to detach avatar from avatar." << llendl; + return true; + } + + // reselect the object + LLSelectMgr::getInstance()->selectObjectAndFamily(object); + + LLSelectMgr::getInstance()->sendDropAttachment(); + + return true; +} + +class LLAttachmentDrop : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLSD payload; + LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + + if (object) { - llwarns << "handle_detach() - no object to detach" << llendl; - return true; + payload["object_id"] = object->getID(); } - - if (object->isAvatar()) + else { - llwarns << "Trying to detach avatar from avatar." << llendl; + llwarns << "Drop object not found" << llendl; return true; } - // The sendDropAttachment() method works on the list of selected - // objects. Thus we need to clear the list, make sure it only - // contains the object the user clicked, send the message, - // then clear the list. - LLSelectMgr::getInstance()->sendDropAttachment(); + LLNotificationsUtil::add("AttachmentDrop", LLSD(), payload, &callback_attachment_drop); return true; } }; -- cgit v1.2.3