- changed : only block moving or removing a locked folder if the folder (or one of its descendents) is locked

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2011-03-29 14:52:54 +02:00
parent 1edb9bde6f
commit 6dbdb72a90
3 changed files with 31 additions and 16 deletions

View File

@ -1475,11 +1475,7 @@ BOOL LLFolderBridge::isItemMovable() const
LLInventoryObject* obj = getInventoryObject();
if(obj)
{
// return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()));
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0b) | Added: RLVa-1.3.0b
return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())) &&
((!rlv_handler_t::isEnabled()) || (!gRlvFolderLocks.isLockedFolder(obj->getUUID(), RLV_LOCK_ANY)));
// [/RLVa:KB]
return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()));
}
return FALSE;
}
@ -1731,6 +1727,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
}
}
// [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Added: RLVa-1.3.0g
if ( (is_movable) && (rlv_handler_t::isEnabled()) )
{
is_movable = gRlvFolderLocks.canMove(cat_id, mUUID);
}
// [/RLVa:KB]
//
//--------------------------------------------------------------------------------

View File

@ -358,17 +358,13 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
return FALSE;
}
if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
{
return FALSE;
}
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0b) | Added: RLVa-1.3.0b
if ( (rlv_handler_t::isEnabled()) && (gRlvFolderLocks.isLockedFolder(id, RLV_LOCK_ANY)) )
{
return FALSE;
}
// if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
// [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g
if ( (!model->isObjectDescendentOf(id, gInventory.getRootFolderID())) || ((rlv_handler_t::isEnabled()) && (!gRlvFolderLocks.canRemove(id))) )
// [/RLVa:KB]
{
return FALSE;
}
if (!isAgentAvatarValid()) return FALSE;
@ -402,7 +398,7 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
{
// if (!model)
// [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g
if ( (!model) || ((rlv_handler_t::isEnabled()) && (model == &gInventory) && (gRlvFolderLocks.canRename(id))) )
if ( (!model) || ((rlv_handler_t::isEnabled()) && (model == &gInventory) && (!gRlvFolderLocks.canRename(id))) )
// [/RLVa:KB]
{
return FALSE;

View File

@ -348,6 +348,8 @@ protected:
* canXXX helper functions (note that a more approriate name might be userCanXXX)
*/
public:
bool canMove(const LLUUID& idFolder, const LLUUID& idDest = LLUUID::null) const;
bool canRemove(const LLUUID& idFolder) const;
bool canRename(const LLUUID& idFolder) const;
/*
@ -591,6 +593,20 @@ inline bool RlvFolderLocks::folderlock_descr_t::operator ==(const folderlock_des
(eLockPermission == rhs.eLockPermission) && (eLockScope == rhs.eLockScope);
}
// Checked: 2011-03-29 (RLVa-1.3.0g) | Added: RLVa-1.3.0g
inline bool RlvFolderLocks::canMove(const LLUUID& idFolder, const LLUUID& idDest) const
{
// Block moving a folder if the folder (or one of its descendents) is explicitly locked
return !hasLockedFolderDescendent(idFolder, ST_NONE, PERM_ANY, RLV_LOCK_ANY, true);
}
// Checked: 2011-03-29 (RLVa-1.3.0g) | Added: RLVa-1.3.0g
inline bool RlvFolderLocks::canRemove(const LLUUID& idFolder) const
{
// Block removing a folder if the folder (or one of its descendents) is explicitly locked
return !hasLockedFolderDescendent(idFolder, ST_NONE, PERM_ANY, RLV_LOCK_ANY, true);
}
// Checked: 2011-03-29 (RLVa-1.3.0g) | Added: RLVa-1.3.0g
inline bool RlvFolderLocks::canRename(const LLUUID& idFolder) const
{