void change_category_parent(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& new_parent_id, BOOL restamp) { if (!model || !cat) { return; } // Can't move a folder into a child of itself. if (model->isObjectDescendentOf(new_parent_id, cat->getUUID())) { return; } LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1); update.push_back(old_folder); LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); update.push_back(new_folder); model->accountForUpdate(update); LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat); new_cat->setParent(new_parent_id); new_cat->updateParentOnServer(restamp); model->updateCategory(new_cat); model->notifyObservers(); }
// static void LLPreview::onDiscardBtn(void* data) { LLPreview* self = (LLPreview*)data; const LLInventoryItem* item = self->getItem(); if (!item) return; self->mForceClose = TRUE; self->closeFloater(); // Move the item to the trash const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if (item->getParentUUID() != trash_id) { LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); update.push_back(old_folder); LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); update.push_back(new_folder); gInventory.accountForUpdate(update); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setParent(trash_id); // no need to restamp it though it's a move into trash because // it's a brand new item already. new_item->updateParentOnServer(FALSE); gInventory.updateItem(new_item); gInventory.notifyObservers(); } }
void change_item_parent(LLInventoryModel* model, LLViewerInventoryItem* item, const LLUUID& new_parent_id, BOOL restamp) { // <edit> bool send_parent_update = gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getRootFolderID()); // </edit> if(item->getParentUUID() != new_parent_id) { LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); update.push_back(old_folder); LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1); update.push_back(new_folder); gInventory.accountForUpdate(update); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setParent(new_parent_id); // <edit> if(send_parent_update) // </edit> new_item->updateParentOnServer(restamp); model->updateItem(new_item); model->notifyObservers(); } }
void LLFloaterLandmark::onBtnDelete() { LLViewerInventoryItem* item = gInventory.getItem(mImageAssetID); if(item) { // Move the item to the trash LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if (item->getParentUUID() != trash_id) { LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); update.push_back(old_folder); LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); update.push_back(new_folder); gInventory.accountForUpdate(update); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setParent(trash_id); // no need to restamp it though it's a move into trash because // it's a brand new item already. new_item->updateParentOnServer(FALSE); gInventory.updateItem(new_item); gInventory.notifyObservers(); } } }
EDL::EDL(EDL *parent_edl) : Indexable(0) { this->parent_edl = parent_edl; tracks = 0; labels = 0; local_session = 0; // vwindow_edl = 0; // vwindow_edl_shared = 0; folders.set_array_delete(); new_folder(CLIP_FOLDER); new_folder(MEDIA_FOLDER); id = next_id(); path[0] = 0; }
void LLPanelPlaces::onSaveButtonClicked() { if (!mLandmarkInfo || mItem.isNull()) return; std::string current_title_value = mLandmarkInfo->getLandmarkTitle(); std::string item_title_value = mItem->getName(); std::string current_notes_value = mLandmarkInfo->getLandmarkNotes(); std::string item_notes_value = mItem->getDescription(); LLStringUtil::trim(current_title_value); LLStringUtil::trim(current_notes_value); LLUUID item_id = mItem->getUUID(); LLUUID folder_id = mLandmarkInfo->getLandmarkFolder(); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem); if (!current_title_value.empty() && (item_title_value != current_title_value || item_notes_value != current_notes_value)) { new_item->rename(current_title_value); new_item->setDescription(current_notes_value); new_item->updateServer(FALSE); } if(folder_id != mItem->getParentUUID()) { LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(mItem->getParentUUID(),-1); update.push_back(old_folder); LLInventoryModel::LLCategoryUpdate new_folder(folder_id, 1); update.push_back(new_folder); gInventory.accountForUpdate(update); new_item->setParent(folder_id); new_item->updateParentOnServer(FALSE); } gInventory.updateItem(new_item); gInventory.notifyObservers(); onCancelButtonClicked(); }
void LLFloaterGesture::onDeleteSelected() { uuid_vec_t ids; getSelectedIds(ids); if(ids.empty()) return; const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); LLGestureMgr* gm = LLGestureMgr::getInstance(); for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) { const LLUUID& selected_item = *it; LLInventoryItem* inv_item = gInventory.getItem(selected_item); if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_GESTURE) { if(gm->isGestureActive(selected_item)) { gm->deactivateGesture(selected_item); } LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1); update.push_back(old_folder); LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); update.push_back(new_folder); gInventory.accountForUpdate(update); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); new_item->setParent(trash_id); // no need to restamp it though it's a move into trash because // it's a brand new item already. new_item->updateParentOnServer(FALSE); gInventory.updateItem(new_item); } } gInventory.notifyObservers(); buildGestureList(); }
int EDL::load_xml(FileXML *file, uint32_t load_flags) { int result = 0; // Track numbering offset for replacing undo data. int track_offset = 0; // Clear objects folders.remove_all_objects(); if((load_flags & LOAD_ALL) == LOAD_ALL) { remove_vwindow_edls(); } // Search for start of master EDL. // The parent_edl test caused clip creation to fail since those XML files // contained an EDL tag. // The parent_edl test is required to make EDL loading work because // when loading an EDL the EDL tag is already read by the parent. if(!parent_edl) { do{ result = file->read_tag(); }while(!result && !file->tag.title_is("XML") && !file->tag.title_is("EDL")); } if(!result) { // Get path for backups // path[0] = 0; file->tag.get_property("path", path); // Erase everything if((load_flags & LOAD_ALL) == LOAD_ALL || (load_flags & LOAD_EDITS) == LOAD_EDITS) { while(tracks->last) delete tracks->last; } if((load_flags & LOAD_ALL) == LOAD_ALL) { for(int i = 0; i < clips.size(); i++) clips.get(i)->Garbage::remove_user(); clips.remove_all(); } if(load_flags & LOAD_TIMEBAR) { while(labels->last) delete labels->last; local_session->unset_inpoint(); local_session->unset_outpoint(); } // This was originally in LocalSession::load_xml if(load_flags & LOAD_SESSION) { local_session->clipboard_length = 0; } do{ result = file->read_tag(); if(!result) { if(file->tag.title_is("/XML") || file->tag.title_is("/EDL") || file->tag.title_is("/CLIP_EDL") || file->tag.title_is("/VWINDOW_EDL")) { result = 1; } else if(file->tag.title_is("CLIPBOARD")) { local_session->clipboard_length = file->tag.get_property("LENGTH", (double)0); } else if(file->tag.title_is("VIDEO")) { if((load_flags & LOAD_VCONFIG) && (load_flags & LOAD_SESSION)) session->load_video_config(file, 0, load_flags); } else if(file->tag.title_is("AUDIO")) { if((load_flags & LOAD_ACONFIG) && (load_flags & LOAD_SESSION)) session->load_audio_config(file, 0, load_flags); } else if(file->tag.title_is("FOLDER")) { char folder[BCTEXTLEN]; strcpy(folder, file->read_text()); new_folder(folder); } else if(file->tag.title_is("ASSETS")) { if(load_flags & LOAD_ASSETS) assets->load(file, load_flags); } else if(file->tag.title_is(labels->xml_tag)) { if(load_flags & LOAD_TIMEBAR) labels->load(file, load_flags); } else if(file->tag.title_is("LOCALSESSION")) { if((load_flags & LOAD_SESSION) || (load_flags & LOAD_TIMEBAR)) local_session->load_xml(file, load_flags); } else if(file->tag.title_is("SESSION")) { if((load_flags & LOAD_SESSION) && !parent_edl) session->load_xml(file, 0, load_flags); } else if(file->tag.title_is("TRACK")) { tracks->load(file, track_offset, load_flags); } else // Sub EDL. // Causes clip creation to fail because that involves an opening EDL tag. if(file->tag.title_is("CLIP_EDL") && !parent_edl) { EDL *new_edl = new EDL(this); new_edl->create_objects(); new_edl->load_xml(file, LOAD_ALL); if((load_flags & LOAD_ALL) == LOAD_ALL) clips.append(new_edl); else new_edl->Garbage::remove_user(); } else if(file->tag.title_is("VWINDOW_EDL") && !parent_edl) { EDL *new_edl = new EDL(this); new_edl->create_objects(); new_edl->load_xml(file, LOAD_ALL); if((load_flags & LOAD_ALL) == LOAD_ALL) { // if(vwindow_edl && !vwindow_edl_shared) // vwindow_edl->Garbage::remove_user(); // vwindow_edl_shared = 0; // vwindow_edl = new_edl; append_vwindow_edl(new_edl, 0); } else // Discard if not replacing EDL { new_edl->Garbage::remove_user(); new_edl = 0; } } } }while(!result); } boundaries(); //dump(); return 0; }
// If we get back a normal response, handle it here. void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) { LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); if (content.has("folders")) { for(LLSD::array_const_iterator folder_it = content["folders"].beginArray(); folder_it != content["folders"].endArray(); ++folder_it) { LLSD folder_sd = *folder_it; //LLUUID agent_id = folder_sd["agent_id"]; //if(agent_id != gAgent.getID()) //This should never happen. //{ // llwarns << "Got a UpdateInventoryItem for the wrong agent." // << llendl; // break; //} LLUUID parent_id = folder_sd["folder_id"]; LLUUID owner_id = folder_sd["owner_id"]; S32 version = (S32)folder_sd["version"].asInteger(); S32 descendents = (S32)folder_sd["descendents"].asInteger(); LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id); if (parent_id.isNull()) { LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); item_it != folder_sd["items"].endArray(); ++item_it) { const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); if (lost_uuid.notNull()) { LLSD item = *item_it; titem->unpackMessage(item); LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1); update.push_back(new_folder); gInventory.accountForUpdate(update); titem->setParent(lost_uuid); titem->updateParentOnServer(FALSE); gInventory.updateItem(titem); gInventory.notifyObservers("fetchDescendents"); } } } LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id); if (!pcat) { continue; } for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray(); category_it != folder_sd["categories"].endArray(); ++category_it) { LLSD category = *category_it; tcategory->fromLLSD(category); const BOOL recursive = getIsRecursive(tcategory->getUUID()); if (recursive) { fetcher->mFetchQueue.push_back(LLInventoryModelBackgroundFetch::FetchQueueInfo(tcategory->getUUID(), recursive)); } else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) ) { gInventory.updateCategory(tcategory); } } LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray(); item_it != folder_sd["items"].endArray(); ++item_it) { LLSD item = *item_it; titem->unpackMessage(item); gInventory.updateItem(titem); } // Set version and descendentcount according to message. LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); if(cat) { cat->setVersion(version); cat->setDescendentCount(descendents); cat->determineFolderType(); } } } if (content.has("bad_folders")) { for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray(); folder_it != content["bad_folders"].endArray(); ++folder_it) { LLSD folder_sd = *folder_it; // These folders failed on the dataserver. We probably don't want to retry them. llinfos << "Folder " << folder_sd["folder_id"].asString() << "Error: " << folder_sd["error"].asString() << llendl; } } fetcher->incrBulkFetch(-1); if (fetcher->isBulkFetchProcessingComplete()) { llinfos << "Inventory fetch completed" << llendl; fetcher->setAllFoldersFetched(); } gInventory.notifyObservers("fetchDescendents"); }
CreateEntryResult RamFileSystem::create_folder(uint32_t folder_id, const std::string &name) { return add_entry(folder_id, name, new_folder(folder_id)); }