From 114e358aae80e9e3ca70de093d51e4700c46df37 Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Fri, 7 Sep 2018 16:09:32 -0700
Subject: Work to make edit floaters respect no mod and no trans.  Importing
 no-trans frame will cause day cycle to become no trans.

---
 indra/llinventory/llsettingsbase.cpp               |   1 +
 indra/llinventory/llsettingsbase.h                 |   1 +
 indra/newview/llfloatereditextdaycycle.cpp         | 140 +++++++++++++--------
 indra/newview/llfloatereditextdaycycle.h           |   5 +-
 indra/newview/llfloaterfixedenvironment.cpp        |  60 +++++++--
 indra/newview/llfloaterfixedenvironment.h          |   5 +
 indra/newview/llsettingsvo.cpp                     |  39 +++++-
 indra/newview/llsettingsvo.h                       |   3 +
 .../default/xui/en/floater_fixedenvironment.xml    |   2 +
 .../newview/skins/default/xui/en/notifications.xml |  17 +++
 10 files changed, 211 insertions(+), 62 deletions(-)

(limited to 'indra')

diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index 5283a8dc8a..2adbb213e6 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -58,6 +58,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags");
 
 const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0);
 const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1);
+const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2);
 
 //=========================================================================
 LLSettingsBase::LLSettingsBase():
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index a90cec6323..aea1bc3fde 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -74,6 +74,7 @@ public:
 
     static const U32 FLAG_NOCOPY;
     static const U32 FLAG_NOMOD;
+    static const U32 FLAG_NOTRANS;
 
     typedef std::map<std::string, S32>  parammapping_t;
 
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 01c1bf3d1a..f1dbb32016 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -138,7 +138,10 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :
     mScratchSky(),
     mScratchWater(),
     mIsPlaying(false),
-    mIsDirty(false)
+    mIsDirty(false),
+    mCanCopy(false),
+    mCanMod(false),
+    mMakeNoTrans(false)
 {
 
     mCommitCallbackRegistrar.add(EVNT_DAYTRACK, [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); });
@@ -365,8 +368,10 @@ void LLFloaterEditExtDayCycle::refresh()
     {
         LLLineEditor* name_field = getChild<LLLineEditor>(TXT_DAY_NAME);
         name_field->setText(mEditDay->getName());
+        name_field->setEnabled(mCanMod);
     }
 
+
     bool is_inventory_avail = canUseInventory();
 
     bool show_commit = ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION));
@@ -380,12 +385,15 @@ void LLFloaterEditExtDayCycle::refresh()
     mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply);
 
     mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit && !mCommitSignal.empty());
-    mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail);
-    mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail);
+    mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && !mInventoryId.isNull());
+    mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail && mCanCopy);
     mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true);
     mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel() && show_apply);
     mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion() && show_apply);
 
+    mImportButton->setEnabled(mCanMod);
+    mLoadFrame->setEnabled(mCanMod);
+
     LLFloater::refresh();
 }
 
@@ -597,7 +605,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data)
         keymap_t::iterator it = mSliderKeyMap.find(curslider);
         if (it != mSliderKeyMap.end())
         {
-            if (gKeyboard->currentMask(TRUE) == MASK_SHIFT && mShiftCopyEnabled)
+            if (gKeyboard->currentMask(TRUE) == MASK_SHIFT && mShiftCopyEnabled && mCanMod)
             {
                 // don't move the point/frame as long as shift is pressed and user is attempting to copy
                 // handleKeyUp will do the move if user releases key too early.
@@ -631,7 +639,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data)
             }
             else
             {
-                if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos))
+                if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos) && mCanMod)
                 {
                     (*it).second.mFrame = sliderpos;
                 }
@@ -701,7 +709,7 @@ void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb)
 
         // create and show confirmation textbox
         LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(),
-            [this, cb](const LLSD&notif, const LLSD&resp)
+            [cb](const LLSD&notif, const LLSD&resp)
             {
                 S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
                 if (opt == 0)
@@ -823,42 +831,6 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky)
     }
 }
 
