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 7ec6440dc3..38f3521b2d 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -952,6 +952,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; @@ -963,9 +965,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; } // +=================================================+ @@ -1444,7 +1447,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 @@ -2388,8 +2391,11 @@ void LLFolderBridge::pasteLinkFromClipboard() void LLFolderBridge::staticFolderOptionsMenu() { - if (!sSelf) return; - sSelf->folderOptionsMenu(); + LLFolderBridge* selfp = sSelf.get(); + if (selfp) + { + selfp->folderOptionsMenu(); + } } void LLFolderBridge::folderOptionsMenu() @@ -2466,11 +2472,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) @@ -2512,6 +2522,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. @@ -2587,9 +2601,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. @@ -2604,12 +2615,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. @@ -2619,6 +2624,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(); @@ -4134,7 +4142,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"; |