summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llpreviewnotecard.cpp62
-rwxr-xr-xindra/newview/llpreviewnotecard.h1
-rwxr-xr-xindra/newview/skins/default/xui/en/notifications.xml12
3 files changed, 53 insertions, 22 deletions
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 307fd55875..1308d1e9a7 100755
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -500,28 +500,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
void LLPreviewNotecard::deleteNotecard()
{
- if (mObjectUUID.isNull())
- {
- LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
- if (item != NULL)
- {
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- gInventory.changeItemParent(item, trash_id, FALSE);
- }
- }
- else
- {
- LLViewerObject* object = gObjectList.findObject(mObjectUUID);
- if(object)
- {
- LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
- if (item != NULL)
- {
- object->removeInventory(mItemUUID);
- }
- }
- }
- closeFloater();
+ LLNotificationsUtil::add("DeleteNotecard", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleConfirmDeleteDialog,this, _1, _2));
}
// static
@@ -627,4 +606,43 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const
return false;
}
+bool LLPreviewNotecard::handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0)
+ {
+ // canceled
+ return false;
+ }
+
+ if (mObjectUUID.isNull())
+ {
+ // move item from agent's inventory into trash
+ LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
+ if (item != NULL)
+ {
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ gInventory.changeItemParent(item, trash_id, FALSE);
+ }
+ }
+ else
+ {
+ // delete item from inventory of in-world object
+ LLViewerObject* object = gObjectList.findObject(mObjectUUID);
+ if(object)
+ {
+ LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(object->getInventoryObject(mItemUUID));
+ if (item != NULL)
+ {
+ object->removeInventory(mItemUUID);
+ }
+ }
+ }
+
+ // close floater, ignore unsaved changes
+ mForceClose = TRUE;
+ closeFloater();
+ return false;
+}
+
// EOF
diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h
index b53c0da6be..1cf08dedd6 100755
--- a/indra/newview/llpreviewnotecard.h
+++ b/indra/newview/llpreviewnotecard.h
@@ -93,6 +93,7 @@ protected:
S32 status, LLExtStat ext_status);
bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
+ bool handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response);
protected:
LLViewerTextEditor* mEditor;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index b4d8046d18..1f816dc806 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1197,6 +1197,18 @@ Save Changes?
<notification
icon="alertmodal.tga"
+ name="DeleteNotecard"
+ type="alertmodal">
+Delete Notecard?
+ <tag>confirm</tag>
+ <usetemplate
+ name="okcancelbuttons"
+ notext="Cancel"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="GestureSaveFailedTooManySteps"
type="alertmodal">
Gesture save failed.