summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2017-04-19 16:27:38 -0400
committerOz Linden <oz@lindenlab.com>2017-04-19 16:27:38 -0400
commit1b032c37833be3a03170a28b1955c55061936442 (patch)
treef4500e347b6f18eeafe61217c4a9f884a8ebea34 /indra/newview/llinventorybridge.cpp
parente07a60f6cc80d052377996b8c3ef9a9a20e20584 (diff)
parentf62b5503285d828813d87779fa0658ee5f122ac5 (diff)
merge changes for 5.0.4-release
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp140
1 files changed, 107 insertions, 33 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index b7f5424f25..555c19baac 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -275,8 +275,10 @@ BOOL LLInvFVBridge::cutToClipboard()
if (cut_from_marketplacelistings && (LLMarketplaceData::instance().isInActiveFolder(mUUID) ||
LLMarketplaceData::instance().isListedAndActive(mUUID)))
{
- // Prompt the user if cutting from a marketplace active listing
- LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInvFVBridge::callback_cutToClipboard, this, _1, _2));
+ LLUUID parent_uuid = obj->getParentUUID();
+ BOOL result = perform_cutToClipboard();
+ gInventory.addChangedMask(LLInventoryObserver::STRUCTURE, parent_uuid);
+ return result;
}
else
{
@@ -303,11 +305,7 @@ BOOL LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
- const LLInventoryObject* obj = gInventory.getObject(mUUID);
- LLUUID parent_uuid = obj->getParentUUID();
- BOOL result = perform_cutToClipboard();
- gInventory.addChangedMask(LLInventoryObserver::STRUCTURE, parent_uuid);
- return result;
+ return perform_cutToClipboard();
}
return FALSE;
}
@@ -3471,7 +3469,24 @@ void LLFolderBridge::pasteFromClipboard()
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
const BOOL paste_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
- if (paste_into_marketplacelistings && !LLMarketplaceData::instance().isListed(mUUID) && LLMarketplaceData::instance().isInActiveFolder(mUUID))
+ BOOL cut_from_marketplacelistings = FALSE;
+ if (LLClipboard::instance().isCutMode())
+ {
+ //Items are not removed from folder on "cut", so we need update listing folder on "paste" operation
+ std::vector<LLUUID> objects;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter)
+ {
+ const LLUUID& item_id = (*iter);
+ if(gInventory.isObjectDescendentOf(item_id, marketplacelistings_id) && (LLMarketplaceData::instance().isInActiveFolder(item_id) ||
+ LLMarketplaceData::instance().isListedAndActive(item_id)))
+ {
+ cut_from_marketplacelistings = TRUE;
+ break;
+ }
+ }
+ }
+ if (cut_from_marketplacelistings || (paste_into_marketplacelistings && !LLMarketplaceData::instance().isListed(mUUID) && LLMarketplaceData::instance().isInActiveFolder(mUUID)))
{
// Prompt the user if pasting in a marketplace active version listing (note that pasting right under the listing folder root doesn't need a prompt)
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_pasteFromClipboard, this, _1, _2));
@@ -3490,7 +3505,20 @@ void LLFolderBridge::callback_pasteFromClipboard(const LLSD& notification, const
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
+ std::vector<LLUUID> objects;
+ std::set<LLUUID> parent_folders;
+ LLClipboard::instance().pasteFromClipboard(objects);
+ for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter)
+ {
+ const LLInventoryObject* obj = gInventory.getObject(*iter);
+ parent_folders.insert(obj->getParentUUID());
+ }
perform_pasteFromClipboard();
+ for (std::set<LLUUID>::const_iterator iter = parent_folders.begin(); iter != parent_folders.end(); ++iter)
+ {
+ gInventory.addChangedMask(LLInventoryObserver::STRUCTURE, *iter);
+ }
+
}
}
@@ -3913,6 +3941,37 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
mWearables=TRUE;
}
}
+ else
+ {
+ // Mark wearables and allow copy from library
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ const LLInventoryCategory* category = model->getCategory(mUUID);
+ if (!category) return;
+ LLFolderType::EType type = category->getPreferredType();
+ const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
+
+ LLFindWearables is_wearable;
+ LLIsType is_object(LLAssetType::AT_OBJECT);
+ LLIsType is_gesture(LLAssetType::AT_GESTURE);
+
+ if (checkFolderForContentsOfType(model, is_wearable) ||
+ checkFolderForContentsOfType(model, is_object) ||
+ checkFolderForContentsOfType(model, is_gesture))
+ {
+ mWearables = TRUE;
+ }
+
+ if (!is_system_folder)
+ {
+ items.push_back(std::string("Copy"));
+ if (!isItemCopyable())
+ {
+ // For some reason there are items in library that can't be copied directly
+ disabled_items.push_back(std::string("Copy"));
+ }
+ }
+ }
// Preemptively disable system folder removal if more than one item selected.
if ((flags & FIRST_SELECTED_ITEM) == 0)
@@ -3920,7 +3979,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("Delete System Folder"));
}
- if (!isMarketplaceListingsFolder())
+ if (isAgentInventory() && !isMarketplaceListingsFolder())
{
items.push_back(std::string("Share"));
if (!canShare())
@@ -3928,6 +3987,9 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("Share"));
}
}
+
+
+
// Add menu items that are dependent on the contents of the folder.
LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID);
if (category && (marketplace_listings_id != mUUID))
@@ -3965,7 +4027,6 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
if (trash_id == mUUID) return;
if (isItemInTrash()) return;
- if (!isAgentInventory()) return;
if (!isItemRemovable())
{
@@ -3978,9 +4039,10 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
// BAP change once we're no longer treating regular categories as ensembles.
const bool is_ensemble = (type == LLFolderType::FT_NONE ||
LLFolderType::lookupIsEnsembleType(type));
+ const bool is_agent_inventory = isAgentInventory();
// Only enable calling-card related options for non-system folders.
- if (!is_system_folder)
+ if (!is_system_folder && is_agent_inventory)
{
LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
@@ -3992,7 +4054,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
}
#ifndef LL_RELEASE_FOR_DOWNLOAD
- if (LLFolderType::lookupIsProtectedType(type))
+ if (LLFolderType::lookupIsProtectedType(type) && is_agent_inventory)
{
items.push_back(std::string("Delete System Folder"));
}
@@ -4009,8 +4071,6 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
checkFolderForContentsOfType(model, is_object) ||
checkFolderForContentsOfType(model, is_gesture) )
{
- items.push_back(std::string("Folder Wearables Separator"));
-
// Only enable add/replace outfit for non-system folders.
if (!is_system_folder)
{
@@ -4021,25 +4081,30 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
}
items.push_back(std::string("Replace Outfit"));
+
+ if (is_agent_inventory)
+ {
+ items.push_back(std::string("Folder Wearables Separator"));
+ if (is_ensemble)
+ {
+ items.push_back(std::string("Wear As Ensemble"));
+ }
+ items.push_back(std::string("Remove From Outfit"));
+ if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
+ {
+ disabled_items.push_back(std::string("Remove From Outfit"));
+ }
+ }
+ if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))
+ {
+ disabled_items.push_back(std::string("Replace Outfit"));
+ }
+ if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID))
+ {
+ disabled_items.push_back(std::string("Add To Outfit"));
+ }
+ items.push_back(std::string("Outfit Separator"));
}
- if (is_ensemble)
- {
- items.push_back(std::string("Wear As Ensemble"));
- }
- items.push_back(std::string("Remove From Outfit"));
- if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
- {
- disabled_items.push_back(std::string("Remove From Outfit"));
- }
- if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID))
- {
- disabled_items.push_back(std::string("Replace Outfit"));
- }
- if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID))
- {
- disabled_items.push_back(std::string("Add To Outfit"));
- }
- items.push_back(std::string("Outfit Separator"));
}
}
@@ -4276,9 +4341,18 @@ void LLFolderBridge::modifyOutfit(BOOL append)
return;
}
- LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append );
+ if (isAgentInventory())
+ {
+ LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append);
+ }
+ else
+ {
+ // Library, we need to copy content first
+ LLAppearanceMgr::instance().wearInventoryCategory(cat, TRUE, append);
+ }
}
+
// +=================================================+
// | LLMarketplaceFolderBridge |
// +=================================================+