diff options
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index caea5e9a98..301fff2e2b 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -953,6 +953,8 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) BOOL LLInvFVBridge::canShare() const { + if (!isAgentInventory()) return FALSE; + const LLInventoryModel* model = getInventoryModel(); if (!model) return FALSE; @@ -964,9 +966,10 @@ BOOL LLInvFVBridge::canShare() const return (BOOL)LLGiveInventory::isInventoryGiveAcceptable(item); } - // All categories can be given. - const LLViewerInventoryCategory* cat = model->getCategory(mUUID); - return (cat != NULL); + // Categories can be given. + if (model->getCategory(mUUID)) return TRUE; + + return FALSE; } // +=================================================+ @@ -1445,7 +1448,7 @@ bool LLItemBridge::isRemoveAction(std::string action) const // | LLFolderBridge | // +=================================================+ -LLFolderBridge* LLFolderBridge::sSelf=NULL; +LLHandle<LLFolderBridge> LLFolderBridge::sSelf; // Can be moved to another folder BOOL LLFolderBridge::isItemMovable() const @@ -2389,8 +2392,11 @@ void LLFolderBridge::pasteLinkFromClipboard() void LLFolderBridge::staticFolderOptionsMenu() { - if (!sSelf) return; - sSelf->folderOptionsMenu(); + LLFolderBridge* selfp = sSelf.get(); + if (selfp) + { + selfp->folderOptionsMenu(); + } } void LLFolderBridge::folderOptionsMenu() @@ -2467,11 +2473,15 @@ void LLFolderBridge::folderOptionsMenu() } mItems.push_back(std::string("Outfit Separator")); } - hide_context_entries(*mMenu, mItems, disabled_items, TRUE); + LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get()); + if (menup) + { + hide_context_entries(*menup, mItems, disabled_items, TRUE); - // Reposition the menu, in case we're adding items to an existing menu. - mMenu->needsArrange(); - mMenu->arrangeAndClear(); + // Reposition the menu, in case we're adding items to an existing menu. + menup->needsArrange(); + menup->arrangeAndClear(); + } } BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) @@ -2513,6 +2523,10 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mDisabledItems.push_back(std::string("New Body Parts")); } + // clear out old menu and folder pointers + mMenu.markDead(); + sSelf.markDead(); + if(trash_id == mUUID) { // This is the trash. @@ -2588,9 +2602,6 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { mWearables=TRUE; } - - mMenu = &menu; - sSelf = this; } // Preemptively disable system folder removal if more than one item selected. @@ -2605,12 +2616,6 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mDisabledItems.push_back(std::string("Share")); } - if (mItems.empty()) - { - mItems.push_back(std::string("--no options--")); - mDisabledItems.push_back(std::string("--no options--")); - } - hide_context_entries(menu, mItems, mDisabledItems); // Add menu items that are dependent on the contents of the folder. @@ -2620,6 +2625,9 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { folders.push_back(category->getUUID()); } + + mMenu = menu.getHandle(); + sSelf = getHandle(); LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE); fetch->startFetch(); inc_busy_count(); @@ -4142,7 +4150,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } LLSD cbparams; cbparams["index"] = curiter->first; - cbparams["label"] = attachment->getName(); + cbparams["label"] = p.name; p.on_click.function_name = "Inventory.AttachObject"; p.on_click.parameter = LLSD(attachment->getName()); p.on_enable.function_name = "Attachment.Label"; |