-void LLFloaterEditExtDayCycle::setWaterTabsEnabled(BOOL enable)
-{
-    LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>(TABS_WATER); //can't extract panels directly, since it is in 'tuple'
-    LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel"));
-    if (panel)
-    {
-        panel->setEnabled(enable);
-        panel->setAllChildrenEnabled(enable);
-    }
-}
-
-void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable)
-{
-    LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple'
-
-    LLPanelSettingsSky* panel;
-    panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel"));
-    if (panel)
-    {
-        panel->setEnabled(enable);
-        panel->setAllChildrenEnabled(enable);
-    }
-    panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("clouds_panel"));
-    if (panel)
-    {
-        panel->setEnabled(enable);
-        panel->setAllChildrenEnabled(enable);
-    }
-    panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("moon_panel"));
-    if (panel)
-    {
-        panel->setEnabled(enable);
-        panel->setAllChildrenEnabled(enable);
-    }
-}
-
 void LLFloaterEditExtDayCycle::updateButtons()
 {
     // This logic appears to work in reverse, the add frame button
@@ -869,8 +841,8 @@ void LLFloaterEditExtDayCycle::updateButtons()
     //bool can_add = static_cast<bool>(settings);
     //mAddFrameButton->setEnabled(can_add);
     //mDeleteFrameButton->setEnabled(!can_add);
-    mAddFrameButton->setEnabled(true);
-    mDeleteFrameButton->setEnabled(true);
+    mAddFrameButton->setEnabled(true && mCanMod);
+    mDeleteFrameButton->setEnabled(true && mCanMod);
 }
 
 void LLFloaterEditExtDayCycle::updateSlider()
@@ -973,9 +945,11 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID  &inventoryId)
 {
     if (inventoryId.isNull())
     {
-        LL_WARNS("ENVDAYEDIT") << "Attempt to load NULL inventory ID" << LL_ENDL;
         mInventoryItem = nullptr;
         mInventoryId.setNull();
+        mCanCopy = true;
+        mCanMod = true;
+        mMakeNoTrans = false;
         return;
     }
 
@@ -1006,6 +980,9 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID  &inventoryId)
         return;
     }
 
+    mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID());
+    mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID());
+
     LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(),
         [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });
 }
@@ -1021,6 +998,16 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt
         return;
     }
 
+    if (mCanCopy)
+        settings->clearFlag(LLSettingsBase::FLAG_NOCOPY);
+    else
+        settings->setFlag(LLSettingsBase::FLAG_NOCOPY);
+
+    if (mCanMod)
+        settings->clearFlag(LLSettingsBase::FLAG_NOMOD);
+    else
+        settings->setFlag(LLSettingsBase::FLAG_NOMOD);
+
     setEditDayCycle(std::dynamic_pointer_cast<LLSettingsDay>(settings));
 }
 
@@ -1124,8 +1111,7 @@ void LLFloaterEditExtDayCycle::setTabsData(LLTabContainer * tabcontainer, const
         if (panel)
         {
             panel->setSettings(settings);
-            panel->setEnabled(editable);
-            panel->setAllChildrenEnabled(editable);
+            panel->setCanChangeSettings(editable & mCanMod);
         }
     }
 }
@@ -1222,6 +1208,19 @@ void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID invent
         return;
     }
 
+    if (mInventoryItem)
+    {
+        LLPermissions perms = mInventoryItem->getPermissions();
+
+        LLInventoryItem *created_item = gInventory.getItem(mInventoryId);
+        
+        if (created_item)
+        {
+            created_item->setPermissions(perms);
+            created_item->updateServer(false);
+        }
+    }
+
     clearDirtyFlag();
     setFocus(TRUE);                 // Call back the focus...
     loadInventoryItem(inventory_id);
@@ -1256,6 +1255,8 @@ void LLFloaterEditExtDayCycle::doImportFromDisk()
             return;
         }
 
+        loadInventoryItem(LLUUID::null);
+
         mCurrentTrack = 1;
         setDirtyFlag();
         setEditDayCycle(legacyday);
