diff --git a/doc/contributions.txt b/doc/contributions.txt index e4b24b3abeda29776a70469dad18e623c99e8e81..1d591e2ec2b88f4ac3c2f3420712c3b893daf639 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -822,6 +822,7 @@ Kitty Barnett MAINT-6153 MAINT-6154 MAINT-6568 + STORM-2149 Kolor Fall Komiko Okamoto Korvel Noh diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index f9664e0658549d35e4ec4c04b292c3b92b8c19f1..895753aeae6394edc6e1383db58065a2ae593873 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -102,6 +102,18 @@ void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder) void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) { } +//--------------------------------------------------------------------------- + +void LLAllDescendentsPassedFilter::doFolder(LLFolderViewFolder* folder) +{ + mAllDescendentsPassedFilter &= (folder) && (folder->passedFilter()) && (folder->descendantsPassedFilter()); +} + +void LLAllDescendentsPassedFilter::doItem(LLFolderViewItem* item) +{ + mAllDescendentsPassedFilter &= (item) && (item->passedFilter()); +} + ///---------------------------------------------------------------------------- /// Class LLFolderViewScrollContainer ///---------------------------------------------------------------------------- diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index b5deefd6537d3e7c70171974ed3e301df291c5f2..2926e160d02d595d63cd3c78db8d601279196fe7 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -400,6 +400,18 @@ public: virtual void doItem(LLFolderViewItem* item); }; +class LLAllDescendentsPassedFilter : public LLFolderViewFunctor +{ +public: + LLAllDescendentsPassedFilter() : mAllDescendentsPassedFilter(true) {} + /*virtual*/ ~LLAllDescendentsPassedFilter() {} + /*virtual*/ void doFolder(LLFolderViewFolder* folder); + /*virtual*/ void doItem(LLFolderViewItem* item); + bool allDescendentsPassedFilter() const { return mAllDescendentsPassedFilter; } +protected: + bool mAllDescendentsPassedFilter; +}; + // Flags for buildContextMenu() const U32 SUPPRESS_OPEN_ITEM = 0x1; const U32 FIRST_SELECTED_ITEM = 0x2; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 3d618548c4ffc1a8f5366f4ecfd1ac81a8ce84b7..0510e472c53da52dc8101da82ce3ecea17e01618 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1176,6 +1176,11 @@ BOOL LLFolderViewFolder::needsArrange() return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); } +bool LLFolderViewFolder::descendantsPassedFilter(S32 filter_generation) +{ + return getViewModelItem()->descendantsPassedFilter(filter_generation); +} + // Passes selection information on to children and record selection // information if necessary. BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index c364c4d5aee4b52d72372b929eb901f7c5953bfb..d40347de13b2d800bb6e96f1a5aeafb386d86f6c 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1798,6 +1798,12 @@ bool LLNotifications::getIgnoreAllNotifications() { return mIgnoreAllNotifications; } + +bool LLNotifications::getIgnored(const std::string& name) +{ + LLNotificationTemplatePtr templatep = getTemplate(name); + return (mIgnoreAllNotifications) || ( (templatep->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) && (templatep->mForm->getIgnored()) ); +} bool LLNotifications::isVisibleByRules(LLNotificationPtr n) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 4a701d0ca7cac066d1cdf38087220fcc1b5d39ff..a7a54904327bcb16663263e41ad5d4dee06a4f16 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -964,6 +964,8 @@ public: void setIgnoreAllNotifications(bool ignore); bool getIgnoreAllNotifications(); + bool getIgnored(const std::string& name); + bool isVisibleByRules(LLNotificationPtr pNotification); private: diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 2bb6fb853cef84a9797807e2511f3b1af91cccce..90d6e9b8a8866d98a70a65963ce86fbe59819d92 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2297,15 +2297,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root if ("delete" == action) { - LLSD args; - args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); static bool sDisplayedAtSession = false; - std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin(); - LLFolderViewModelItemInventory * viewModel = NULL; + bool has_folder_items = false; - for (; set_iter != selected_items.end(); ++set_iter) + for (std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) { - viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem()); + LLFolderViewModelItemInventory * viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem()); if (viewModel && viewModel->hasChildren()) { has_folder_items = true; @@ -2317,16 +2314,34 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root bool ignore = !(LLUI::sSettingGroups["ignores"]->getBOOL("DeleteItems")); if (ignore) { - if (!sDisplayedAtSession) { LLUI::sSettingGroups["ignores"]->setBOOL("DeleteItems", TRUE); sDisplayedAtSession = true; } - } } - LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); + + LLAllDescendentsPassedFilter f; + for (std::set<LLFolderViewItem*>::iterator it = selected_items.begin(); (it != selected_items.end()) && (f.allDescendentsPassedFilter()); ++it) + { + if (LLFolderViewFolder* folder = dynamic_cast<LLFolderViewFolder*>(*it)) + { + folder->applyFunctorRecursively(f); + } + } + + // Fall through to the generic confirmation if the user choose to ignore the specialized one + if ( (!f.allDescendentsPassedFilter()) && (!LLNotifications::instance().getIgnored("DeleteFilteredItems")) ) + { + LLNotificationsUtil::add("DeleteFilteredItems", LLSD(), LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); + } + else + { + LLSD args; + args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); + LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); + } // Note: marketplace listings will be updated in the callback if delete confirmed return; } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 16bf0e344de1cb9d13ce4862c46fea98c1fa7883..97f614cf6205700226e71a869a2a91f122730e68 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6010,6 +6010,22 @@ You cannot undo this action. notext="Cancel" yestext="OK"/> </notification> + + <notification + icon="alertmodal.tga" + name="DeleteFilteredItems" + type="alertmodal"> + <unique/> + Your inventory is currently filtered and not all of the items you're about to delete are currently visible. + +Are you sure you want to delete them? + <tag>confirm</tag> + <usetemplate + ignoretext="Confirm before deleting filtered items" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> <notification icon="alertmodal.tga"