summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2012-01-20 16:10:32 -0800
committerLeslie Linden <leslie@lindenlab.com>2012-01-20 16:10:32 -0800
commitc8a2f6515a47c625d97802bd9f7bd833be65fe2c (patch)
tree1cb459ae178b05fa2750b00247be4688571cc620 /indra/newview
parenta73013f7081db15aae93cc82feb895139b1847db (diff)
EXP-1799 FIX -- Replace and Add to Outfit options appear as grayed out in Inventory
* Refactored LLFolderBridge::buildContextMenu fetch to clear and rebuild basic context menu options after the fetch rather than trying to merge the two.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorybridge.cpp86
-rw-r--r--indra/newview/llinventorybridge.h8
2 files changed, 59 insertions, 35 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 97e61f4c99..472be8cf5c 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -519,6 +519,8 @@ void hide_context_entries(LLMenuGL& menu,
{
menu_item->setVisible(FALSE);
}
+
+ menu_item->setEnabled(FALSE);
}
else
{
@@ -601,13 +603,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
{
items.push_back(std::string("Marketplace Separator"));
- bool copyable = true;
- LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
- if (inv_item)
- {
- copyable = inv_item->getPermissions().allowCopyBy(gAgent.getID());
- }
-
items.push_back(std::string("Merchant Copy"));
if (!canListOnMarketplaceNow())
{
@@ -1138,12 +1133,6 @@ bool LLInvFVBridge::canListOnMarketplace() const
return false;
}
- const LLUUID & outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
- if (outbox_id.isNull())
- {
- return false;
- }
-
LLViewerInventoryItem * item = model->getItem(mUUID);
if (item)
{
@@ -2415,7 +2404,6 @@ public:
delete this;
}
-
protected:
LLUUID mCatID;
bool mCopyItems;
@@ -2945,12 +2933,38 @@ void LLFolderBridge::staticFolderOptionsMenu()
LLFolderBridge* selfp = sSelf.get();
if (selfp)
{
- selfp->folderOptionsMenu();
+ selfp->folderOptionsMenuAfterFetch();
}
}
-void LLFolderBridge::folderOptionsMenu()
+void LLFolderBridge::folderOptionsMenuAfterFetch()
{
+ const U32 flags = mContextMenuFlags;
+
+ mItems.clear();
+ mDisabledItems.clear();
+ mContextMenuFlags = 0x0;
+
+ LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
+ if (!menup) return;
+
+ // Reset the menu
+ {
+ const LLView::child_list_t *list = menup->getChildList();
+
+ LLView::child_list_t::const_iterator menu_itor;
+ for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor)
+ {
+ (*menu_itor)->setVisible(FALSE);
+ (*menu_itor)->pushVisible(TRUE);
+ (*menu_itor)->setEnabled(TRUE);
+ }
+ }
+
+ // Build basic menu back up
+ buildContextMenuBaseOptions(*menup, flags);
+
+ // Build folder specific options back up
LLInventoryModel* model = getInventoryModel();
if(!model) return;
@@ -3032,15 +3046,12 @@ void LLFolderBridge::folderOptionsMenu()
}
mItems.push_back(std::string("Outfit Separator"));
}
- LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
- if (menup)
- {
- hide_context_entries(*menup, mItems, mDisabledItems);
- // Reposition the menu, in case we're adding items to an existing menu.
- menup->needsArrange();
- menup->arrangeAndClear();
- }
+ hide_context_entries(*menup, mItems, mDisabledItems);
+
+ // 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)
@@ -3055,17 +3066,11 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv
return ((item_array.count() > 0) ? TRUE : FALSE );
}
-// Flags unused
-void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+void LLFolderBridge::buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags)
{
- mItems.clear();
- mDisabledItems.clear();
-
- lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
-
-// menuentry_vec_t disabled_items;
LLInventoryModel* model = getInventoryModel();
- if(!model) return;
+ llassert(model != NULL);
+
const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
@@ -3186,6 +3191,21 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
mDisabledItems.push_back(std::string("Share"));
}
}
+}
+
+// Flags unused
+void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ mItems.clear();
+ mDisabledItems.clear();
+ mContextMenuFlags = flags;
+
+ lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
+
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+
+ buildContextMenuBaseOptions(menu, flags);
hide_context_entries(menu, mItems, mDisabledItems);
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index cb378b7d7a..56301ce728 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -235,7 +235,8 @@ public:
const LLUUID& uuid) :
LLInvFVBridge(inventory, root, uuid),
mCallingCards(FALSE),
- mWearables(FALSE)
+ mWearables(FALSE),
+ mContextMenuFlags(0x0)
{}
BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg);
@@ -282,6 +283,8 @@ public:
LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
protected:
+ void buildContextMenuBaseOptions(LLMenuGL& menu, U32 flags);
+
//--------------------------------------------------------------------
// Menu callbacks
//--------------------------------------------------------------------
@@ -317,7 +320,7 @@ protected:
public:
static LLHandle<LLFolderBridge> sSelf;
static void staticFolderOptionsMenu();
- void folderOptionsMenu();
+ void folderOptionsMenuAfterFetch();
private:
BOOL mCallingCards;
@@ -325,6 +328,7 @@ private:
LLHandle<LLView> mMenu;
menuentry_vec_t mItems;
menuentry_vec_t mDisabledItems;
+ U32 mContextMenuFlags;
LLRootHandle<LLFolderBridge> mHandle;
};