@@ -1404,13 +1405,52 @@ void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID asset_id)
 
 void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame)
 {
+    std::function<void()> cb = [this, settings, frame, track]()
+    {
+        mEditDay->setSettingsAtKeyframe(settings, frame, track);
+        reblendSettings();
+        synchronizeTabs();
+    };
+
     if (!settings || status)
     {
         LL_WARNS("ENVDAYEDIT") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL;
         return;
     }
 
-    mEditDay->setSettingsAtKeyframe(settings, frame, track);
-    reblendSettings();
-    synchronizeTabs();
+    LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get());
+    LLInventoryItem *inv_item(nullptr);
+
+    if (picker)
+    {
+        inv_item = picker->findItem(asset_id, false, false);
+    }
+
+    if (inv_item)
+    {
+        if (mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+        {
+            if (!inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+            {
+                LLSD args;
+
+                // create and show confirmation textbox
+                LLNotificationsUtil::add("SettingsMakeNoTrans", args, LLSD(),
+                    [this, cb](const LLSD&notif, const LLSD&resp)
+                    {
+                        S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
+                        if (opt == 0)
+                        {
+                            mMakeNoTrans = true;
+                            mEditDay->setFlag(LLSettingsBase::FLAG_NOTRANS);
+                            cb();
+                        }
+                    });
+                return;
+            }
+        }
+
+    }
+    
+    cb();
 }
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index ba269dd538..c64ed3ff5a 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -125,8 +125,6 @@ private:
 	void                        updateTabs();
 	void                        updateWaterTabs(const LLSettingsWaterPtr_t &p_water);
 	void                        updateSkyTabs(const LLSettingsSkyPtr_t &p_sky);
-	void                        setWaterTabsEnabled(BOOL enable);
-	void                        setSkyTabsEnabled(BOOL enable);
 	void                        updateButtons();
 	void                        updateSlider(); //generate sliders from current track
 	void                        updateTimeAndLabel();
@@ -201,6 +199,9 @@ private:
     F32                         mPlayStartFrame; // an env frame
     bool                        mIsPlaying;
     bool                        mIsDirty;
+    bool                        mCanCopy;
+    bool                        mCanMod;
+    bool                        mMakeNoTrans;
 
     edit_commit_signal_t        mCommitSignal;
 
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 39e37034e7..47b07a8315 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -87,7 +87,9 @@ LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) :
     mFlyoutControl(nullptr),
     mInventoryId(),
     mInventoryItem(nullptr),
-    mIsDirty(false)
+    mIsDirty(false),
+    mCanCopy(false),
+    mCanMod(false)
 {
 }
 
@@ -168,12 +170,13 @@ void LLFloaterFixedEnvironment::refresh()
 
     bool is_inventory_avail = canUseInventory();
 
-    mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail);
-    mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail);
+    mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && !mInventoryId.isNull());
+    mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail && mCanCopy);
     mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel());
     mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion());
 
     mTxtName->setValue(mSettings->getName());
+    mTxtName->setEnabled(mCanMod);
 
     S32 count = mTab->getTabCount();
 
@@ -181,7 +184,10 @@ void LLFloaterFixedEnvironment::refresh()
     {
         LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));
         if (panel)
+        {
             panel->refresh();
+            panel->setCanChangeSettings(mCanMod);
+        }
     }
 }
 
@@ -221,6 +227,8 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID  &inventoryId)
     {
         mInventoryItem = nullptr;
         mInventoryId.setNull();
+        mCanMod = true;
+        mCanCopy = true;
         return;
     }
 
@@ -250,9 +258,11 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID  &inventoryId)
         return;
     }
 
+    mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID());
+    mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID());
 
     LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(),
-        [this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); });
+        [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });
 }
 
 
@@ -265,7 +275,7 @@ void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnviro
 
         // create and show confirmation textbox
         LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(),
-            [this, cb](const LLSD&notif, const LLSD&resp)
+            [cb](const LLSD&notif, const LLSD&resp)
             {
                 S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
                 if (opt == 0)
@@ -296,6 +306,9 @@ void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::p
     }
 
     mSettings = settings;
+    if (mInventoryItem)
+        mSettings->setName(mInventoryItem->getName());
+
     updateEditEnvironment();
     syncronizeTabs();
     refresh();
