summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/llinventorybridge.cpp22
-rwxr-xr-xindra/newview/llinventorybridge.h1
-rwxr-xr-xindra/newview/llinventoryfunctions.cpp15
-rwxr-xr-xindra/newview/llinventorymodel.cpp4
4 files changed, 33 insertions, 9 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 5462b2bef4..68418063e7 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1186,6 +1186,22 @@ void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
}
}
+void LLInvFVBridge::removeObject(LLInventoryModel *model, const LLUUID &uuid)
+{
+ // Keep track of the parent
+ LLInventoryItem* itemp = model->getItem(uuid);
+ LLUUID parent_id = (itemp ? itemp->getParentUUID() : LLUUID::null);
+ // Remove the object
+ model->removeObject(uuid);
+ // Get the parent updated
+ if (parent_id.notNull())
+ {
+ LLViewerInventoryCategory* parent_cat = model->getCategory(parent_id);
+ model->updateCategory(parent_cat);
+ model->notifyObservers();
+ }
+}
+
bool LLInvFVBridge::canShare() const
{
bool can_share = false;
@@ -1406,7 +1422,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
else if ("cut" == action)
{
cutToClipboard();
- gInventory.removeObject(mUUID);
+ removeObject(model, mUUID);
return;
}
else if ("copy" == action)
@@ -1973,7 +1989,7 @@ std::string LLFolderBridge::getLabelSuffix() const
}
else if (getCategory()->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)
{
- llinfos << "Merov : in merchant folder and is a stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl;
+ //llinfos << "Merov : getLabelSuffix : stock folder : name = " << getCategory()->getName() << ", stock = " << getCategory()->getDescendentCount() << llendl;
std::string stock = llformat("%d", getCategory()->getDescendentCount());
std::string suffix = " (" + LLTrans::getString("MarketplaceStock") + ") (" + stock + ")";
return LLInvFVBridge::getLabelSuffix() + suffix;
@@ -3026,7 +3042,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
else if ("cut" == action)
{
cutToClipboard();
- gInventory.removeObject(mUUID);
+ removeObject(model, mUUID);
return;
}
else if ("copy" == action)
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 26c48fdc57..2c0b620395 100755
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -184,6 +184,7 @@ protected:
mutable std::string mSearchableName;
void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
+ void removeObject(LLInventoryModel *model, const LLUUID &uuid);
virtual void buildDisplayName() const {}
};
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 8216830336..aef05fead5 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -90,6 +90,14 @@
BOOL LLInventoryState::sWearNewClothing = FALSE;
LLUUID LLInventoryState::sWearNewClothingTransactionID;
+// Helper function : callback to update a folder after inventory action happened in the background
+void update_folder_cb(const LLUUID& dest_folder)
+{
+ LLViewerInventoryCategory* dest_cat = gInventory.getCategory(dest_folder);
+ gInventory.updateCategory(dest_cat);
+ gInventory.notifyObservers();
+}
+
// Generates a string containing the path to the item specified by
// item_id.
void append_path(const LLUUID& id, std::string& path)
@@ -163,13 +171,14 @@ void copy_inventory_category(LLInventoryModel* model,
for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
{
LLInventoryItem* item = *iter;
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid));
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
new_cat_uuid,
std::string(),
- LLPointer<LLInventoryCallback>(NULL));
+ cb);
}
// Copy all the folders
@@ -746,14 +755,14 @@ void move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
if (copy)
{
// Copy the item
+ LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, dest_folder));
copy_inventory_item(
gAgent.getID(),
viewer_inv_item->getPermissions().getOwner(),
viewer_inv_item->getUUID(),
dest_folder,
std::string(),
- LLPointer<LLInventoryCallback>(NULL));
-
+ cb);
}
else
{
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index afddde02a4..269542d383 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1056,11 +1056,9 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
const LLUUID marketplace_id = findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
if (marketplace_id.notNull() && isObjectDescendentOf(cat->getUUID(), marketplace_id))
{
- // *TODO : Need some internal analysis to be less brutal with updates
mask |= LLInventoryObserver::LABEL;
- mask |= LLInventoryObserver::STRUCTURE;
- mask |= LLInventoryObserver::INTERNAL;
}
+ llinfos << "Merov : updateCategory : " << cat->getName() << llendl;
old_cat->copyViewerCategory(cat);
addChangedMask(mask, cat->getUUID());
}