summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterfixedenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterfixedenvironment.cpp')
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp57
1 files changed, 55 insertions, 2 deletions
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index b9e23fb245..712c7cf31a 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -86,6 +86,30 @@ const std::string LLFloaterFixedEnvironment::KEY_INVENTORY_ID("inventory_id");
//=========================================================================
+
+class LLFixedSettingCopiedCallback : public LLInventoryCallback
+{
+public:
+ LLFixedSettingCopiedCallback(LLHandle<LLFloater> handle) : mHandle(handle) {}
+
+ virtual void fire(const LLUUID& inv_item_id)
+ {
+ if (!mHandle.isDead())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item_id);
+ if (item)
+ {
+ LLFloaterFixedEnvironment* floater = (LLFloaterFixedEnvironment*)mHandle.get();
+ floater->onInventoryCreated(item->getAssetUUID(), inv_item_id);
+ }
+ }
+ }
+
+private:
+ LLHandle<LLFloater> mHandle;
+};
+
+//=========================================================================
LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) :
LLFloater(key),
mFlyoutControl(nullptr),
@@ -429,7 +453,32 @@ void LLFloaterFixedEnvironment::onSaveAsCommit(const LLSD& notification, const L
{
std::string settings_name = response["message"].asString();
LLStringUtil::trim(settings_name);
- doApplyCreateNewInventory(settings_name);
+ if (mCanMod)
+ {
+ doApplyCreateNewInventory(settings_name);
+ }
+ else if (mInventoryItem)
+ {
+ const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
+ LLUUID parent_id = mInventoryItem->getParentUUID();
+ if (marketplacelistings_id == parent_id)
+ {
+ parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS);
+ }
+
+ LLPointer<LLInventoryCallback> cb = new LLFixedSettingCopiedCallback(getHandle());
+ copy_inventory_item(
+ gAgent.getID(),
+ mInventoryItem->getPermissions().getOwner(),
+ mInventoryItem->getUUID(),
+ parent_id,
+ settings_name,
+ cb);
+ }
+ else
+ {
+ LL_WARNS() << "Failed to copy fixed env setting" << LL_ENDL;
+ }
}
}
@@ -547,13 +596,17 @@ void LLFloaterFixedEnvironment::doCloseInventoryFloater(bool quitting)
void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results)
{
LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL;
-
+
if (inventory_id.isNull() || !results["success"].asBoolean())
{
LLNotificationsUtil::add("CantCreateInventory");
return;
}
+ onInventoryCreated(asset_id, inventory_id);
+}
+void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id)
+{
if (mInventoryItem)
{
LLPermissions perms = mInventoryItem->getPermissions();