viewer#1213 My Environments 'Apply' buttons enabled for folders

master
Andrey Kleshchev 2024-04-15 23:40:36 +03:00 committed by Andrey Kleshchev
parent 1ede3073fd
commit d7614a89b6
3 changed files with 15 additions and 10 deletions

View File

@ -318,13 +318,13 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context)
if (context == PARAMETER_EDIT) if (context == PARAMETER_EDIT)
{ {
return (selected.size() == 1) && isSettingSelected(selected.front()); return (selected.size() == 1) && isSettingId(selected.front());
} }
else if (context == PARAMETER_COPY) else if (context == PARAMETER_COPY)
{ {
for (std::vector<LLUUID>::iterator it = selected.begin(); it != selected.end(); it++) for (std::vector<LLUUID>::iterator it = selected.begin(); it != selected.end(); it++)
{ {
if(!isSettingSelected(*it)) if(!isSettingId(*it))
{ {
return false; return false;
} }
@ -340,7 +340,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context)
LLClipboard::instance().pasteFromClipboard(ids); LLClipboard::instance().pasteFromClipboard(ids);
for (std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) for (std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
{ {
if (!isSettingSelected(*it)) if (!isSettingId(*it))
{ {
return false; return false;
} }
@ -349,7 +349,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context)
} }
else if (context == PARAMETER_COPYUUID) else if (context == PARAMETER_COPYUUID)
{ {
return (selected.size() == 1) && isSettingSelected(selected.front()); return (selected.size() == 1) && isSettingId(selected.front());
} }
return false; return false;
@ -365,16 +365,18 @@ bool LLFloaterMyEnvironment::canApply(const std::string &context)
if (context == PARAMETER_REGION) if (context == PARAMETER_REGION)
{ {
return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); return isSettingId(selected.front()) && LLEnvironment::instance().canAgentUpdateRegionEnvironment();
} }
else if (context == PARAMETER_PARCEL) else if (context == PARAMETER_PARCEL)
{ {
return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); return isSettingId(selected.front()) && LLEnvironment::instance().canAgentUpdateParcelEnvironment();
} }
else else if (context == PARAMETER_LOCAL)
{ {
return (context == PARAMETER_LOCAL); return isSettingId(selected.front());
} }
return false;
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -436,7 +438,7 @@ LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_
return LLUUID::null; return LLUUID::null;
} }
bool LLFloaterMyEnvironment::isSettingSelected(LLUUID item_id) bool LLFloaterMyEnvironment::isSettingId(const LLUUID& item_id)
{ {
LLInventoryItem* itemp = gInventory.getItem(item_id); LLInventoryItem* itemp = gInventory.getItem(item_id);

View File

@ -69,7 +69,7 @@ private:
void getSelectedIds(uuid_vec_t& ids) const; void getSelectedIds(uuid_vec_t& ids) const;
void refreshButtonStates(); void refreshButtonStates();
bool isSettingSelected(LLUUID item_id); static bool isSettingId(const LLUUID &item_id);
static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library); static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library);
}; };

View File

@ -24,6 +24,9 @@
<menu_item_call.on_click <menu_item_call.on_click
function="MyEnvironments.DoApply" function="MyEnvironments.DoApply"
parameter="local" /> parameter="local" />
<menu_item_call.on_enable
function="MyEnvironments.CanApply"
parameter="local"/>
</menu_item_call> </menu_item_call>
<menu_item_call <menu_item_call
name="Settings Apply Parcel" name="Settings Apply Parcel"