summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-05-30 13:10:36 +0300
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-05-30 13:10:36 +0300
commit5c55adae47cab93a12793528373f639ea9e8efcf (patch)
treeffc13bb9ee911a2ed2560e008d585363b2059638 /indra/newview
parentd42f2a1887a1bc94a97c08bfe676731672ce53d3 (diff)
SL-19773 add context menu for root folder in single folder mode
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorybridge.cpp20
-rw-r--r--indra/newview/llinventoryfunctions.cpp8
-rw-r--r--indra/newview/llinventorygallerymenu.cpp6
-rw-r--r--indra/newview/llinventorypanel.cpp17
-rw-r--r--indra/newview/llinventorypanel.h1
5 files changed, 43 insertions, 9 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 1c8342cdda..3c1e58205a 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -791,6 +791,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
menuentry_vec_t &disabled_items, U32 flags)
{
const LLInventoryObject *obj = getInventoryObject();
+ bool single_folder_root = (mRoot == NULL);
if (obj)
{
@@ -802,7 +803,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Copy"));
}
- if (isAgentInventory())
+ if (isAgentInventory() && !single_folder_root)
{
items.push_back(std::string("New folder from selected"));
items.push_back(std::string("Subfolder Separator"));
@@ -836,7 +837,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
items.push_back(std::string("Find Links"));
}
- if (!isInboxFolder())
+ if (!isInboxFolder() && !single_folder_root)
{
items.push_back(std::string("Rename"));
if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0))
@@ -870,6 +871,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
}
+ if(!single_folder_root)
+ {
items.push_back(std::string("Cut"));
if (!isItemMovable() || !isItemRemovable())
{
@@ -891,6 +894,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
}
}
+ }
}
}
@@ -916,7 +920,10 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
items.push_back(std::string("Paste Separator"));
- addDeleteContextMenuOptions(items, disabled_items);
+ if(!single_folder_root)
+ {
+ addDeleteContextMenuOptions(items, disabled_items);
+ }
if (!isPanelActive("All Items") && !isPanelActive("single_folder_inv") && !isPanelActive("comb_single_folder_inv"))
{
@@ -4382,7 +4389,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
const bool is_agent_inventory = isAgentInventory();
// Only enable calling-card related options for non-system folders.
- if (!is_system_folder && is_agent_inventory)
+ if (!is_system_folder && is_agent_inventory && (mRoot != NULL))
{
LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
@@ -4402,6 +4409,11 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
disabled_items.push_back(std::string("New folder from selected"));
}
+ //skip the rest options in single-folder mode
+ if (mRoot == NULL)
+ {
+ return;
+ }
if ((flags & ITEM_IN_MULTI_SELECTION) == 0)
{
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index b934ccd22b..a259dad08a 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -3194,6 +3194,14 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
if(!bridge) continue;
bridge->performAction(model, action);
}
+ if(root->isSingleFolderMode() && selected_items.empty())
+ {
+ LLInvFVBridge* bridge = (LLInvFVBridge*)root->getViewModelItem();
+ if(bridge)
+ {
+ bridge->performAction(model, action);
+ }
+ }
}
// Update the marketplace listings that have been affected by the operation
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index 8a99b79e2b..6dc749fab6 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -544,10 +544,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
}
items.push_back(std::string("Subfolder Separator"));
- if (!is_system_folder)
+ if (!is_system_folder && !isRootFolder())
{
- if(!isRootFolder())
- {
if(has_children && (folder_type != LLFolderType::FT_OUTFIT))
{
items.push_back(std::string("Ungroup folder items"));
@@ -559,7 +557,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
disabled_items.push_back(std::string("Delete"));
disabled_items.push_back(std::string("Cut"));
}
- }
+
if(!is_inbox)
{
items.push_back(std::string("Rename"));
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 2226384ba2..bd15e55b9a 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -2116,6 +2116,7 @@ LLInventorySingleFolderPanel::LLInventorySingleFolderPanel(const Params& params)
mCommitCallbackRegistrar.add("Inventory.OpenSelectedFolder", boost::bind(&LLInventorySingleFolderPanel::openInCurrentWindow, this, _2));
mCommitCallbackRegistrar.replace("Inventory.DoCreate", boost::bind(&LLInventorySingleFolderPanel::doCreate, this, _2));
+ mCommitCallbackRegistrar.replace("Inventory.Share", boost::bind(&LLInventorySingleFolderPanel::doShare, this));
}
LLInventorySingleFolderPanel::~LLInventorySingleFolderPanel()
@@ -2138,6 +2139,7 @@ void LLInventorySingleFolderPanel::initFromParams(const Params& p)
pane_params.open_first_folder = false;
pane_params.start_folder.id = mFolderID;
LLInventoryPanel::initFromParams(pane_params);
+ mFolderRoot.get()->setSingleFolderMode(true);
}
void LLInventorySingleFolderPanel::openInCurrentWindow(const LLSD& userdata)
@@ -2219,7 +2221,7 @@ void LLInventorySingleFolderPanel::updateSingleFolderRoot()
LLFolderView* folder_view = createFolderRoot(root_id);
folder_view->setChildrenInited(false);
mFolderRoot = folder_view->getHandle();
-
+ mFolderRoot.get()->setSingleFolderMode(true);
addItemID(root_id, mFolderRoot.get());
LLRect scroller_view_rect = getRect();
@@ -2285,6 +2287,19 @@ void LLInventorySingleFolderPanel::doCreate(const LLSD& userdata)
reset_inventory_filter();
menu_create_inventory_item(this, dest_id, userdata);
}
+
+void LLInventorySingleFolderPanel::doShare()
+{
+ if(mFolderRoot.get()->getCurSelectedItem() == NULL)
+ {
+ std::set<LLUUID> uuids{mFolderID};
+ LLAvatarActions::shareWithAvatars(uuids, gFloaterView->getParentFloater(this));
+ }
+ else
+ {
+ LLAvatarActions::shareWithAvatars(this);
+ }
+}
/************************************************************************/
/* Asset Pre-Filtered Inventory Panel related class */
/************************************************************************/
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 7b54a5bbf2..2754d79fbe 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -409,6 +409,7 @@ public:
LLUUID getSingleFolderRoot() { return mFolderID; }
void doCreate(const LLSD& userdata);
+ void doShare();
bool isBackwardAvailable();
bool isForwardAvailable();