From dcd1b45d2e25a68c2e3f2d199d204b669891244d Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 28 Apr 2017 15:39:04 +0300 Subject: MAINT-7354 Trash alert should display trash, not prompt to purge it all --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterpreviewtrash.cpp | 76 +++++++++++++++++ indra/newview/llfloaterpreviewtrash.h | 48 +++++++++++ indra/newview/llinventorymodel.cpp | 16 +++- indra/newview/llinventorymodel.h | 1 + indra/newview/llviewerfloaterreg.cpp | 2 + .../skins/default/xui/en/floater_preview_trash.xml | 94 ++++++++++++++++++++++ .../newview/skins/default/xui/en/notifications.xml | 2 +- 8 files changed, 237 insertions(+), 4 deletions(-) create mode 100644 indra/newview/llfloaterpreviewtrash.cpp create mode 100644 indra/newview/llfloaterpreviewtrash.h create mode 100644 indra/newview/skins/default/xui/en/floater_preview_trash.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 7ed18801cf..4241ede365 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -276,6 +276,7 @@ set(viewer_SOURCE_FILES llfloaterperms.cpp llfloaterpostprocess.cpp llfloaterpreference.cpp + llfloaterpreviewtrash.cpp llfloaterproperties.cpp llfloaterregiondebugconsole.cpp llfloaterregioninfo.cpp @@ -897,6 +898,7 @@ set(viewer_HEADER_FILES llfloaterperms.h llfloaterpostprocess.h llfloaterpreference.h + llfloaterpreviewtrash.h llfloaterproperties.h llfloaterregiondebugconsole.h llfloaterregioninfo.h diff --git a/indra/newview/llfloaterpreviewtrash.cpp b/indra/newview/llfloaterpreviewtrash.cpp new file mode 100644 index 0000000000..084e914c9e --- /dev/null +++ b/indra/newview/llfloaterpreviewtrash.cpp @@ -0,0 +1,76 @@ +/** + * @file llfloaterpreviewtrash.cpp + * @author AndreyK Productengine + * @brief LLFloaterPreviewTrash class implementation + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterpreviewtrash.h" + +#include "llinventoryfunctions.h" +#include "llfloaterreg.h" + +LLFloaterPreviewTrash::LLFloaterPreviewTrash(const LLSD& key) +: LLFloater(key) +{ +} + +BOOL LLFloaterPreviewTrash::postBuild() +{ + getChild("empty_btn")->setCommitCallback( + boost::bind(&LLFloaterPreviewTrash::onClickEmpty, this)); + getChild("cancel_btn")->setCommitCallback( + boost::bind(&LLFloaterPreviewTrash::onClickCancel, this)); + // Always center the dialog. User can change the size, + // but purchases are important and should be center screen. + // This also avoids problems where the user resizes the application window + // mid-session and the saved rect is off-center. + center(); + + return TRUE; +} + +LLFloaterPreviewTrash::~LLFloaterPreviewTrash() +{ +} + + +// static +void LLFloaterPreviewTrash::show() +{ + LLFloaterReg::showTypedInstance("preview_trash"); +} + + +void LLFloaterPreviewTrash::onClickEmpty() +{ + gInventory.emptyFolderType("", LLFolderType::FT_TRASH); + closeFloater(); +} + +void LLFloaterPreviewTrash::onClickCancel() +{ + closeFloater(); +} diff --git a/indra/newview/llfloaterpreviewtrash.h b/indra/newview/llfloaterpreviewtrash.h new file mode 100644 index 0000000000..6fc0fe6928 --- /dev/null +++ b/indra/newview/llfloaterpreviewtrash.h @@ -0,0 +1,48 @@ +/** + * @file llfloaterpreviewtrash.h + * @author AndreyK Productengine + * @brief LLFloaterPreviewTrash class header file + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERPREVIEWTRASH_H +#define LL_LLFLOATERPREVIEWTRASH_H + +#include "llfloater.h" + +class LLFloaterPreviewTrash +: public LLFloater +{ +public: + static void show(); + + LLFloaterPreviewTrash(const LLSD& key); + ~LLFloaterPreviewTrash(); + /*virtual*/ BOOL postBuild(); + +protected: + void onClickEmpty(); + void onClickCancel(); +}; + +#endif diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 855f7c750e..8a605ff574 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -41,6 +41,7 @@ #include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" +#include "llfloaterpreviewtrash.h" #include "llnotificationsutil.h" #include "llmarketplacefunctions.h" #include "llwindow.h" @@ -3299,9 +3300,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) } //---------------------------------------------------------------------------- - // Trash: LLFolderType::FT_TRASH, "ConfirmEmptyTrash" -// Trash: LLFolderType::FT_TRASH, "TrashIsFull" when trash exceeds maximum capacity // Lost&Found: LLFolderType::FT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound" bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type) @@ -3415,13 +3414,24 @@ void LLInventoryModel::removeObject(const LLUUID& object_id) } } +bool callback_preview_trash_folder(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) // YES + { + LLFloaterPreviewTrash::show(); + } + return false; +} + void LLInventoryModel::checkTrashOverflow() { static const U32 trash_max_capacity = gSavedSettings.getU32("InventoryTrashMaxCapacity"); const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); if (getDescendentsCountRecursive(trash_id, trash_max_capacity) >= trash_max_capacity) { - gInventory.emptyFolderType("TrashIsFull", LLFolderType::FT_TRASH); + LLNotificationsUtil::add("TrashIsFull", LLSD(), LLSD(), + boost::bind(callback_preview_trash_folder, _1, _2)); } } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index dee1769172..c558c0803b 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -411,6 +411,7 @@ public: /// removeItem() or removeCategory(), whichever is appropriate void removeObject(const LLUUID& object_id); + // "TrashIsFull" when trash exceeds maximum capacity void checkTrashOverflow(); protected: diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index cf18299b0b..4c146679db 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -103,6 +103,7 @@ #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterpreviewtrash.h" #include "llfloaterproperties.h" #include "llfloaterregiondebugconsole.h" #include "llfloaterregioninfo.h" @@ -307,6 +308,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_preview_trash.xml b/indra/newview/skins/default/xui/en/floater_preview_trash.xml new file mode 100644 index 0000000000..9e50e89ac9 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_preview_trash.xml @@ -0,0 +1,94 @@ + + + + + + + + + +