diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 57 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 57 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.h | 4 |
4 files changed, 119 insertions, 3 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index f9b25c1977..f9f0ed1b95 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -126,6 +126,31 @@ const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL("parcel"); const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION("region"); //========================================================================= + +class LLDaySettingCopiedCallback : public LLInventoryCallback +{ +public: + LLDaySettingCopiedCallback(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) + { + LLFloaterEditExtDayCycle* floater = (LLFloaterEditExtDayCycle*)mHandle.get(); + floater->onInventoryCreated(item->getAssetUUID(), inv_item_id); + } + } + } + +private: + LLHandle<LLFloater> mHandle; +}; + +//========================================================================= + LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : LLFloater(key), mFlyoutControl(nullptr), @@ -622,7 +647,32 @@ void LLFloaterEditExtDayCycle::onSaveAsCommit(const LLSD& notification, const LL { std::string settings_name = response["message"].asString(); LLStringUtil::trim(settings_name); - doApplyCreateNewInventory(day, settings_name); + if (mCanMod) + { + doApplyCreateNewInventory(day, 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 LLDaySettingCopiedCallback(getHandle()); + copy_inventory_item( + gAgent.getID(), + mInventoryItem->getPermissions().getOwner(), + mInventoryItem->getUUID(), + parent_id, + settings_name, + cb); + } + else + { + LL_WARNS() << "Failed to copy day setting" << LL_ENDL; + } } } @@ -1453,6 +1503,11 @@ void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID invent LLNotificationsUtil::add("CantCreateInventory"); return; } + onInventoryCreated(asset_id, inventory_id); +} + +void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id) +{ if (mInventoryItem) { diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index a9b5c8a3f0..1dea77571f 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -43,6 +43,7 @@ class LLTimeCtrl; class LLTabContainer; class LLInventoryItem; +class LLDaySettingCopiedCallback; typedef std::shared_ptr<LLSettingsBase> LLSettingsBasePtr_t; @@ -53,6 +54,8 @@ class LLFloaterEditExtDayCycle : public LLFloater { LOG_CLASS(LLFloaterEditExtDayCycle); + friend class LLDaySettingCopiedCallback; + public: static const std::string KEY_INVENTORY_ID; static const std::string KEY_EDIT_CONTEXT; @@ -146,6 +149,7 @@ private: void doApplyUpdateInventory(const LLSettingsDay::ptr_t &day); void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day); void doApplyCommit(LLSettingsDay::ptr_t day); + void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); 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(); diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index afab75b4ba..12fa64e733 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -38,6 +38,7 @@ class LLTabContainer; class LLButton; class LLLineEditor; class LLFloaterSettingsPicker; +class LLFixedSettingCopiedCallback; /** * Floater container for creating and editing fixed environment settings. @@ -46,6 +47,8 @@ class LLFloaterFixedEnvironment : public LLFloater { LOG_CLASS(LLFloaterFixedEnvironment); + friend class LLFixedSettingCopiedCallback; + public: static const std::string KEY_INVENTORY_ID; @@ -100,6 +103,7 @@ protected: bool mCanCopy; bool mCanMod; + void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); |