diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-08-14 21:50:02 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-08-14 21:50:02 +0000 |
commit | 73caee4208a4e05f66583de099502012fd8415ea (patch) | |
tree | ff9fa1b7b010e71fb62f26a32c912b5e266f3b23 /indra/newview/llstartup.cpp | |
parent | 1db494f58ad378b8028c1f071196be82af5fe964 (diff) |
svn merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1331 https://svn.aws.productengine.com/secondlife/pe/stable-1@1340 -> viewer-2.0.0-3
EXT-269 EXT-274 EXT-276 EXT-277 EXT-282 EXT-296 EXT-342 EXT-370 EXT-379 EXT-394 EXT-398 EXT-405 EXT-407 EXT-410 EXT-413 EXT-414 EXT-450 EXT-456 EXT-477 EXT-482 EXT-496
Diffstat (limited to 'indra/newview/llstartup.cpp')
-rw-r--r-- | indra/newview/llstartup.cpp | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 993a092eba..1fc2245a8f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -314,6 +314,59 @@ void update_texture_fetch() static std::vector<std::string> sAuthUris; static S32 sAuthUriNum = -1; +//Copies landmarks from the "Library" to "My Favorites" +void populate_favorites_bar() +{ + //*TODO consider extending LLInventoryModel::findCategoryUUIDForType(...) to support both root's + LLInventoryModel::cat_array_t* lib_cats = NULL; + LLInventoryModel::item_array_t* lib_items = NULL; + gInventory.getDirectDescendentsOf(gInventory.getLibraryRootFolderID(), lib_cats, lib_items); + if (!lib_cats) return; + + LLUUID lib_landmarks(LLUUID::null); + S32 count = lib_cats->count(); + for(S32 i = 0; i < count; ++i) + { + if(lib_cats->get(i)->getPreferredType() == LLAssetType::AT_LANDMARK) + { + lib_landmarks = lib_cats->get(i)->getUUID(); + break; + } + } + if (lib_landmarks.isNull()) + { + llerror("Library inventory is missing Landmarks", 0); + return; + } + + LLInventoryModel::cat_array_t* lm_cats = NULL; + LLInventoryModel::item_array_t* lm_items = NULL; + gInventory.getDirectDescendentsOf(lib_landmarks, lm_cats, lm_items); + if (!lm_items) return; + + LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + if (favorites_id.isNull()) + { + llerror("My Inventory is missing My Favorites", 0); + return; + } + + S32 lm_count = lm_items->count(); + for (S32 i = 0; i < lm_count; ++i) + { + LLInventoryItem* item = lm_items->get(i); + if (item->getUUID().isNull()) continue; + + copy_inventory_item(gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + favorites_id, + std::string(), + LLPointer<LLInventoryCallback>(NULL)); + } +} + + // Returns false to skip other idle processing. Should only return // true when all initialization done. bool idle_startup() @@ -2085,7 +2138,7 @@ bool idle_startup() } - //all categories loaded. lets create "My Favourites" category + //all categories loaded. lets create "My Favorites" category gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE,true); gInventory.buildParentChildMap(); @@ -2120,6 +2173,12 @@ bool idle_startup() llinfos << "Creating Inventory Views" << llendl; LLFloaterReg::getInstance("inventory"); + //default initial content for Favorites Bar + if (gAgent.isFirstLogin()) + { + populate_favorites_bar(); + } + LLStartUp::setStartupState( STATE_MISC ); return FALSE; } |