SL-14855 Disable edit button for uneditable items

master
Andrey Kleshchev 2021-03-25 22:58:26 +02:00
parent d38c2d8cd8
commit b2d339ff06
3 changed files with 12 additions and 1 deletions

View File

@ -360,6 +360,11 @@ void LLPanelLandmarkInfo::toggleLandmarkEditMode(BOOL enabled)
setFocus(TRUE);
}
void LLPanelLandmarkInfo::setCanEdit(BOOL enabled)
{
getChild<LLButton>("edit_btn")->setEnabled(enabled);
}
const std::string& LLPanelLandmarkInfo::getLandmarkTitle() const
{
return mLandmarkTitleEditor->getText();

View File

@ -51,6 +51,7 @@ public:
void displayItemInfo(const LLInventoryItem* pItem);
void toggleLandmarkEditMode(BOOL enabled);
void setCanEdit(BOOL enabled);
const std::string& getLandmarkTitle() const;
const std::string getLandmarkNotes() const;

View File

@ -430,10 +430,15 @@ void LLPanelPlaces::onOpen(const LLSD& key)
{
mLandmarkInfo->setInfoType(LLPanelPlaceInfo::LANDMARK);
LLInventoryItem* item = gInventory.getItem(key["id"].asUUID());
LLUUID id = key["id"].asUUID();
LLInventoryItem* item = gInventory.getItem(id);
if (!item)
return;
BOOL is_editable = gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())
&& item->getPermissions().allowModifyBy(gAgent.getID());
mLandmarkInfo->setCanEdit(is_editable);
setItem(item);
}
else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE)