From 2efa40fa6089dabbaccc228d331679c8c92f797f Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 21 Jul 2017 05:29:51 +0300 Subject: [PATCH 1/8] MAINT-7356 Logic fix and cleanup --- indra/llui/llnotifications.cpp | 6 +++++ indra/llui/llnotifications.h | 1 + indra/newview/llinventoryfunctions.cpp | 32 +++++--------------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index d40347de13..6710e9993d 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1799,6 +1799,12 @@ bool LLNotifications::getIgnoreAllNotifications() return mIgnoreAllNotifications; } +void LLNotifications::setIgnored(const std::string& name, bool ignored) +{ + LLNotificationTemplatePtr templatep = getTemplate(name); + templatep->mForm->setIgnored(ignored); +} + bool LLNotifications::getIgnored(const std::string& name) { LLNotificationTemplatePtr templatep = getTemplate(name); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index a7a5490432..b06d7cbf4c 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -964,6 +964,7 @@ public: void setIgnoreAllNotifications(bool ignore); bool getIgnoreAllNotifications(); + void setIgnored(const std::string& name, bool ignored); bool getIgnored(const std::string& name); bool isVisibleByRules(LLNotificationPtr pNotification); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 90d6e9b8a8..d282240bfb 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -92,8 +92,6 @@ BOOL LLInventoryState::sWearNewClothing = FALSE; LLUUID LLInventoryState::sWearNewClothingTransactionID; std::list LLInventoryAction::sMarketplaceFolders; -const int LLInventoryAction::sConfirmOnDeleteItemsNumber = 5; - // Helper function : callback to update a folder after inventory action happened in the background void update_folder_cb(const LLUUID& dest_folder) { @@ -2298,29 +2296,6 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root if ("delete" == action) { static bool sDisplayedAtSession = false; - - bool has_folder_items = false; - for (std::set::iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) - { - LLFolderViewModelItemInventory * viewModel = dynamic_cast((*set_iter)->getViewModelItem()); - if (viewModel && viewModel->hasChildren()) - { - has_folder_items = true; - break; - } - } - if (root->getSelectedCount() >= sConfirmOnDeleteItemsNumber || has_folder_items) - { - bool ignore = !(LLUI::sSettingGroups["ignores"]->getBOOL("DeleteItems")); - if (ignore) - { - if (!sDisplayedAtSession) - { - LLUI::sSettingGroups["ignores"]->setBOOL("DeleteItems", TRUE); - sDisplayedAtSession = true; - } - } - } LLAllDescendentsPassedFilter f; for (std::set::iterator it = selected_items.begin(); (it != selected_items.end()) && (f.allDescendentsPassedFilter()); ++it) @@ -2330,7 +2305,6 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root 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")) ) { @@ -2338,6 +2312,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root } else { + if (!sDisplayedAtSession) // ask for the confirmation at least once per session + { + LLNotifications::instance().setIgnored("DeleteItems", false); + sDisplayedAtSession = true; + } + LLSD args; args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem"); LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root->getHandle())); From dcb6a850aae7692f66ffe156637264b910007b14 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Tue, 25 Jul 2017 03:18:59 +0300 Subject: [PATCH 2/8] MAINT-7356 Improved the notification appearance --- indra/llui/llnotifications.cpp | 6 +++-- indra/llui/llnotifications.h | 4 +++- indra/newview/lltoastalertpanel.cpp | 4 ++++ .../skins/default/xui/en/notifications.xml | 24 +++++++++++++++---- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 6710e9993d..7bafd711cb 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -67,7 +67,8 @@ LLNotificationForm::FormIgnore::FormIgnore() : text("text"), control("control"), invert_control("invert_control", false), - save_option("save_option", false) + save_option("save_option", false), + session_only("session_only", false) {} LLNotificationForm::FormButton::FormButton() @@ -125,6 +126,7 @@ bool handleIgnoredNotification(const LLSD& payload) switch(form->getIgnoreType()) { case LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE: + case LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY: response = pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON); break; case LLNotificationForm::IGNORE_WITH_LAST_RESPONSE: @@ -197,7 +199,7 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica if (!p.ignore.save_option) { - mIgnore = IGNORE_WITH_DEFAULT_RESPONSE; + mIgnore = p.ignore.session_only ? IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY : IGNORE_WITH_DEFAULT_RESPONSE; } else { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index b06d7cbf4c..ccdfb90054 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -179,6 +179,7 @@ public: Optional save_option; Optional control; Optional invert_control; + Optional session_only; FormIgnore(); }; @@ -232,7 +233,8 @@ public: typedef enum e_ignore_type { IGNORE_NO, - IGNORE_WITH_DEFAULT_RESPONSE, + IGNORE_WITH_DEFAULT_RESPONSE, + IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY, IGNORE_WITH_LAST_RESPONSE, IGNORE_SHOW_AGAIN } EIgnoreType; diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index bbce717c20..dbf0893e43 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -351,6 +351,10 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal { setCheckBox(LLNotifications::instance().getGlobalString("skipnexttime"), ignore_label); } + if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY) + { + setCheckBox(LLNotifications::instance().getGlobalString("skipnexttimesessiononly"), ignore_label); + } else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) { setCheckBox(LLNotifications::instance().getGlobalString("alwayschoose"), ignore_label); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 71b0edb572..3ca7feae17 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4,6 +4,11 @@ Don't show me this again + + + Don't show me this again (for this session only) + + Always choose this option @@ -6004,11 +6009,20 @@ You cannot undo this action. [QUESTION] confirm - +
+ +