diff options
Diffstat (limited to 'indra/newview/llfloaterfixedenvironment.cpp')
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 1200bf8183..4b420888a0 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¬if, const LLSD&resp) + [cb](const LLSD¬if, const LLSD&resp) { (void)this; S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); @@ -297,6 +307,9 @@ void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::p } mSettings = settings; + if (mInventoryItem) + mSettings->setName(mInventoryItem->getName()); + updateEditEnvironment(); syncronizeTabs(); refresh(); @@ -360,12 +373,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) @@ -431,6 +451,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); @@ -564,10 +596,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); + } } @@ -642,6 +677,8 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk() return; } + loadInventoryItem(LLUUID::null); + clearDirtyFlag(); LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacysky); setEditSettings(legacysky); @@ -651,3 +688,8 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk() //========================================================================= +void LLSettingsEditPanel::setCanChangeSettings(bool enabled) +{ + setEnabled(enabled); + setAllChildrenEnabled(enabled); +} |