summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-07-28 15:49:01 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-07-28 15:49:01 +0300
commit4cefba23d8c28cf94cc836706ad1afe9c294e2a9 (patch)
tree066d7a681df52ab9360ebb5eb42b0eb07c1e5d2d /indra/newview
parent5be77f8e8cdec5fa1bd16568875dc6c9ac94d96e (diff)
parent76da1229ec26b582e054e8a1588ea78943c92d70 (diff)
Merge from default branch
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfolderview.cpp44
-rw-r--r--indra/newview/llfolderview.h2
-rw-r--r--indra/newview/llinventorybridge.cpp15
-rw-r--r--indra/newview/llpanelobjectinventory.cpp2
4 files changed, 48 insertions, 15 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 14d3bda8e9..5aa504eb35 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -1874,13 +1874,18 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
}
// Successively filter out invalid options
- selected_items_t::iterator item_itor;
+
U32 flags = FIRST_SELECTED_ITEM;
- for (item_itor = mSelectedItems.begin(); item_itor != mSelectedItems.end(); ++item_itor)
+ for (selected_items_t::iterator item_itor = mSelectedItems.begin();
+ item_itor != mSelectedItems.end();
+ ++item_itor)
{
- (*item_itor)->buildContextMenu(*menu, flags);
+ LLFolderViewItem* selected_item = (*item_itor);
+ selected_item->buildContextMenu(*menu, flags);
flags = 0x0;
}
+
+ addNoOptions(menu);
menu->updateParent(LLMenuGL::sMenuContainer);
LLMenuGL::showPopup(this, menu, x, y);
@@ -1889,7 +1894,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
}
else
{
- if(menu && menu->getVisible())
+ if (menu && menu->getVisible())
{
menu->setVisible(FALSE);
}
@@ -1898,6 +1903,37 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
return handled;
}
+// Add "--no options--" if the menu is completely blank.
+BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const
+{
+ const std::string nooptions_str = "--no options--";
+ LLView *nooptions_item = NULL;
+
+ const LLView::child_list_t *list = menu->getChildList();
+ for (LLView::child_list_t::const_iterator itor = list->begin();
+ itor != list->end();
+ ++itor)
+ {
+ LLView *menu_item = (*itor);
+ if (menu_item->getVisible())
+ {
+ return FALSE;
+ }
+ std::string name = menu_item->getName();
+ if (menu_item->getName() == nooptions_str)
+ {
+ nooptions_item = menu_item;
+ }
+ }
+ if (nooptions_item)
+ {
+ nooptions_item->setVisible(TRUE);
+ nooptions_item->setEnabled(FALSE);
+ return TRUE;
+ }
+ return FALSE;
+}
+
BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask )
{
return LLView::handleHover( x, y, mask );
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 03e1bb9eee..c69f08eb2d 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -292,6 +292,8 @@ protected:
bool selectFirstItem();
bool selectLastItem();
+ BOOL addNoOptions(LLMenuGL* menu) const;
+
protected:
LLHandle<LLView> mPopupMenuHandle;
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0b1408616e..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;
}
// +=================================================+
@@ -2612,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.
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index ca1361c84b..116e5ba4cb 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -750,8 +750,6 @@ void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
std::vector<std::string> items;
std::vector<std::string> disabled_items;
- items.push_back(std::string("--no options--"));
- disabled_items.push_back(std::string("--no options--"));
hide_context_entries(menu, items, disabled_items);
}