MAINT-7354 Trash alert should display trash, not prompt to purge it all

andreykproductengine 2017-04-28 15:39:04 +03:00
parent 0d5b835840
commit dcd1b45d2e
8 changed files with 237 additions and 4 deletions

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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));
}
}

View File

@ -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:

View File

@ -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>);

View File

@ -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>

View File

@ -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