diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-10-09 23:20:41 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-10-10 11:21:05 +0300 |
commit | d5218c05219a6bddb63d752a9df3b5d6fe1e3cf7 (patch) | |
tree | e1a7b69c31f5493f1fd2fac0854645fd456692ba /indra | |
parent | a9dfb9d918fe12851ef93110baa149e1c49d2efa (diff) |
viewer#2818 Creating a link to an empty notecard fails #3
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llinventorygallerymenu.cpp | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 16 |
4 files changed, 66 insertions, 13 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 114fdf1d9f..2deb7caad5 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -691,13 +691,6 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const { return false; } - if (item->getAssetUUID().isNull() - && (item->getActualType() == LLAssetType::AT_NOTECARD - || item->getActualType() == LLAssetType::AT_MATERIAL)) - { - // otehrwise AIS will return 'Cannot link to items with a NULL asset_id.' - return false; - } } const LLViewerInventoryCategory *cat = model->getCategory(item_id); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) @@ -4196,6 +4189,32 @@ void LLFolderBridge::pasteLinkFromClipboard() std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); + if (objects.size() == 0) + { + LLClipboard::instance().setCutMode(false); + return; + } + + LLUUID& first_id = objects[0]; + LLInventoryItem* item = model->getItem(first_id); + if (item && item->getAssetUUID().isNull()) + { + if (item->getActualType() == LLAssetType::AT_NOTECARD) + { + // otehrwise AIS will return 'Cannot link to items with a NULL asset_id.' + LLNotificationsUtil::add("CantLinkNotecard"); + LLClipboard::instance().setCutMode(false); + return; + } + else if (item->getActualType() == LLAssetType::AT_MATERIAL) + { + LLNotificationsUtil::add("CantLinkMaterial"); + LLClipboard::instance().setCutMode(false); + return; + } + } + + LLPointer<LLInventoryCallback> cb = NULL; LLInventoryPanel* panel = mInventoryPanel.get(); if (panel->getRootFolder()->isSingleFolderMode()) diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index c4f93cee98..03bafa48bd 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -2105,6 +2105,30 @@ void LLInventoryGallery::pasteAsLink() std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); + if (objects.size() == 0) + { + LLClipboard::instance().setCutMode(false); + return; + } + + LLUUID& first_id = objects[0]; + LLInventoryItem* item = gInventory.getItem(first_id); + if (item && item->getAssetUUID().isNull()) + { + if (item->getActualType() == LLAssetType::AT_NOTECARD) + { + LLNotificationsUtil::add("CantLinkNotecard"); + LLClipboard::instance().setCutMode(false); + return; + } + else if (item->getActualType() == LLAssetType::AT_MATERIAL) + { + LLNotificationsUtil::add("CantLinkMaterial"); + LLClipboard::instance().setCutMode(false); + return; + } + } + bool paste_into_root = mSelectedItemIDs.empty(); for (LLUUID& dest : mSelectedItemIDs) { diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 2b2b1d7005..340ecfcbbc 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -772,12 +772,6 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men { disabled_items.push_back(std::string("Paste As Link")); } - else if (selected_item->getAssetUUID().isNull() - && (selected_item->getActualType() == LLAssetType::AT_NOTECARD - || selected_item->getActualType() == LLAssetType::AT_MATERIAL)) - { - disabled_items.push_back(std::string("Paste As Link")); - } } else if (selected_category && LLFolderType::lookupIsProtectedType(selected_category->getPreferredType())) { diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 071f6458c5..bc817765cf 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6532,6 +6532,22 @@ Do you want to replace it with the selected object? </notification> <notification + icon="alertmodal.tga" + name="CantLinkNotecard" + type="alertmodal"> + You must save the notecard before creating a link to it. + <tag>fail</tag> + </notification> + + <notification + icon="alertmodal.tga" + name="CantLinkMaterial" + type="alertmodal"> + You must save the material before creating a link to it. + <tag>fail</tag> + </notification> + + <notification icon="alert.tga" label="Do Not Disturb Mode Warning" name="DoNotDisturbModePay" |