summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewnotecard.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2021-11-16 01:09:11 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2021-11-16 01:09:11 +0200
commit30c381406c4891cce439c66ca17b26247f0a698c (patch)
tree2196833344c813e2d6bf4b963adc517c30050697 /indra/newview/llpreviewnotecard.cpp
parent764788c9bc549715aed119c639ac919067f38a92 (diff)
parent9957c28ddc5e5c129af2db662da7d69f1509af65 (diff)
Merge branch 'master' into DRTVWR-530-maint
# Conflicts: # doc/contributions.txt
Diffstat (limited to 'indra/newview/llpreviewnotecard.cpp')
-rw-r--r--indra/newview/llpreviewnotecard.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 1b60610668..59be35fe92 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -232,6 +232,7 @@ void LLPreviewNotecard::loadAsset()
if (!editor)
return;
+ bool fail = false;
if(item)
{
@@ -315,7 +316,31 @@ void LLPreviewNotecard::loadAsset()
getChildView("Delete")->setEnabled(TRUE);
}
}
- else
+ else if (mObjectUUID.notNull() && mItemUUID.notNull())
+ {
+ LLViewerObject* objectp = gObjectList.findObject(mObjectUUID);
+ if (objectp && (objectp->isInventoryPending() || objectp->isInventoryDirty()))
+ {
+ // It's a notecard in object's inventory and we failed to get it because inventory is not up to date.
+ // Subscribe for callback and retry at inventoryChanged()
+ registerVOInventoryListener(objectp, NULL); //removes previous listener
+
+ if (objectp->isInventoryDirty())
+ {
+ objectp->requestInventory();
+ }
+ }
+ else
+ {
+ fail = true;
+ }
+ }
+ else
+ {
+ fail = true;
+ }
+
+ if (fail)
{
editor->setText(LLStringUtil::null);
editor->makePristine();
@@ -600,6 +625,17 @@ void LLPreviewNotecard::syncExternal()
}
}
+/*virtual*/
+void LLPreviewNotecard::inventoryChanged(LLViewerObject* object,
+ LLInventoryObject::object_list_t* inventory,
+ S32 serial_num,
+ void* user_data)
+{
+ removeVOInventoryListener();
+ loadAsset();
+}
+
+
void LLPreviewNotecard::deleteNotecard()
{
LLNotificationsUtil::add("DeleteNotecard", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleConfirmDeleteDialog,this, _1, _2));