FIRE-17695 - Bulk delete links capability
parent
ee8f310d34
commit
7fa791280a
|
|
@ -52,12 +52,16 @@ LLFloaterLinkReplace::~LLFloaterLinkReplace()
|
|||
|
||||
BOOL LLFloaterLinkReplace::postBuild()
|
||||
{
|
||||
childSetVisible("delete_text", false); // <FS:Beq> FIRE-17695 - Delete links capability
|
||||
mStartBtn = getChild<LLButton>("btn_start");
|
||||
mStartBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::onStartClicked, this));
|
||||
|
||||
mRefreshBtn = getChild<LLButton>("btn_refresh");
|
||||
mRefreshBtn->setCommitCallback(boost::bind(&LLFloaterLinkReplace::checkEnableStart, this));
|
||||
|
||||
// <FS:Beq> FIRE-17695 - Delete links capability
|
||||
mDeleteOnlyToggle = getChild<LLCheckBoxCtrl>("delete_links_only");
|
||||
mDeleteOnlyToggle->setCommitCallback(boost::bind(&LLFloaterLinkReplace::onDeleteOnlyToggle, this));
|
||||
// </FS:Beq>
|
||||
mSourceEditor = getChild<LLInventoryLinkReplaceDropTarget>("source_uuid_editor");
|
||||
mTargetEditor = getChild<LLInventoryLinkReplaceDropTarget>("target_uuid_editor");
|
||||
|
||||
|
|
@ -92,10 +96,38 @@ void LLFloaterLinkReplace::onSourceItemDrop(const LLUUID& source_item_id)
|
|||
|
||||
void LLFloaterLinkReplace::onTargetItemDrop(const LLUUID& target_item_id)
|
||||
{
|
||||
mTargetUUID = target_item_id;
|
||||
// <FS:Beq> FIRE-17695 - option to bulk delete links.
|
||||
//mTargetUUID = target_item_id;
|
||||
//checkEnableStart();
|
||||
if (!mDeleteOnly)
|
||||
{
|
||||
mTargetUUID = target_item_id;
|
||||
checkEnableStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
mTargetEditor->setItem(nullptr);
|
||||
mTargetEditor->setText(getString("DeleteNotReplace"));
|
||||
mTargetUUID = LLUUID::null;
|
||||
}
|
||||
// </FS:Beq>
|
||||
}
|
||||
// <FS:Beq> FIRE-17695 - Delete links capability
|
||||
void LLFloaterLinkReplace::onDeleteOnlyToggle()
|
||||
{
|
||||
auto enabled = mDeleteOnlyToggle->getValue().asBoolean();
|
||||
mTargetEditor->setEnabled(!enabled);
|
||||
mTargetEditor->setVisible(!enabled);
|
||||
childSetVisible("target_label", !enabled);
|
||||
childSetVisible("delete_text", enabled);
|
||||
mDeleteOnly = enabled;
|
||||
if (mDeleteOnly){
|
||||
mTargetEditor->setItem(nullptr);
|
||||
mTargetUUID = LLUUID::null;
|
||||
}
|
||||
checkEnableStart();
|
||||
}
|
||||
|
||||
// </FS:Beq>
|
||||
void LLFloaterLinkReplace::updateFoundLinks()
|
||||
{
|
||||
LLInventoryModel::item_array_t items;
|
||||
|
|
@ -123,20 +155,36 @@ void LLFloaterLinkReplace::checkEnableStart()
|
|||
{
|
||||
updateFoundLinks();
|
||||
}
|
||||
// <FS:Beq> FIRE-17695 - Delete links capability
|
||||
// mStartBtn->setEnabled(mRemainingItems > 0 && mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID != mTargetUUID);
|
||||
auto enable=bool{ mRemainingItems > 0 && (
|
||||
(mDeleteOnly && mSourceUUID.notNull() ) ||
|
||||
(mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID != mTargetUUID)) };
|
||||
|
||||
mStartBtn->setEnabled(mRemainingItems > 0 && mSourceUUID.notNull() && mTargetUUID.notNull() && mSourceUUID != mTargetUUID);
|
||||
mStartBtn->setEnabled(enable);
|
||||
// </FS:Beq>
|
||||
}
|
||||
|
||||
void LLFloaterLinkReplace::onStartClicked()
|
||||
{
|
||||
LL_INFOS() << "Starting inventory link replace" << LL_ENDL;
|
||||
|
||||
if (mSourceUUID.isNull() || mTargetUUID.isNull())
|
||||
// <FS:Beq> FIRE-17695 - option to bulk delete links.
|
||||
// if (mSourceUUID.isNull() || mTargetUUID.isNull())
|
||||
if (!mDeleteOnly && (mSourceUUID.isNull() || mTargetUUID.isNull()))
|
||||
// </FS:Beq>
|
||||
{
|
||||
LL_WARNS() << "Cannot replace. Either source or target UUID is null." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
// <FS:Beq> FIRE-17695 - option to bulk delete links.
|
||||
if (!mDeleteOnly && mSourceUUID.isNull())
|
||||
{
|
||||
LL_WARNS() << "Cannot delete links. Source UUID is null." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
// </FS:Beq>
|
||||
|
||||
if (mSourceUUID == mTargetUUID)
|
||||
{
|
||||
LL_WARNS() << "Cannot replace. Source and target are identical." << LL_ENDL;
|
||||
|
|
@ -154,8 +202,29 @@ void LLFloaterLinkReplace::onStartClicked()
|
|||
|
||||
if (mRemainingInventoryItems.size() > 0)
|
||||
{
|
||||
// <FS:Beq> FIRE-17695 - option to bulk delete links.
|
||||
// LLViewerInventoryItem* target_item = gInventory.getItem(mTargetUUID);
|
||||
//if (target_item)
|
||||
//{
|
||||
// mRemainingItems = (U32)mRemainingInventoryItems.size();
|
||||
|
||||
// LLStringUtil::format_map_t args;
|
||||
// args["NUM"] = llformat("%d", mRemainingItems);
|
||||
// mStatusText->setText(getString("ItemsRemaining", args));
|
||||
|
||||
// mStartBtn->setEnabled(FALSE);
|
||||
// mRefreshBtn->setEnabled(FALSE);
|
||||
|
||||
// mEventTimer.start();
|
||||
// tick();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// mStatusText->setText(getString("TargetNotFound"));
|
||||
// LL_WARNS() << "Link replace target not found." << LL_ENDL;
|
||||
//}
|
||||
LLViewerInventoryItem* target_item = gInventory.getItem(mTargetUUID);
|
||||
if (target_item)
|
||||
if (target_item || mDeleteOnly)
|
||||
{
|
||||
mRemainingItems = (U32)mRemainingInventoryItems.size();
|
||||
|
||||
|
|
@ -174,6 +243,7 @@ void LLFloaterLinkReplace::onStartClicked()
|
|||
mStatusText->setText(getString("TargetNotFound"));
|
||||
LL_WARNS() << "Link replace target not found." << LL_ENDL;
|
||||
}
|
||||
// </FS:Beq>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -307,26 +377,63 @@ void LLFloaterLinkReplace::processBatch(LLInventoryModel::item_array_t items)
|
|||
|
||||
if (source_item->getParentUUID() != cof_folder_id)
|
||||
{
|
||||
// <FS:Beq> FIRE-17695 bulk delete unwanted links
|
||||
//bool is_outfit_folder = gInventory.isObjectDescendentOf(source_item->getParentUUID(), outfit_folder_id);
|
||||
//// If either the new or old item in the COF is a wearable, we need to update wearable ordering after the link has been replaced
|
||||
//bool needs_wearable_ordering_update = (is_outfit_folder && source_item->getType() == LLAssetType::AT_CLOTHING) || target_item->getType() == LLAssetType::AT_CLOTHING;
|
||||
//// Other items in the COF need a description update (description of the actual link item must be empty)
|
||||
//bool needs_description_update = is_outfit_folder && target_item->getType() != LLAssetType::AT_CLOTHING;
|
||||
|
||||
//LL_DEBUGS() << "is_outfit_folder = " << (is_outfit_folder ? "true" : "false") << LL_NEWLINE
|
||||
// << "needs_wearable_ordering_update = " << (needs_wearable_ordering_update ? "true" : "false") << LL_NEWLINE
|
||||
// << "needs_description_update = " << (needs_description_update ? "true" : "false") << LL_ENDL;
|
||||
|
||||
//LLInventoryObject::const_object_list_t obj_array;
|
||||
//obj_array.push_back(LLConstPointer<LLInventoryObject>(target_item));
|
||||
//LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::linkCreatedCallback,
|
||||
// getDerivedHandle<LLFloaterLinkReplace>(),
|
||||
// source_item->getUUID(),
|
||||
// target_item->getUUID(),
|
||||
// needs_wearable_ordering_update,
|
||||
// needs_description_update,
|
||||
// (is_outfit_folder ? source_item->getParentUUID() : LLUUID::null) ));
|
||||
//link_inventory_array(source_item->getParentUUID(), obj_array, cb);
|
||||
|
||||
bool is_outfit_folder = gInventory.isObjectDescendentOf(source_item->getParentUUID(), outfit_folder_id);
|
||||
// If either the new or old item in the COF is a wearable, we need to update wearable ordering after the link has been replaced
|
||||
bool needs_wearable_ordering_update = (is_outfit_folder && source_item->getType() == LLAssetType::AT_CLOTHING) || target_item->getType() == LLAssetType::AT_CLOTHING;
|
||||
bool needs_wearable_ordering_update = (is_outfit_folder && source_item->getType() == LLAssetType::AT_CLOTHING) || (!mDeleteOnly && target_item->getType() == LLAssetType::AT_CLOTHING);
|
||||
// Other items in the COF need a description update (description of the actual link item must be empty)
|
||||
bool needs_description_update = is_outfit_folder && target_item->getType() != LLAssetType::AT_CLOTHING;
|
||||
bool needs_description_update = !mDeleteOnly && is_outfit_folder && target_item->getType() != LLAssetType::AT_CLOTHING;
|
||||
|
||||
LL_DEBUGS() << "is_outfit_folder = " << (is_outfit_folder ? "true" : "false") << LL_NEWLINE
|
||||
<< "needs_wearable_ordering_update = " << (needs_wearable_ordering_update ? "true" : "false") << LL_NEWLINE
|
||||
<< "needs_description_update = " << (needs_description_update ? "true" : "false") << LL_ENDL;
|
||||
|
||||
LLInventoryObject::const_object_list_t obj_array;
|
||||
obj_array.push_back(LLConstPointer<LLInventoryObject>(target_item));
|
||||
LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::linkCreatedCallback,
|
||||
getDerivedHandle<LLFloaterLinkReplace>(),
|
||||
source_item->getUUID(),
|
||||
target_item->getUUID(),
|
||||
needs_wearable_ordering_update,
|
||||
needs_description_update,
|
||||
(is_outfit_folder ? source_item->getParentUUID() : LLUUID::null) ));
|
||||
link_inventory_array(source_item->getParentUUID(), obj_array, cb);
|
||||
if (!mDeleteOnly)
|
||||
{
|
||||
LLInventoryObject::const_object_list_t obj_array;
|
||||
obj_array.push_back(LLConstPointer<LLInventoryObject>(target_item));
|
||||
LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::linkCreatedCallback,
|
||||
getDerivedHandle<LLFloaterLinkReplace>(),
|
||||
source_item->getUUID(),
|
||||
target_item->getUUID(),
|
||||
needs_wearable_ordering_update,
|
||||
needs_description_update,
|
||||
(is_outfit_folder ? source_item->getParentUUID() : LLUUID::null)));
|
||||
link_inventory_array(source_item->getParentUUID(), obj_array, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID outfit_update_folder_id = LLUUID::null;
|
||||
if (needs_wearable_ordering_update)
|
||||
{
|
||||
outfit_update_folder_id = outfit_folder_id;
|
||||
}
|
||||
LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&LLFloaterLinkReplace::itemRemovedCallback, getDerivedHandle<LLFloaterLinkReplace>(), outfit_update_folder_id));
|
||||
remove_inventory_object(source_item->getUUID(), cb);
|
||||
LL_INFOS() << "Requested delete of " << source_item->getUUID() << LL_ENDL;
|
||||
}
|
||||
// </FS:Beq>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "lllineeditor.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llviewerinventory.h"
|
||||
#include "llcheckboxctrl.h" // <FS:Beq> FIRE-17695 - Delete links capability
|
||||
|
||||
class LLButton;
|
||||
class LLTextBox;
|
||||
|
|
@ -104,12 +105,14 @@ private:
|
|||
|
||||
void onSourceItemDrop(const LLUUID& source_item_id);
|
||||
void onTargetItemDrop(const LLUUID& target_item_id);
|
||||
void onDeleteOnlyToggle();// <FS:Beq> FIRE-17695 - Delete links capability
|
||||
|
||||
LLInventoryLinkReplaceDropTarget* mSourceEditor;
|
||||
LLInventoryLinkReplaceDropTarget* mTargetEditor;
|
||||
LLButton* mStartBtn;
|
||||
LLButton* mRefreshBtn;
|
||||
LLTextBox* mStatusText;
|
||||
LLCheckBoxCtrl* mDeleteOnlyToggle;// <FS:Beq> FIRE-17695 - Delete links capability
|
||||
|
||||
LLUUID mSourceUUID;
|
||||
LLUUID mTargetUUID;
|
||||
|
|
@ -117,6 +120,7 @@ private:
|
|||
U32 mBatchSize;
|
||||
|
||||
LLInventoryModel::item_array_t mRemainingInventoryItems;
|
||||
bool mDeleteOnly;// <FS:Beq> FIRE-17695 - Delete links capability
|
||||
};
|
||||
|
||||
#endif // LL_FLOATERLINKREPLACE_H
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
positioning="centered"
|
||||
title="Replace Inventory Links"
|
||||
width="333"
|
||||
height="130"
|
||||
height="150"
|
||||
save_rect="true"
|
||||
can_minimize="true"
|
||||
can_close="true">
|
||||
|
|
@ -27,6 +27,9 @@
|
|||
<string name="ReplaceFinished">
|
||||
Finished replacing inventory links.
|
||||
</string>
|
||||
<string name="DeleteNotReplace">
|
||||
No replacement.
|
||||
</string>
|
||||
<text
|
||||
type="string"
|
||||
follows="left|top"
|
||||
|
|
@ -49,6 +52,18 @@
|
|||
top_delta="-3"
|
||||
right="-10"
|
||||
tool_tip="Drag and drop the current inventory item here that should be replaced."/>
|
||||
<text
|
||||
type="string"
|
||||
follows="left|top"
|
||||
font="SanSerif"
|
||||
height="23"
|
||||
layout="topleft"
|
||||
top_pad="10"
|
||||
left="10"
|
||||
right="-10"
|
||||
name="delete_text">
|
||||
Links to this item will be removed.
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
follows="left|top"
|
||||
|
|
@ -58,7 +73,7 @@
|
|||
left="10"
|
||||
width="35"
|
||||
name="target_label"
|
||||
top_pad="10">
|
||||
top_delta="0">
|
||||
New:
|
||||
</text>
|
||||
<inventory_link_replace_drop_target
|
||||
|
|
@ -71,6 +86,16 @@
|
|||
top_delta="-3"
|
||||
right="-10"
|
||||
tool_tip="Drag and drop new inventory item here."/>
|
||||
<check_box
|
||||
follows="top|left"
|
||||
height="20"
|
||||
label="Delete links only"
|
||||
left="10"
|
||||
right="-10"
|
||||
layout="topleft"
|
||||
top_pad="10"
|
||||
control_name="DeleteLinksOnly"
|
||||
name="delete_links_only"/>
|
||||
<text
|
||||
type="string"
|
||||
follows="left|top|right"
|
||||
|
|
@ -78,7 +103,7 @@
|
|||
height="20"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
right="-10"
|
||||
right="-10"
|
||||
name="status_text"
|
||||
top_pad="10">
|
||||
Ready...
|
||||
|
|
|
|||
Loading…
Reference in New Issue