@@ -359,12 +372,19 @@ void LLFloaterFixedEnvironment::doApplyCreateNewInventory()
 
 void LLFloaterFixedEnvironment::doApplyUpdateInventory()
 {
+    LL_WARNS("LAPRAS") << "Update inventory for " << mInventoryId << LL_ENDL;
     if (mInventoryId.isNull())
-        LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), 
-                [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
+    {
+        LL_WARNS("LAPRAS") << "Inventory ID is NULL. Creating New!!!" << LL_ENDL;
+        LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS),
+            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
+    }
     else
-        LLSettingsVOBase::updateInventoryItem(mSettings, mInventoryId, 
-                [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); });
+    {
+        LL_WARNS("LAPRAS") << "Updating inventory ID " << mInventoryId << LL_ENDL;
+        LLSettingsVOBase::updateInventoryItem(mSettings, mInventoryId,
+            [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); });
+    }
 }
 
 void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where)
@@ -430,6 +450,18 @@ void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inven
         return;
     }
 
+    if (mInventoryItem)
+    {
+        LLPermissions perms = mInventoryItem->getPermissions();
+
+        LLInventoryItem *created_item = gInventory.getItem(mInventoryId);
+
+        if (created_item)
+        {
+            created_item->setPermissions(perms);
+            created_item->updateServer(false);
+        }
+    }
     clearDirtyFlag();
     setFocus(TRUE);                 // Call back the focus...
     loadInventoryItem(inventory_id);
@@ -563,10 +595,13 @@ void LLFloaterFixedEnvironmentWater::doImportFromDisk()
             return;
         }
 
+        loadInventoryItem(LLUUID::null);
+
         setDirtyFlag();
         LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacywater);
         setEditSettings(legacywater);
         LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true);
+
     }
 }
 
@@ -641,6 +676,8 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk()
             return;
         }
 
+        loadInventoryItem(LLUUID::null);
+
         clearDirtyFlag();
         LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacysky);
         setEditSettings(legacysky);
@@ -650,3 +687,8 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk()
 
 //=========================================================================
 
+void LLSettingsEditPanel::setCanChangeSettings(bool enabled)
+{
+    setEnabled(enabled);
+    setAllChildrenEnabled(enabled);
+}
diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h
index 50b229e0c4..b7991ceb01 100644
--- a/indra/newview/llfloaterfixedenvironment.h
+++ b/indra/newview/llfloaterfixedenvironment.h
@@ -97,6 +97,8 @@ protected:
     LLUUID                  mInventoryId;
     LLInventoryItem *       mInventoryItem;
     LLHandle<LLFloater>     mInventoryFloater;
+    bool                    mCanCopy;
+    bool                    mCanMod;
 
     void                    onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
     void                    onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
@@ -173,8 +175,11 @@ public:
     inline void         setIsDirty()            { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
     inline void         clearIsDirty()          { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
 
+    virtual void        setCanChangeSettings(bool flag);
+
     inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb)    { return mOnDirtyChanged.connect(cb); }
 
+
 protected:
     LLSettingsEditPanel() :
         LLPanel(),
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 6426e95f6c..b16ba65c01 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -60,6 +60,8 @@
 #include "lldrawpoolwater.h"
 
 #include <boost/algorithm/string/replace.hpp>
+#include "llinventoryobserver.h"
+#include "llinventorydefines.h"
 
 #undef  VERIFY_LEGACY_CONVERSION
 
@@ -177,6 +179,34 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings
         return;
     }
 
+    LLViewerInventoryItem *inv_item = gInventory.getItem(inv_item_id);
+    if (inv_item)
+    {
+        bool need_update(false);
+        LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
+
+        if (settings->getFlag(LLSettingsBase::FLAG_NOTRANS) && new_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+        {
+            LLPermissions perm(inv_item->getPermissions());
+            perm.setBaseBits(LLUUID::null, FALSE, PERM_TRANSFER);
+            perm.setOwnerBits(LLUUID::null, FALSE, PERM_TRANSFER);
+            new_item->setPermissions(perm);
+            need_update |= true;
+        }
+        if (settings->getName() != new_item->getName())
+        {
+            new_item->rename(settings->getName());
+            settings->setName(new_item->getName()); // account for corrections
+            need_update |= true;
+        }
+        if (need_update)
+        {
+            new_item->updateServer(FALSE);
+            gInventory.updateItem(new_item);
+            gInventory.notifyObservers();
+        }
+    }
+
     std::stringstream buffer; 
     LLSD settingdata(settings->getSettings());
     LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION);
