summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventorybridge.cpp16
-rw-r--r--indra/newview/llinventoryfunctions.cpp23
-rw-r--r--indra/newview/llinventoryfunctions.h6
-rw-r--r--indra/newview/llpreviewnotecard.cpp30
-rw-r--r--indra/newview/llpreviewnotecard.h4
-rw-r--r--indra/newview/skins/default/xui/en/floater_preview_notecard.xml12
6 files changed, 75 insertions, 16 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index c6f806178c..2d08c0a01a 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -853,21 +853,7 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
const LLUUID& new_parent_id,
BOOL restamp)
{
- if (item->getParentUUID() != new_parent_id)
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
-
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
- new_item->setParent(new_parent_id);
- new_item->updateParentOnServer(restamp);
- model->updateItem(new_item);
- model->notifyObservers();
- }
+ change_item_parent(model, item, new_parent_id, restamp);
}
// static
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 8487588404..8010d1f43d 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -582,3 +582,26 @@ BOOL get_is_item_worn(const LLUUID& id)
}
return FALSE;
}
+
+
+void change_item_parent(LLInventoryModel* model,
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent_id,
+ BOOL restamp)
+{
+ if (item->getParentUUID() != new_parent_id)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(restamp);
+ model->updateItem(new_item);
+ model->notifyObservers();
+ }
+}
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index e3cd988e39..6f373f7392 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -310,6 +310,12 @@ LLUIImagePtr get_item_icon(LLAssetType::EType asset_type,
// Is this item or its baseitem is worn, attached, etc...
BOOL get_is_item_worn(const LLUUID& id);
+
+void change_item_parent(LLInventoryModel* model,
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent_id,
+ BOOL restamp);
+
#endif // LL_LLINVENTORYFUNCTIONS_H
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 75702dc8e5..fb7ac0d86b 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -35,6 +35,7 @@
#include "llpreviewnotecard.h"
#include "llinventory.h"
+#include "llinventoryfunctions.h" // for change_item_parent()
#include "llagent.h"
#include "llassetuploadresponders.h"
@@ -92,11 +93,17 @@ BOOL LLPreviewNotecard::postBuild()
childSetAction("Save", onClickSave, this);
childSetVisible("lock", FALSE);
+ childSetAction("Delete", onClickDelete, this);
+ childSetEnabled("Delete", false);
+
const LLInventoryItem* item = getItem();
childSetCommitCallback("desc", LLPreview::onText, this);
if (item)
+ {
childSetText("desc", item->getDescription());
+ childSetEnabled("Delete", true);
+ }
childSetPrevalidate("desc", &LLTextValidate::validateASCIIPrintableNoPipe);
return LLPreview::postBuild();
@@ -374,6 +381,17 @@ void LLPreviewNotecard::onClickSave(void* user_data)
}
}
+
+// static
+void LLPreviewNotecard::onClickDelete(void* user_data)
+{
+ LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
+ if(preview)
+ {
+ preview->deleteNotecard();
+ }
+}
+
struct LLSaveNotecardInfo
{
LLPreviewNotecard* mSelf;
@@ -466,6 +484,18 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
return true;
}
+void LLPreviewNotecard::deleteNotecard()
+{
+ LLViewerInventoryItem* item = gInventory.getItem(mItemUUID);
+ if (item != NULL)
+ {
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ change_item_parent(&gInventory, item, trash_id, FALSE);
+ }
+
+ closeFloater();
+}
+
// static
void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h
index e0363eef54..98de99aa33 100644
--- a/indra/newview/llpreviewnotecard.h
+++ b/indra/newview/llpreviewnotecard.h
@@ -83,6 +83,8 @@ protected:
virtual void loadAsset();
bool saveIfNeeded(LLInventoryItem* copyitem = NULL);
+ void deleteNotecard();
+
static void onLoadComplete(LLVFS *vfs,
const LLUUID& asset_uuid,
LLAssetType::EType type,
@@ -90,6 +92,8 @@ protected:
static void onClickSave(void* data);
+ static void onClickDelete(void* data);
+
static void onSaveComplete(const LLUUID& asset_uuid,
void* user_data,
S32 status, LLExtStat ext_status);
diff --git a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
index 14c0081c0d..0e8eef2a21 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
@@ -84,8 +84,18 @@
label="Save"
label_selected="Save"
layout="topleft"
- left="288"
+ left="178"
name="Save"
top="332"
width="100" />
+ <button
+ follows="right|bottom"
+ height="22"
+ label="Delete"
+ label_selected="Delete"
+ layout="topleft"
+ left="288"
+ name="Delete"
+ top="332"
+ width="100" />
</floater>