diff options
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterpreviewtrash.cpp | 76 | ||||
-rw-r--r-- | indra/newview/llfloaterpreviewtrash.h | 48 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preview_trash.xml | 94 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 2 |
8 files changed, 237 insertions, 4 deletions
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<LLUICtrl>("empty_btn")->setCommitCallback( + boost::bind(&LLFloaterPreviewTrash::onClickEmpty, this)); + getChild<LLUICtrl>("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<LLFloaterPreviewTrash>("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<LLLiveLSLEditor>, "preview"); LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewSound>, "preview"); LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewTexture>, "preview"); + LLFloaterReg::add("preview_trash", "floater_preview_trash.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreviewTrash>); LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterProperties>); LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPublishClassifiedFloater>); LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSavePrefPreset>); 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 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + can_resize="true" + height="330" + width="310" + layout="topleft" + min_height="200" + min_width="310" + name="floater_preview_trash" + save_rect="true" + title="TRASH" + single_instance="true" + reuse_instance="true" + can_minimize="false"> + <inventory_panel + name="inventory_outbox" + start_folder.name="Trash" + show_empty_message="false" + start_folder.type="trash" + follows="all" + layout="topleft" + top="18" left="7" height="280" width="296" + top_pad="0" + bg_opaque_color="DkGray2" + bg_alpha_color="DkGray2" + background_visible="true" + border="false" + bevel_style="none" + scroll.reserve_scroll_corner="false"> + <folder folder_arrow_image="Folder_Arrow" + folder_indentation="8" + item_height="20" + item_top_pad="4" + selection_image="Rounded_Square" + left_pad="5" + icon_pad="2" + icon_width="16" + text_pad="1" + text_pad_right="4" + arrow_size="12" + max_folder_item_overlap="2"/> + <item allow_wear="false"/> + </inventory_panel> + + <layout_stack follows="bottom|left|right" + height="23" + layout="topleft" + mouse_opaque="false" + name="button_panel_ls" + left="0" + orientation="horizontal" + top_pad="5" + width="310"> + <layout_panel follows="bottom|left|right" + height="23" + layout="bottomleft" + left="0" + mouse_opaque="false" + name="empty_btn_lp" + auto_resize="true" + width="155"> + <button enabled="true" + follows="bottom|left|right" + height="23" + label="Empty Trash" + layout="topleft" + left="30" + name="empty_btn" + top="0" + width="120" /> + </layout_panel> + <layout_panel + follows="bottom|left|right" + height="23" + layout="bottomleft" + left_pad="0" + mouse_opaque="false" + name="share_btn_lp" + auto_resize="true" + width="155"> + <button + enabled="true" + follows="bottom|left|right" + height="23" + label="Cancel" + layout="topleft" + left="5" + name="cancel_btn" + top="0" + width="120" /> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 5837b3f668..50fb8722de 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6197,7 +6197,7 @@ Your trash is overflowing. This may cause problems logging in. <usetemplate name="okcancelbuttons" notext="I will empty trash later" - yestext="Empty trash now"/> + yestext="Check trash folder"/> </notification> <notification |