From d37c294bd38bf4cae251c33f863e4e6e66ef44db Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 30 Jul 2014 20:51:18 -0700 Subject: 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. --- indra/llui/llfolderviewitem.cpp | 15 ++++++++++++--- indra/llui/llfolderviewitem.h | 2 ++ indra/newview/llinventorypanel.cpp | 10 +++++++--- indra/newview/llinventorypanel.h | 4 +++- indra/newview/llmarketplacefunctions.cpp | 2 +- .../skins/default/xui/en/panel_marketplace_listings.xml | 2 ++ indra/newview/skins/default/xui/en/strings.xml | 1 + 7 files changed, 28 insertions(+), 8 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 42116251fb..942dd76af9 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -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; diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 12fba4f9b1..ffeaf0d1b7 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -60,6 +60,7 @@ public: Optional creation_date; Optional allow_wear; + Optional allow_drop; Optional font_color; Optional font_highlight_color; @@ -118,6 +119,7 @@ protected: mDragAndDropTarget, mIsMouseOverTitle, mAllowWear, + mAllowDrop, mSelectPending; LLUIColor mFontColor; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 4bfac96a11..3b18b86f57 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -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(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(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); } diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index e0b39caa6e..b8dab65b2d 100755 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -97,6 +97,7 @@ public: Optional use_label_suffix; Optional show_empty_message; Optional show_root_folder; + Optional allow_drop_on_root; Optional scroll; Optional accepts_drag_and_drop; Optional 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() diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index b37ae30021..c2b4f34ac2 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -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 { diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml index 3d75ad4488..4a2d9f27e0 100755 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings.xml @@ -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" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index aa66fc4718..21c82b6290 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -245,6 +245,7 @@ Please try logging in again in a minute. Subfolders count exceeds [AMOUNT] Items count exceeds [AMOUNT] You can't move an active listed listing + You can't drop items on filtered tabs root You can't move a folder into its child You can't move a folder into itself -- cgit v1.2.3