summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp78
1 files changed, 54 insertions, 24 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index e9aaca13eb..ae96963b2a 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -138,6 +138,35 @@ bool isMarketplaceSendAction(const std::string& action)
return ("send_to_marketplace" == action);
}
+bool isPanelActive(const std::string& panel_name)
+{
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+ return (active_panel && (active_panel->getName() == panel_name));
+}
+
+bool isParentSystemFolder(const LLInventoryModel* model, const LLUUID& folder_id)
+{
+ if (!model || folder_id.isNull()) return false;
+
+ LLViewerInventoryCategory* cat = model->getCategory(folder_id);
+ if (cat)
+ {
+ if (cat->getPreferredType() == LLFolderType::FT_ROOT_INVENTORY)
+ {
+ return false;
+ }
+ if (LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ return true;
+ }
+ else
+ {
+ return isParentSystemFolder(model, cat->getParentUUID());
+ }
+ }
+ return false;
+}
+
// Used by LLFolderBridge as callback for directory fetching recursion
class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
{
@@ -888,8 +917,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Properties"));
}
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
- if (active_panel && (active_panel->getName() != "All Items"))
+ if (!isPanelActive("All Items"))
{
items.push_back(std::string("Show in Main Panel"));
}
@@ -980,7 +1008,7 @@ void LLInvFVBridge::addDeleteContextMenuOptions(menuentry_vec_t &items,
items.push_back(std::string("Delete"));
- if (!isItemRemovable())
+ if (!isItemRemovable() || isPanelActive("Favorite Items"))
{
disabled_items.push_back(std::string("Delete"));
}
@@ -1853,6 +1881,7 @@ void LLItemBridge::gotoItem()
if (active_panel)
{
active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO);
+ active_panel->setFocus(TRUE);
}
}
@@ -4010,6 +4039,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("New Clothes"));
disabled_items.push_back(std::string("New Body Parts"));
disabled_items.push_back(std::string("upload_def"));
+ disabled_items.push_back(std::string("Set Favorites folder"));
}
if (favorites == mUUID)
{
@@ -4037,6 +4067,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("New Clothes"));
disabled_items.push_back(std::string("New Body Parts"));
disabled_items.push_back(std::string("upload_def"));
+ disabled_items.push_back(std::string("Set Favorites folder"));
}
if (marketplace_listings_id == mUUID)
{
@@ -4045,14 +4076,14 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("Cut"));
disabled_items.push_back(std::string("Delete"));
}
+
+ if (isPanelActive("Favorite Items"))
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
if(trash_id == mUUID)
{
- bool is_recent_panel = false;
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
- if (active_panel && (active_panel->getName() == "Recent Items"))
- {
- is_recent_panel = true;
- }
+ bool is_recent_panel = isPanelActive("Recent Items");
// This is the trash.
items.push_back(std::string("Empty Trash"));
@@ -4101,6 +4132,16 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
items.push_back(std::string("New Body Parts"));
items.push_back(std::string("New Settings"));
items.push_back(std::string("upload_def"));
+
+ if (!LLFolderType::lookupIsProtectedType(getPreferredType()) && !isParentSystemFolder(model, mUUID))
+ {
+ items.push_back(std::string("Set Favorites folder"));
+ }
+ if (!LLEnvironment::instance().isInventoryEnabled())
+ {
+ disabled_items.push_back("New Settings");
+ }
+
}
}
getClipboardEntries(false, items, disabled_items, flags);
@@ -7210,24 +7251,13 @@ void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string acti
}
LLItemBridge::performAction(model,action);
}
+
void LLLinkFolderBridge::gotoItem()
{
- const LLUUID &cat_uuid = getFolderID();
- if (!cat_uuid.isNull())
- {
- LLFolderViewItem *base_folder = mInventoryPanel.get()->getItemByID(cat_uuid);
- if (base_folder)
- {
- if (LLInventoryModel* model = getInventoryModel())
- {
- model->fetchDescendentsOf(cat_uuid);
- }
- base_folder->setOpen(TRUE);
- mRoot->setSelection(base_folder,TRUE);
- mRoot->scrollToShowSelection();
- }
- }
+ LLItemBridge::gotoItem();
+ LLInventoryPanel::getActiveInventoryPanel()->openFolderByID(getFolderID());
}
+
const LLUUID &LLLinkFolderBridge::getFolderID() const
{
if (LLViewerInventoryItem *link_item = getItem())