diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-05-24 10:09:42 +0300 | 
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-05-24 13:59:28 +0300 | 
| commit | c4392d4da3859966ab39f44371ea42fce87ae029 (patch) | |
| tree | 2c9a4ca3fe8b97137f1ca3b28d4a180e2f9c7d54 | |
| parent | e0f5606db36c64f69dc60e0b68752b16acf20734 (diff) | |
viewer#1408 Change misleading content removal wanring
| -rw-r--r-- | indra/newview/llpanelobjectinventory.cpp | 66 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 9 | 
2 files changed, 43 insertions, 32 deletions
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 141a1515d5..f2a469bed4 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -307,20 +307,27 @@ BOOL LLTaskInvFVBridge::isItemRenameable() const  BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name)  {      LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); -    if(object) +    if(!object)      { -        LLViewerInventoryItem* item = NULL; -        item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID); -        if(item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), -                                        GP_OBJECT_MANIPULATE, GOD_LIKE))) -        { -            LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); -            new_item->rename(new_name); -            object->updateInventory( -                new_item, -                TASK_INVENTORY_ITEM_KEY, -                false); -        } +        return false; +    } +    if (!object->permModify()) +    { +        LLNotificationsUtil::add("CantModifyContentInNoModTask"); +        return false; +    } + +    LLViewerInventoryItem* item = NULL; +    item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID); +    if (item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), +        GP_OBJECT_MANIPULATE, GOD_LIKE))) +    { +        LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); +        new_item->rename(new_name); +        object->updateInventory( +            new_item, +            TASK_INVENTORY_ITEM_KEY, +            false);      }      return TRUE;  } @@ -387,10 +394,7 @@ BOOL LLTaskInvFVBridge::removeItem()              }              else              { -                LLSD payload; -                payload["task_id"] = mPanel->getTaskUUID(); -                payload["inventory_ids"].append(mUUID); -                LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel)); +                LLNotificationsUtil::add("CantModifyContentInNoModTask");                  return FALSE;              }          } @@ -413,15 +417,7 @@ void   LLTaskInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch      if (!object->permModify())      { -        LLSD payload; -        payload["task_id"] = mPanel->getTaskUUID(); -        for (S32 i = 0; i < (S32)batch.size(); i++) -        { -            LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i]; -            payload["inventory_ids"].append(itemp->getUUID()); -        } -        LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel)); - +        LLNotificationsUtil::add("CantModifyContentInNoModTask");      }      else      { @@ -1378,7 +1374,23 @@ BOOL LLPanelObjectInventory::postBuild()  void LLPanelObjectInventory::doToSelected(const LLSD& userdata)  { -    LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString()); +    std::string action = userdata.asString(); +    if ("rename" == action || "delete" == action) +    { +        LLViewerObject* objectp = gObjectList.findObject(mTaskUUID); +        if (objectp && !objectp->permModify()) +        { +            LLNotificationsUtil::add("CantModifyContentInNoModTask"); +        } +        else +        { +            LLInventoryAction::doToSelected(&gInventory, mFolders, action); +        } +    } +    else +    { +        LLInventoryAction::doToSelected(&gInventory, mFolders, action); +    }  }  void LLPanelObjectInventory::clearContents() diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 7d237c6edd..6ad83508b8 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4501,13 +4501,12 @@ You already have blocked this name.    <notification     icon="alert.tga" -   name="RemoveItemWarn" +   name="CantModifyContentInNoModTask"     type="alert"> -Though permitted, deleting contents may damage the object. Do you want to delete that item? -    <tag>confirm</tag> +You don't have permission to modify content of this object +      <tag>confirm</tag>      <usetemplate -     name="okcancelbuttons" -     notext="Cancel" +     name="okbutton"       yestext="OK"/>    </notification>  | 
