From 89a5f0db30bac223587997b33421100214962d30 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 12 Aug 2010 14:56:50 -0700 Subject: Added confirmation dialog to derender --- linden/indra/newview/llviewermenu.cpp | 58 +++++++++++++++++++++- .../skins/default/xui/en-us/notifications.xml | 14 ++++++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 7f45751..594694d 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -334,6 +334,7 @@ void label_sit_or_stand(std::string& label, void*); BOOL enable_take(); void handle_take(); bool confirm_take(const LLSD& notification, const LLSD& response); +bool confirm_derender_callback(const LLSD& notification, const LLSD& response); BOOL enable_buy(void*); void handle_buy(void *); void handle_buy_object(LLSaleInfo sale_info); @@ -2071,6 +2072,59 @@ class LLObjectDerender : public view_listener_t id = root_key; //LLSelectMgr::getInstance()->removeObjectFromSelections(root_key); } + + LLSD payload; + payload["id"] = id; + + // There REALLY needs to be a better (aka centralized) way to get this info + LLSD args; + std::string name; + LLViewerObject *objectp = gObjectList.findObject(id); + if (objectp) + { + if (objectp->isAvatar()) + { + LLNameValue* firstname = objectp->getNVPair("FirstName"); + LLNameValue* lastname = objectp->getNVPair("LastName"); + if (firstname && lastname) + { + name.append(firstname->getString()); + name.append(1, ' '); + name.append(lastname->getString()); + } + else + { + name.append(LLTrans::getString("TooltipPerson")); + } + } + else + { + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if (node) + { + name.append(node->mName); + } + else + { + name.append(LLTrans::getString("TooltipNoName")); + } + } + } + args["NAME"] = name; + + LLNotifications::instance().add("ConfirmDerender", args, payload, &confirm_derender_callback); + + return true; + } +}; + +bool confirm_derender_callback(const LLSD& notification, const LLSD& response) +{ + LLUUID id = notification["payload"]["id"].asUUID(); + + S32 option = LLNotification::getSelectedOption(notification, response); + if (option == 0) + { LLSelectMgr::getInstance()->removeObjectFromSelections(id); // ...don't kill the avatar @@ -2082,9 +2136,9 @@ class LLObjectDerender : public view_listener_t gObjectList.killObject(objectp); } } - return true; } -}; + return false; +} //--------------------------------------------------------------------------- diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml index c59d713..8eb2233 100644 --- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml @@ -6754,6 +6754,20 @@ Are you sure you want to move here? +Are you sure you want to derender [NAME]? + +[NAME] will be hidden until you exit the region. + + + + -- cgit v1.1