diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-01-15 17:50:40 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-01-15 17:50:40 +0200 |
commit | d5fe509c154913d76673d60ab153297a357466bb (patch) | |
tree | a6341667567d7b0d58cade7dc9bdccf4584b1918 /indra/newview | |
parent | fd83804a1ca95d7bbe10fb3a7586b12d3cbd6085 (diff) |
MAINT-4777 FIXED Confusing 'Save changes?' dialog when hitting the Delete button in notecard edit floater
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llpreviewnotecard.cpp | 62 | ||||
-rwxr-xr-x | indra/newview/llpreviewnotecard.h | 1 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 12 |
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. |