From 405f5c879c44f32635dcb94de2c7dfb9e4a8673a Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 26 Sep 2018 17:39:55 +0300 Subject: SL-9732 FIXED [EEP] Save As does not provide dialogue to supply new setting name --- indra/newview/llfloatereditextdaycycle.cpp | 20 ++++++++++++++---- indra/newview/llfloatereditextdaycycle.h | 3 ++- indra/newview/llfloaterfixedenvironment.cpp | 21 +++++++++++++++---- indra/newview/llfloaterfixedenvironment.h | 3 ++- indra/newview/llsettingsvo.cpp | 14 ++++++++----- indra/newview/llsettingsvo.h | 4 ++-- .../newview/skins/default/xui/en/notifications.xml | 24 ++++++++++++++++++++++ 7 files changed, 72 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 96af840bba..fac0ddc27b 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -517,7 +517,9 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } else if (ctrl_action == ACTION_SAVEAS) { - doApplyCreateNewInventory(dayclone); + LLSD args; + args["DESC"] = dayclone->getName(); + LLNotificationsUtil::add("SaveSettingAs", args, LLSD(), boost::bind(&LLFloaterEditExtDayCycle::onSaveAsCommit, this, _1, _2, dayclone)); } else if ((ctrl_action == ACTION_APPLY_LOCAL) || (ctrl_action == ACTION_APPLY_PARCEL) || @@ -535,6 +537,16 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } } +void LLFloaterEditExtDayCycle::onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + std::string settings_name = response["message"].asString(); + LLStringUtil::trim(settings_name); + doApplyCreateNewInventory(day, settings_name); + } +} void LLFloaterEditExtDayCycle::onClickCloseBtn(bool app_quitting /*= false*/) { @@ -1232,19 +1244,19 @@ void LLFloaterEditExtDayCycle::reblendSettings() mWaterBlender->setPosition(position); } -void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day) +void LLFloaterEditExtDayCycle::doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name) { // This method knows what sort of settings object to create. LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); - LLSettingsVOBase::createInventoryItem(day, parent_id, + LLSettingsVOBase::createInventoryItem(day, parent_id, settings_name, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day) { if (mInventoryId.isNull()) - LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), + LLSettingsVOBase::createInventoryItem(day, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); else LLSettingsVOBase::updateInventoryItem(day, mInventoryId, diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 0ab47fc1e5..1e40a9dc6e 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -108,6 +108,7 @@ private: void onCommitName(class LLLineEditor* caller, void* user_data); void onTrackSelectionCallback(const LLSD& user_data); void onPlayActionCallback(const LLSD& user_data); + void onSaveAsCommit(const LLSD& notification, const LLSD& response, const LLSettingsDay::ptr_t &day); // time slider clicked void onTimeSliderCallback(); // a frame moved or frame selection changed @@ -137,7 +138,7 @@ private: void doImportFromDisk(); void loadSettingFromFile(const std::vector& filenames); - void doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day); + void doApplyCreateNewInventory(const LLSettingsDay::ptr_t &day, std::string settings_name); void doApplyUpdateInventory(const LLSettingsDay::ptr_t &day); void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day); void doApplyCommit(LLSettingsDay::ptr_t day); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 2eda405f51..b9ea044a06 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -355,7 +355,9 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } else if (ctrl_action == ACTION_SAVEAS) { - doApplyCreateNewInventory(); + LLSD args; + args["DESC"] = mSettings->getName(); + LLNotificationsUtil::add("SaveSettingAs", args, LLSD(), boost::bind(&LLFloaterFixedEnvironment::onSaveAsCommit, this, _1, _2)); } else if ((ctrl_action == ACTION_APPLY_LOCAL) || (ctrl_action == ACTION_APPLY_PARCEL) || @@ -369,6 +371,17 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) } } +void LLFloaterFixedEnvironment::onSaveAsCommit(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + std::string settings_name = response["message"].asString(); + LLStringUtil::trim(settings_name); + doApplyCreateNewInventory(settings_name); + } +} + void LLFloaterFixedEnvironment::onClickCloseBtn(bool app_quitting) { if (!app_quitting) @@ -382,11 +395,11 @@ void LLFloaterFixedEnvironment::onButtonLoad() checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); }); } -void LLFloaterFixedEnvironment::doApplyCreateNewInventory() +void LLFloaterFixedEnvironment::doApplyCreateNewInventory(std::string settings_name) { LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); // This method knows what sort of settings object to create. - LLSettingsVOBase::createInventoryItem(mSettings, parent_id, + LLSettingsVOBase::createInventoryItem(mSettings, parent_id, settings_name, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } @@ -396,7 +409,7 @@ void LLFloaterFixedEnvironment::doApplyUpdateInventory() if (mInventoryId.isNull()) { LL_WARNS("LAPRAS") << "Inventory ID is NULL. Creating New!!!" << LL_ENDL; - LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), + LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), std::string(), [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } else diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 3181d4cbda..d235491fd9 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -83,7 +83,7 @@ protected: LLSettingsBase::ptr_t mSettings; virtual void doImportFromDisk() = 0; - virtual void doApplyCreateNewInventory(); + virtual void doApplyCreateNewInventory(std::string settings_name); virtual void doApplyUpdateInventory(); virtual void doApplyEnvironment(const std::string &where); void doCloseInventoryFloater(bool quitting = false); @@ -111,6 +111,7 @@ protected: void onPanelDirtyFlagChanged(bool); virtual void onClickCloseBtn(bool app_quitting = false) override; + void onSaveAsCommit(const LLSD& notification, const LLSD& response); private: void onNameChanged(const std::string &name); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 4073639a20..26b0bcb5a3 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -119,7 +119,7 @@ void LLSettingsVOBase::createNewInventoryItem(LLSettingsType::type_e stype, cons } -void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, inventory_result_fn callback) +void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, std::string settings_name, inventory_result_fn callback) { LLTransactionID tid; U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner(); @@ -137,9 +137,13 @@ void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings LLSettingsVOBase::onInventoryItemCreated(inventoryId, settings, callback); }); + if (settings_name.empty()) + { + settings_name = settings->getName(); + } create_inventory_settings(gAgent.getID(), gAgent.getSessionID(), parent_id, tid, - settings->getName(), "new settings collection.", + settings_name, "new settings collection.", settings->getSettingsTypeValue(), nextOwnerPerm, cb); } @@ -160,10 +164,10 @@ void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSetti return; } // We need to update some inventory stuff here.... maybe. - updateInventoryItem(settings, inventoryId, callback); + updateInventoryItem(settings, inventoryId, callback, false); } -void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback) +void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback, bool update_name) { const LLViewerRegion* region = gAgent.getRegion(); if (!region) @@ -195,7 +199,7 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings new_item->setPermissions(perm); need_update |= true; } - if (settings->getName() != new_item->getName()) + if (update_name && (settings->getName() != new_item->getName())) { new_item->rename(settings->getName()); settings->setName(new_item->getName()); // account for corrections diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 0d7b7902c1..0e8312b849 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -50,9 +50,9 @@ public: typedef std::function inventory_result_fn; static void createNewInventoryItem(LLSettingsType::type_e stype, const LLUUID &parent_id, inventory_result_fn callback = inventory_result_fn()); - static void createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, inventory_result_fn callback = inventory_result_fn()); + static void createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, std::string settings_name, inventory_result_fn callback = inventory_result_fn()); - static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn()); + static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn(), bool update_name = true); static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID object_id, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn()); static void getSettingsAsset(const LLUUID &assetId, asset_download_fn callback); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4813ae3468..d0dafdbc8d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -11154,6 +11154,30 @@ Unable to apply those settings to the environment. This Region does not support environmental settings. fail + + + + Save current environmental settings as: + confirm +
+ + [DESC] (new) + +