SL-9732 FIXED [EEP] Save As does not provide dialogue to supply new setting name

meow-7.2.2
maxim_productengine 2018-09-26 17:39:55 +03:00
parent cca55533f8
commit 405f5c879c
7 changed files with 72 additions and 17 deletions

View File

@ -517,7 +517,9 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
} }
else if (ctrl_action == ACTION_SAVEAS) 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) || else if ((ctrl_action == ACTION_APPLY_LOCAL) ||
(ctrl_action == ACTION_APPLY_PARCEL) || (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*/) void LLFloaterEditExtDayCycle::onClickCloseBtn(bool app_quitting /*= false*/)
{ {
@ -1232,19 +1244,19 @@ void LLFloaterEditExtDayCycle::reblendSettings()
mWaterBlender->setPosition(position); 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. // This method knows what sort of settings object to create.
LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); 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); }); [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
} }
void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day) void LLFloaterEditExtDayCycle::doApplyUpdateInventory(const LLSettingsDay::ptr_t &day)
{ {
if (mInventoryId.isNull()) 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); }); [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
else else
LLSettingsVOBase::updateInventoryItem(day, mInventoryId, LLSettingsVOBase::updateInventoryItem(day, mInventoryId,

View File

@ -108,6 +108,7 @@ private:
void onCommitName(class LLLineEditor* caller, void* user_data); void onCommitName(class LLLineEditor* caller, void* user_data);
void onTrackSelectionCallback(const LLSD& user_data); void onTrackSelectionCallback(const LLSD& user_data);
void onPlayActionCallback(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 // time slider clicked
void onTimeSliderCallback(); void onTimeSliderCallback();
// a frame moved or frame selection changed // a frame moved or frame selection changed
@ -137,7 +138,7 @@ private:
void doImportFromDisk(); void doImportFromDisk();
void loadSettingFromFile(const std::vector<std::string>& filenames); void loadSettingFromFile(const std::vector<std::string>& 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 doApplyUpdateInventory(const LLSettingsDay::ptr_t &day);
void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day); void doApplyEnvironment(const std::string &where, const LLSettingsDay::ptr_t &day);
void doApplyCommit(LLSettingsDay::ptr_t day); void doApplyCommit(LLSettingsDay::ptr_t day);

View File

@ -355,7 +355,9 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
} }
else if (ctrl_action == ACTION_SAVEAS) 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) || else if ((ctrl_action == ACTION_APPLY_LOCAL) ||
(ctrl_action == ACTION_APPLY_PARCEL) || (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) void LLFloaterFixedEnvironment::onClickCloseBtn(bool app_quitting)
{ {
if (!app_quitting) if (!app_quitting)
@ -382,11 +395,11 @@ void LLFloaterFixedEnvironment::onButtonLoad()
checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); }); checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); });
} }
void LLFloaterFixedEnvironment::doApplyCreateNewInventory() void LLFloaterFixedEnvironment::doApplyCreateNewInventory(std::string settings_name)
{ {
LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS);
// This method knows what sort of settings object to create. // 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); }); [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()) if (mInventoryId.isNull())
{ {
LL_WARNS("LAPRAS") << "Inventory ID is NULL. Creating New!!!" << LL_ENDL; 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); }); [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
} }
else else

View File

@ -83,7 +83,7 @@ protected:
LLSettingsBase::ptr_t mSettings; LLSettingsBase::ptr_t mSettings;
virtual void doImportFromDisk() = 0; virtual void doImportFromDisk() = 0;
virtual void doApplyCreateNewInventory(); virtual void doApplyCreateNewInventory(std::string settings_name);
virtual void doApplyUpdateInventory(); virtual void doApplyUpdateInventory();
virtual void doApplyEnvironment(const std::string &where); virtual void doApplyEnvironment(const std::string &where);
void doCloseInventoryFloater(bool quitting = false); void doCloseInventoryFloater(bool quitting = false);
@ -111,6 +111,7 @@ protected:
void onPanelDirtyFlagChanged(bool); void onPanelDirtyFlagChanged(bool);
virtual void onClickCloseBtn(bool app_quitting = false) override; virtual void onClickCloseBtn(bool app_quitting = false) override;
void onSaveAsCommit(const LLSD& notification, const LLSD& response);
private: private:
void onNameChanged(const std::string &name); void onNameChanged(const std::string &name);

View File

@ -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; LLTransactionID tid;
U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner(); U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner();
@ -137,9 +137,13 @@ void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings
LLSettingsVOBase::onInventoryItemCreated(inventoryId, settings, callback); LLSettingsVOBase::onInventoryItemCreated(inventoryId, settings, callback);
}); });
if (settings_name.empty())
{
settings_name = settings->getName();
}
create_inventory_settings(gAgent.getID(), gAgent.getSessionID(), create_inventory_settings(gAgent.getID(), gAgent.getSessionID(),
parent_id, tid, parent_id, tid,
settings->getName(), "new settings collection.", settings_name, "new settings collection.",
settings->getSettingsTypeValue(), nextOwnerPerm, cb); settings->getSettingsTypeValue(), nextOwnerPerm, cb);
} }
@ -160,10 +164,10 @@ void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSetti
return; return;
} }
// We need to update some inventory stuff here.... maybe. // 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(); const LLViewerRegion* region = gAgent.getRegion();
if (!region) if (!region)
@ -195,7 +199,7 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings
new_item->setPermissions(perm); new_item->setPermissions(perm);
need_update |= true; need_update |= true;
} }
if (settings->getName() != new_item->getName()) if (update_name && (settings->getName() != new_item->getName()))
{ {
new_item->rename(settings->getName()); new_item->rename(settings->getName());
settings->setName(new_item->getName()); // account for corrections settings->setName(new_item->getName()); // account for corrections

View File

@ -50,9 +50,9 @@ public:
typedef std::function<void(LLUUID asset_id, LLUUID inventory_id, LLUUID object_id, LLSD results)> inventory_result_fn; typedef std::function<void(LLUUID asset_id, LLUUID inventory_id, LLUUID object_id, LLSD results)> inventory_result_fn;
static void createNewInventoryItem(LLSettingsType::type_e stype, const LLUUID &parent_id, inventory_result_fn callback = 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 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); static void getSettingsAsset(const LLUUID &assetId, asset_download_fn callback);

View File

@ -11155,6 +11155,30 @@ This Region does not support environmental settings.
<tag>fail</tag> <tag>fail</tag>
</notification> </notification>
<notification
icon="alertmodal.tga"
label="Save Outfit"
name="SaveSettingAs"
type="alertmodal">
<unique/>
Save current environmental settings as:
<tag>confirm</tag>
<form name="form">
<input name="message" type="text">
[DESC] (new)
</input>
<button
default="true"
index="0"
name="OK"
text="OK"/>
<button
index="1"
name="Cancel"
text="Cancel"/>
</form>
</notification>
<notification <notification
icon="notify.tga" icon="notify.tga"
name="WLImportFail" name="WLImportFail"