diff options
-rwxr-xr-x[-rw-r--r--] | indra/newview/llinventorybridge.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.cpp | 85 | ||||
-rwxr-xr-x | indra/newview/llinventorymodel.h | 11 | ||||
-rwxr-xr-x | indra/newview/llviewerinventory.cpp | 8 |
4 files changed, 96 insertions, 26 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 27f35c5946..abebd0aa5e 100644..100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1566,18 +1566,18 @@ void LLItemBridge::buildDisplayName() const else { mDisplayName.assign(LLStringUtil::null); -} - + } + mSearchableName.assign(mDisplayName); mSearchableName.append(getLabelSuffix()); LLStringUtil::toUpper(mSearchableName); - + //Name set, so trigger a sort if(mParent) -{ - mParent->requestSort(); - } + { + mParent->requestSort(); } +} LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const { @@ -1901,8 +1901,7 @@ void LLFolderBridge::update() possibly_has_children = true; } - bool loading = (possibly_has_children - && !up_to_date ); + bool loading = (possibly_has_children && !up_to_date ); if (loading != mIsLoading) { @@ -1929,12 +1928,13 @@ void LLFolderBridge::update() || (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && root_is_loading)) { + buildDisplayName(); mDisplayName = LLInvFVBridge::getDisplayName() + " ( " + LLTrans::getString("LoadingData") + " ) "; mIsLoading = true; } else { - mDisplayName = LLInvFVBridge::getDisplayName(); + buildDisplayName(); mIsLoading = false; } } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b49e617f62..fd57845c0e 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -48,6 +48,7 @@ #include "llcallbacklist.h" #include "llvoavatarself.h" #include "llgesturemgr.h" +#include "llsdutil.h" #include <typeinfo> //#define DIFF_INVENTORY_FILES @@ -1153,8 +1154,69 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, notifyObservers(); } +void parse_llsd_uuid_array(const LLSD& content, const std::string& name, uuid_vec_t& ids) +{ + ids.clear(); + if (content.has(name)) + { + for(LLSD::array_const_iterator it = content[name].beginArray(), + end = content[name].endArray(); + it != end; ++it) + { + ids.push_back((*it).asUUID()); + } + } +} + +void LLInventoryModel::onAISUpdateReceived(const std::string& context, const LLSD& update) +{ + llinfos << "ais update " << context << ":" << ll_pretty_print_sd(update) << llendl; + + uuid_vec_t cat_ids; + parse_llsd_uuid_array(update,"_categories_removed",cat_ids); + for (uuid_vec_t::const_iterator it = cat_ids.begin(); + it != cat_ids.end(); ++it) + { + llinfos << "remove category: " << *it << llendl; + onObjectDeletedFromServer(*it, false); + } + + uuid_vec_t item_ids; + parse_llsd_uuid_array(update,"_category_items_removed",item_ids); + for (uuid_vec_t::const_iterator it = item_ids.begin(); + it != item_ids.end(); ++it) + { + llinfos << "remove item: " << *it << llendl; + onObjectDeletedFromServer(*it, false); + } + + uuid_vec_t broken_link_ids; + parse_llsd_uuid_array(update,"_broken_links_removed",broken_link_ids); + for (uuid_vec_t::const_iterator it = broken_link_ids.begin(); + it != broken_link_ids.end(); ++it) + { + llinfos << "remove broken link: " << *it << llendl; + onObjectDeletedFromServer(*it, false); + } + + const std::string& ucv = "_updated_category_versions"; + if (update.has(ucv)) + { + for(LLSD::map_const_iterator it = update[ucv].beginMap(), + end = update[ucv].endMap(); + it != end; ++it) + { + const LLUUID id((*it).first); + S32 version = (*it).second.asInteger(); + llinfos << "update category: " << id << " to version " << version << llendl; + } + } + + +} + // Update model after descendents have been purged. -void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) +void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links) { LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id); if (cat.notNull()) @@ -1192,7 +1254,7 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) // of its deleted parent. if (getItem(uu_id)) { - deleteObject(uu_id); + deleteObject(uu_id, fix_broken_links); } } @@ -1216,7 +1278,7 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) cat_array_t* cat_list = getUnlockedCatArray(uu_id); if (!cat_list || (cat_list->size() == 0)) { - deleteObject(uu_id); + deleteObject(uu_id, fix_broken_links); deleted_count++; } } @@ -1235,24 +1297,30 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id) // Update model after an item is confirmed as removed from // server. Works for categories or items. -void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id) +void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool fix_broken_links) { LLPointer<LLInventoryObject> obj = getObject(object_id); if(obj) { + if (getCategory(object_id)) + { + // For category, need to delete/update all children first. + onDescendentsPurgedFromServer(object_id, fix_broken_links); + } + // From item/cat removeFromServer() LLInventoryModel::LLCategoryUpdate up(obj->getParentUUID(), -1); accountForUpdate(up); // From purgeObject() LLPreview::hide(object_id); - deleteObject(object_id); + deleteObject(object_id, fix_broken_links); } } // Delete a particular inventory object by ID. -void LLInventoryModel::deleteObject(const LLUUID& id) +void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links) { lldebugs << "LLInventoryModel::deleteObject()" << llendl; LLPointer<LLInventoryObject> obj = getObject(id); @@ -1303,10 +1371,11 @@ void LLInventoryModel::deleteObject(const LLUUID& id) addChangedMask(LLInventoryObserver::REMOVE, id); // Can't have links to links, so there's no need for this update - // if the item removed is a link. + // if the item removed is a link. Can also skip if source of the + // update is getting broken link info separately. bool is_link_type = obj->getIsLinkType(); obj = NULL; // delete obj - if (!is_link_type) + if (fix_broken_links && !is_link_type) { updateLinkedObjectsFromPurge(id); } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 2459f10a37..696d0a9163 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -328,19 +328,22 @@ public: // Delete //-------------------------------------------------------------------- public: - + + // Update model after an AISv3 update received for any operation. + void onAISUpdateReceived(const std::string& context, const LLSD& update); + // Update model after an item is confirmed as removed from // server. Works for categories or items. - void onObjectDeletedFromServer(const LLUUID& item_id); + void onObjectDeletedFromServer(const LLUUID& item_id, bool fix_broken_links = true); // Update model after all descendents removed from server. - void onDescendentsPurgedFromServer(const LLUUID& object_id); + void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true); // Delete a particular inventory object by ID. Will purge one // object from the internal data structures, maintaining a // consistent internal state. No cache accounting, observer // notification, or server update is performed. - void deleteObject(const LLUUID& id); + void deleteObject(const LLUUID& id, bool fix_broken_links = true); /// move Item item_id to Trash void removeItem(const LLUUID& item_id); /// move Category category_id to Trash diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index f9afdee4f9..5ffd560942 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1154,8 +1154,8 @@ public: failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - + gInventory.onAISUpdateReceived("removeObjectResponder " + mItemUUID.asString(), content); + // FIXME - not needed after AIS starts returning deleted item in its response. gInventory.onObjectDeletedFromServer(mItemUUID); if (mCallback) @@ -1335,9 +1335,7 @@ public: failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content); return; } - llinfos << "succeeded: " << ll_pretty_print_sd(content) << llendl; - - gInventory.onDescendentsPurgedFromServer(mItemUUID); + gInventory.onAISUpdateReceived("purgeDescendentsResponder " + mItemUUID.asString(), content); if (mCallback) { |