diff options
author | Leslie Linden <leslie@lindenlab.com> | 2012-01-11 13:37:43 -0800 |
---|---|---|
committer | Leslie Linden <leslie@lindenlab.com> | 2012-01-11 13:37:43 -0800 |
commit | 542c31d547a7a42cd81c2a535805d30b164e31e4 (patch) | |
tree | 041c3d5e79458ffafd9809e59baa066275c97453 /indra | |
parent | 98f071aa6fc2961d9a86fa1d174c1f988a6ef8dc (diff) |
EXP-1788 FIX -- Outbox drag and drop restrictions can be bypassed if inventory not fully loaded
* The "Copy to Outbox" option is now disabled when the item is in the loading state.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfolderviewitem.h | 2 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 118 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 6 |
3 files changed, 76 insertions, 50 deletions
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 0f8c3edef8..5a0e58ea0e 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -122,6 +122,8 @@ public: // Mostly for debugging printout purposes. const std::string& getSearchableLabel() { return mSearchableLabel; } + + BOOL isLoading() const { return mIsLoading; } private: BOOL mIsSelected; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8abb6d66ad..e75ef20c6a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1088,108 +1088,132 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) } } -BOOL LLInvFVBridge::canShare() const +bool LLInvFVBridge::canShare() const { - if (!isAgentInventory()) return FALSE; + bool can_share = false; - const LLInventoryModel* model = getInventoryModel(); - if (!model) return FALSE; - - const LLViewerInventoryItem *item = model->getItem(mUUID); - if (item) + if (isAgentInventory()) { - if (!LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item)) - return FALSE; - return (BOOL)LLGiveInventory::isInventoryGiveAcceptable(item); + const LLInventoryModel* model = getInventoryModel(); + if (model) + { + const LLViewerInventoryItem *item = model->getItem(mUUID); + if (item) + { + if (LLInventoryCollectFunctor::itemTransferCommonlyAllowed(item)) + { + can_share = LLGiveInventory::isInventoryGiveAcceptable(item); + } + } + else + { + // Categories can be given. + can_share = (model->getCategory(mUUID) != NULL); + } + } } - // Categories can be given. - if (model->getCategory(mUUID)) return TRUE; - - return FALSE; + return can_share; } -BOOL LLInvFVBridge::canListOnMarketplace() const +bool LLInvFVBridge::canListOnMarketplace() const { #if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU + LLInventoryModel * model = getInventoryModel(); + const LLViewerInventoryCategory * cat = model->getCategory(mUUID); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { - return FALSE; + return false; } if (!isAgentInventory()) { - return FALSE; + return false; } if (getOutboxFolder().isNull()) { - return FALSE; + return false; } if (isInboxFolder() || isOutboxFolder()) { - return FALSE; + return false; } const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); if (outbox_id.isNull()) { - return FALSE; + return false; } LLViewerInventoryItem * item = model->getItem(mUUID); if (item && !item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { - return FALSE; + return false; } - return TRUE; + return true; + #else - return FALSE; + return false; #endif } -BOOL LLInvFVBridge::canListOnMarketplaceNow() const +bool LLInvFVBridge::canListOnMarketplaceNow() const { - BOOL can_list = FALSE; - #if ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU + + bool can_list = true; + // Do not allow listing while import is in progress + if (LLMarketplaceInventoryImporter::instanceExists()) + { + can_list = !LLMarketplaceInventoryImporter::instance().isImportInProgress(); + } + const LLInventoryObject* obj = getInventoryObject(); - if (obj) + if (obj && can_list) { - // Get outbox id - const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); - LLFolderViewItem * outbox_itemp = mRoot->getItemByID(outbox_id); + const LLUUID& object_id = obj->getLinkedUUID(); + can_list = object_id.notNull(); - if (outbox_itemp) + if (can_list) { - MASK mask = 0x0; - BOOL drop = FALSE; - EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType()); - void * cargo_data = (void *) obj; - std::string tooltip_msg; - - can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg); + LLFolderViewFolder * object_folderp = mRoot->getFolderByID(object_id); + if (object_folderp) + { + can_list = !object_folderp->isLoading(); + } } - } - - // Do not allow listing while import is in progress - if (LLMarketplaceInventoryImporter::instanceExists()) - { - if (LLMarketplaceInventoryImporter::instance().isImportInProgress()) + + if (can_list) { - can_list = FALSE; + // Get outbox id + const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false); + LLFolderViewItem * outbox_itemp = mRoot->getItemByID(outbox_id); + + if (outbox_itemp) + { + MASK mask = 0x0; + BOOL drop = FALSE; + EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType()); + void * cargo_data = (void *) obj; + std::string tooltip_msg; + + can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg); + } } } + + return can_list; +#else + return false; #endif - - return can_list; } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 2ab339b918..cb378b7d7a 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -69,9 +69,9 @@ public: U32 flags = 0x00); virtual ~LLInvFVBridge() {} - BOOL canShare() const; - BOOL canListOnMarketplace() const; - BOOL canListOnMarketplaceNow() const; + bool canShare() const; + bool canListOnMarketplace() const; + bool canListOnMarketplaceNow() const; //-------------------------------------------------------------------- // LLInvFVBridge functionality |