SL-19773 add context menu for root folder in single folder mode
parent
d42f2a1887
commit
5c55adae47
|
|
@ -190,7 +190,8 @@ LLFolderView::LLFolderView(const Params& p)
|
|||
mShowItemLinkOverlays(p.show_item_link_overlays),
|
||||
mViewModel(p.view_model),
|
||||
mGroupedItemModel(p.grouped_item_model),
|
||||
mForceArrange(false)
|
||||
mForceArrange(false),
|
||||
mSingleFolderMode(false)
|
||||
{
|
||||
LLPanel* panel = p.parent_panel;
|
||||
mParentPanel = panel->getHandle();
|
||||
|
|
@ -1475,8 +1476,8 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
|||
}
|
||||
}
|
||||
bool hide_folder_menu = mSuppressFolderMenu && isFolderSelected();
|
||||
if (menu && (handled
|
||||
&& ( count > 0 && (hasVisibleChildren()) )) && // show menu only if selected items are visible
|
||||
if (menu && (mSingleFolderMode || (handled
|
||||
&& ( count > 0 && (hasVisibleChildren()) ))) && // show menu only if selected items are visible
|
||||
!hide_folder_menu)
|
||||
{
|
||||
if (mCallbackRegistrar)
|
||||
|
|
@ -1918,6 +1919,11 @@ void LLFolderView::updateMenuOptions(LLMenuGL* menu)
|
|||
flags = multi_select_flag;
|
||||
}
|
||||
|
||||
if(mSingleFolderMode && (mSelectedItems.size() == 0))
|
||||
{
|
||||
buildContextMenu(*menu, flags);
|
||||
}
|
||||
|
||||
// This adds a check for restrictions based on the entire
|
||||
// selection set - for example, any one wearable may not push you
|
||||
// over the limit, but all wearables together still might.
|
||||
|
|
|
|||
|
|
@ -127,6 +127,9 @@ public:
|
|||
bool getAllowMultiSelect() { return mAllowMultiSelect; }
|
||||
bool getAllowDrag() { return mAllowDrag; }
|
||||
|
||||
void setSingleFolderMode(bool is_single_mode) { mSingleFolderMode = is_single_mode; }
|
||||
bool isSingleFolderMode() { return mSingleFolderMode; }
|
||||
|
||||
// Close all folders in the view
|
||||
void closeAllFolders();
|
||||
void openTopLevelFolders();
|
||||
|
|
@ -300,7 +303,8 @@ protected:
|
|||
mShowItemLinkOverlays,
|
||||
mShowSelectionContext,
|
||||
mShowSingleSelection,
|
||||
mSuppressFolderMenu;
|
||||
mSuppressFolderMenu,
|
||||
mSingleFolderMode;
|
||||
|
||||
// Renaming variables and methods
|
||||
LLFolderViewItem* mRenameItem; // The item currently being renamed
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
/************************************************************************/
|
||||
|
|
|
|||
|
|
@ -409,6 +409,7 @@ public:
|
|||
LLUUID getSingleFolderRoot() { return mFolderID; }
|
||||
|
||||
void doCreate(const LLSD& userdata);
|
||||
void doShare();
|
||||
|
||||
bool isBackwardAvailable();
|
||||
bool isForwardAvailable();
|
||||
|
|
|
|||
Loading…
Reference in New Issue