DD-75 : Prevent dropping on filtered tabs root. Adding an allow_drop option to inventory tab and folder view folders so that case can be taken into account.

master
Merov Linden 2014-07-30 20:51:18 -07:00
parent c182a8b797
commit d37c294bd3
7 changed files with 28 additions and 8 deletions

View File

@ -104,7 +104,8 @@ LLFolderViewItem::Params::Params()
item_height("item_height"),
item_top_pad("item_top_pad"),
creation_date(),
allow_wear("allow_wear", true),
allow_wear("allow_wear", true),
allow_drop("allow_drop", true),
font_color("font_color"),
font_highlight_color("font_highlight_color"),
left_pad("left_pad", 0),
@ -138,6 +139,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mViewModelItem(p.listener),
mIsMouseOverTitle(false),
mAllowWear(p.allow_wear),
mAllowDrop(p.allow_drop),
mFontColor(p.font_color),
mFontHighlightColor(p.font_highlight_color),
mLeftPad(p.left_pad),
@ -1782,9 +1784,16 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask,
EAcceptance* accept,
std::string& tooltip_msg)
{
if (!mAllowDrop)
{
*accept = ACCEPT_NO;
tooltip_msg = LLTrans::getString("TooltipOutboxCannotDropOnRoot");
return TRUE;
}
BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg);
if (accepted)
if (accepted)
{
mDragAndDropTarget = TRUE;
*accept = ACCEPT_YES_MULTI;

View File

@ -60,6 +60,7 @@ public:
Optional<time_t> creation_date;
Optional<bool> allow_wear;
Optional<bool> allow_drop;
Optional<LLUIColor> font_color;
Optional<LLUIColor> font_highlight_color;
@ -118,6 +119,7 @@ protected:
mDragAndDropTarget,
mIsMouseOverTitle,
mAllowWear,
mAllowDrop,
mSelectPending;
LLUIColor mFontColor;

View File

@ -191,6 +191,7 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
p.show_empty_message = mShowEmptyMessage;
p.show_item_link_overlays = mShowItemLinkOverlays;
p.root = NULL;
p.allow_drop = mParams.allow_drop_on_root;
p.options_menu = "menu_inventory.xml";
return LLUICtrlFactory::create<LLFolderView>(p);
@ -744,7 +745,7 @@ void LLInventoryPanel::initializeViews()
}
LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge)
LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop)
{
LLFolderViewFolder::Params params(mParams.folder);
@ -752,6 +753,7 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br
params.root = mFolderRoot.get();
params.listener = bridge;
params.tool_tip = params.name;
params.allow_drop = allow_drop;
params.font_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultColor));
params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultHighlightColor));
@ -788,6 +790,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)getItemByID(parent_id);
// Force the creation of an extra root level folder item if required by the inventory panel (default is "false")
bool allow_drop = true;
if (mParams.show_root_folder)
{
LLUUID root_id = getRootFolderID();
@ -796,6 +799,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
// We insert an extra level that's seen by the UI but has no influence on the model
parent_folder = dynamic_cast<LLFolderViewFolder*>(folder_view_item);
folder_view_item = NULL;
allow_drop = mParams.allow_drop_on_root;
}
}
@ -822,7 +826,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
objectp->getUUID());
if (new_listener)
{
folder_view_item = createFolderViewFolder(new_listener);
folder_view_item = createFolderViewFolder(new_listener,allow_drop);
}
}
else
@ -958,7 +962,7 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
// If folder view is empty the (x, y) point won't be in its rect
// so the handler must be called explicitly.
// but only if was not handled before. See EXT-6746.
if (!handled && !mFolderRoot.get()->hasVisibleChildren())
if (!handled && mParams.allow_drop_on_root && !mFolderRoot.get()->hasVisibleChildren())
{
handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
}

View File

@ -97,6 +97,7 @@ public:
Optional<bool> use_label_suffix;
Optional<bool> show_empty_message;
Optional<bool> show_root_folder;
Optional<bool> allow_drop_on_root;
Optional<LLScrollContainer::Params> scroll;
Optional<bool> accepts_drag_and_drop;
Optional<LLFolderView::Params> folder_view;
@ -113,6 +114,7 @@ public:
use_label_suffix("use_label_suffix", true),
show_empty_message("show_empty_message", true),
show_root_folder("show_root_folder", false),
allow_drop_on_root("allow_drop_on_root", true),
scroll("scroll"),
accepts_drag_and_drop("accepts_drag_and_drop"),
folder_view("folder_view"),
@ -292,7 +294,7 @@ protected:
BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const;
virtual LLFolderView * createFolderRoot(LLUUID root_id );
virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge);
virtual LLFolderViewFolder* createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop = true);
virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge);
private:
bool mBuildDefaultHierarchy; // default inventory hierarchy should be created in postBuild()

View File

@ -124,7 +124,7 @@ void log_SLM_infos(const std::string& request, const std::string& url, const std
// Merov: This is a temporary hack used by dev while secondlife-staging is down...
// *TODO : Suppress that before shipping!
static bool sBypassMerchant = false;
static bool sBypassMerchant = true;
class LLSLMGetMerchantResponder : public LLHTTPClient::Responder
{

View File

@ -111,6 +111,7 @@
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
allow_drop_on_root="false"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
@ -133,6 +134,7 @@
show_empty_message="false"
show_load_status="false"
show_root_folder="true"
allow_drop_on_root="false"
start_folder.type="merchant"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"

View File

@ -245,6 +245,7 @@ Please try logging in again in a minute.</string>
<string name="TooltipOutboxTooManyFolders">Subfolders count exceeds [AMOUNT]</string>
<string name="TooltipOutboxTooManyObjects">Items count exceeds [AMOUNT]</string>
<string name="TooltipOutboxDragActive">You can't move an active listed listing</string>
<string name="TooltipOutboxCannotDropOnRoot">You can't drop items on filtered tabs root</string>
<string name="TooltipDragOntoOwnChild">You can't move a folder into its child</string>
<string name="TooltipDragOntoSelf">You can't move a folder into itself</string>