@@ -210,7 +240,6 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings
     std::stringstream buffer;
     LLSD settingdata(settings->getSettings());
 
-
     LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION);
 
     LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(object_id, inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(),
@@ -293,6 +322,10 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i
         callback(asset_id, settings, status, ext_status);
 }
 
+void LLSettingsVOBase::getSettingsInventory(const LLUUID &inventoryId, inventory_download_fn callback)
+{
+
+}
 
 bool LLSettingsVOBase::exportFile(const LLSettingsBase::ptr_t &settings, const std::string &filename, LLSDSerialize::ELLSD_Serialize format)
 {
@@ -1105,6 +1138,10 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
 
     LLSettingsDay::ptr_t dayp = std::make_shared<LLSettingsVODay>(settings);
 
+    U32 flags = getFlags();
+    if (flags)
+        dayp->setFlags(flags);
+
     dayp->initialize();
     return dayp;
 }
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index d314eed24e..0d7b7902c1 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -39,12 +39,14 @@
 #include <boost/signals2.hpp>
 
 class LLVFS;
+class LLInventoryItem;
 
 //=========================================================================
 class LLSettingsVOBase : public LLSettingsBase
 {
 public:
     typedef std::function<void(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat extstat)>  asset_download_fn;
+    typedef std::function<void(LLInventoryItem *inv_item, LLSettingsBase::ptr_t settings, S32 status, LLExtStat extstat)> inventory_download_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());
@@ -54,6 +56,7 @@ public:
     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     getSettingsInventory(const LLUUID &inventoryId, inventory_download_fn callback = inventory_download_fn());
 
     static bool     exportFile(const LLSettingsBase::ptr_t &settings, const std::string &filename, LLSDSerialize::ELLSD_Serialize format = LLSDSerialize::LLSD_NOTATION);
     static LLSettingsBase::ptr_t importFile(const std::string &filename);
diff --git a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
index 73f2683e84..9b572ce9b0 100644
--- a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
+++ b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
@@ -15,6 +15,8 @@
         help_topic="fixed_environment"
         single_instance="true" 
         width="750">
+    <string name="edit_sky">Edit Sky:</string>
+    <string name="edit_water">Edit Water:</string>
     <layout_stack name="floater_stack"
             left="5"
             top="5"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 2ab22cb565..cd642f9531 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -11197,5 +11197,22 @@ Are you sure you want to continue?
      notext="No"
      yestext="Yes"/>
   </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="SettingsMakeNoTrans"
+   type="alertmodal">
+You are about to import non-transferable settings into this daycycle. Continuing will cause the settings you are editing to become non-transferable also. 
+
+This change can not be undone.
+
+Are you sure you want to continue?
+    <tag>confirm</tag>
+    <usetemplate
+     ignoretext="Are you sure you want to make settings non-transferable?"
+     name="okcancelignore"
+     notext="No"
+     yestext="Yes"/>
+  </notification>
   
 </notifications>
-- 
cgit v1.2.3


From 8c9d758e3a5de9e11b2e33753e61a5359dbff8de Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Fri, 7 Sep 2018 17:10:27 -0700
Subject: Get rid of (void)this... (this should not have been captured in the
 first place.)

---
 indra/newview/llfloatereditextdaycycle.cpp  | 1 -
 indra/newview/llfloaterfixedenvironment.cpp | 1 -
 2 files changed, 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 53deb8dadb..f1dbb32016 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -711,7 +711,6 @@ void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb)
         LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(),
             [cb](const LLSD&notif, const LLSD&resp)
             {
-                (void)this;
                 S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
                 if (opt == 0)
                     cb();
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 4b420888a0..47b07a8315 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -277,7 +277,6 @@ void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnviro
         LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(),
             [cb](const LLSD&notif, const LLSD&resp)
             {
-                (void)this;
                 S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
                 if (opt == 0)
                     cb();
-- 
cgit v1.2.3