// static void LLLocalInventory::climb(LLInventoryCategory* cat, LLInventoryModel::cat_array_t& cats, LLInventoryModel::item_array_t& items) { LLInventoryModel* model = &gInventory; // Add this category cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)cat)); LLInventoryModel::cat_array_t *direct_cats; LLInventoryModel::item_array_t *direct_items; model->getDirectDescendentsOf(cat->getUUID(), direct_cats, direct_items); // Add items LLInventoryModel::item_array_t::iterator item_iter = direct_items->begin(); LLInventoryModel::item_array_t::iterator item_end = direct_items->end(); for( ; item_iter != item_end; ++item_iter) { items.push_back(*item_iter); } // Do subcategories LLInventoryModel::cat_array_t::iterator cat_iter = direct_cats->begin(); LLInventoryModel::cat_array_t::iterator cat_end = direct_cats->end(); for( ; cat_iter != cat_end; ++cat_iter) { climb(*cat_iter, cats, items); } }
inline LLCOFDragAndDropObserver::~LLCOFDragAndDropObserver() { if (mModel != NULL && mModel->containsObserver(this)) { mModel->removeObserver(this); } }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLInventoryModel* model = mPtr->getPanel()->getModel(); if(!model) return false; model->empty(); model->startBackgroundFetch(); return true; }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLInventoryModel* model = mPtr->getPanel()->getModel(); if(!model) return false; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); model->purgeDescendentsOf(trash_id); model->notifyObservers(); return true; }
static void callback_empty_lost_and_found(S32 option, void* userdata) { LLEmptyLostAndFound* empty_lost_and_found = (LLEmptyLostAndFound*)userdata; if (option == 0) // YES { LLInventoryModel* model = empty_lost_and_found->mPtr->getModel(); LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); model->purgeDescendentsOf(lost_and_found_id); model->notifyObservers(); } }
static void callback_empty_trash(S32 option, void* userdata) { LLEmptyTrash* empty_trash = (LLEmptyTrash*)userdata; if (option == 0) // YES { LLInventoryModel* model = empty_trash->mPtr->getModel(); LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); model->purgeDescendentsOf(trash_id); model->notifyObservers(); } }
bool callback_empty_lost_and_found(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) // YES { LLInventoryModel* model = mPtr->getModel(); LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); model->purgeDescendentsOf(lost_and_found_id); model->notifyObservers(); } return false; }
bool callback_empty_trash(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) // YES { LLInventoryModel* model = mPtr->getModel(); LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); model->purgeDescendentsOf(trash_id); model->notifyObservers(); } return false; }
//static void LLLocalInventory::saveInvCache(std::string filename, LLFolderView* folder) { LLInventoryModel* model = &gInventory; std::set<LLUUID> selected_items; folder->getSelectionList(selected_items); if(selected_items.size() < 1) { // No items selected? Wtfboom return; } LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; // Make complete lists of child categories and items std::set<LLUUID>::iterator sel_iter = selected_items.begin(); std::set<LLUUID>::iterator sel_end = selected_items.end(); for( ; sel_iter != sel_end; ++sel_iter) { LLInventoryCategory* cat = model->getCategory(*sel_iter); if(cat) { climb(cat, cats, items); } } // And what about items inside a folder that wasn't selected? // I guess I will just add selected items, so long as they aren't already added for(sel_iter = selected_items.begin(); sel_iter != sel_end; ++sel_iter) { LLInventoryItem* item = model->getItem(*sel_iter); if(item) { if(std::find(items.begin(), items.end(), item) == items.end()) { items.push_back(LLPointer<LLViewerInventoryItem>((LLViewerInventoryItem*)item)); LLInventoryCategory* parent = model->getCategory(item->getParentUUID()); if(std::find(cats.begin(), cats.end(), parent) == cats.end()) { cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)parent)); } } } } LLInventoryModel::saveToFile(filename, cats, items); }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLInventoryPanel *panel = mPtr; LLInventoryModel* model = panel->getModel(); if(!model) return true; std::set<LLUUID> selected_items; panel->getRootFolder()->getSelectionList(selected_items); std::string name; static int session_num = 1; LLDynamicArray<LLUUID> members; EInstantMessage type = IM_SESSION_CONFERENCE_START; std::set<LLUUID>::const_iterator iter; for (iter = selected_items.begin(); iter != selected_items.end(); iter++) { LLUUID item = *iter; LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); if(folder_item) { LLFolderViewEventListener* fve_listener = folder_item->getListener(); if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY)) { LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getListener(); if(!bridge) return true; LLViewerInventoryCategory* cat = bridge->getCategory(); if(!cat) return true; name = cat->getName(); LLUniqueBuddyCollector is_buddy; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; model->collectDescendentsIf(bridge->getUUID(), cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); S32 count = item_array.count(); if(count > 0) { // create the session gIMMgr->setFloaterOpen(TRUE); S32 i; LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; for(i = 0; i < count; ++i) { id = item_array.get(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) { members.put(id); } } } } else { LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); if(!folder_item) return true; LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener(); if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD) { LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID()); if (inv_item) { LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id = inv_item->getCreatorUUID(); if(at.isBuddyOnline(id)) { members.put(id); } } } //if IT_CALLINGCARD } //if !IT_CATEGORY } } //for selected_items // the session_id is randomly generated UUID which will be replaced later // with a server side generated number if (name.empty()) { name = llformat("Session %d", session_num++); } gIMMgr->addSession( name, type, members[0], members); return true; }
void LLInventoryPanel::modelChanged(U32 mask) { LLFastTimer t2(LLFastTimer::FTM_REFRESH); bool handled = false; if(mask & LLInventoryObserver::LABEL) { handled = true; // label change - empty out the display name for each object // in this change set. const std::set<LLUUID>& changed_items = gInventory.getChangedIDs(); std::set<LLUUID>::const_iterator id_it = changed_items.begin(); std::set<LLUUID>::const_iterator id_end = changed_items.end(); LLFolderViewItem* view = NULL; LLInvFVBridge* bridge = NULL; for (;id_it != id_end; ++id_it) { view = mFolders->getItemByID(*id_it); if(view) { // request refresh on this item (also flags for filtering) bridge = (LLInvFVBridge*)view->getListener(); if(bridge) { // Clear the display name first, so it gets properly re-built during refresh() bridge->clearDisplayName(); } view->refresh(); } } } if((mask & (LLInventoryObserver::STRUCTURE | LLInventoryObserver::ADD | LLInventoryObserver::REMOVE)) != 0) { handled = true; // Record which folders are open by uuid. LLInventoryModel* model = getModel(); if (model) { const std::set<LLUUID>& changed_items = gInventory.getChangedIDs(); std::set<LLUUID>::const_iterator id_it = changed_items.begin(); std::set<LLUUID>::const_iterator id_end = changed_items.end(); for (;id_it != id_end; ++id_it) { // sync view with model LLInventoryObject* model_item = model->getObject(*id_it); LLFolderViewItem* view_item = mFolders->getItemByID(*id_it); if (model_item) { if (!view_item) { // this object was just created, need to build a view for it if ((mask & LLInventoryObserver::ADD) != LLInventoryObserver::ADD) { llwarns << *id_it << " is in model but not in view, but ADD flag not set" << llendl; } buildNewViews(*id_it); // select any newly created object // that has the auto rename at top of folder // root set if(mFolders->getRoot()->needsAutoRename()) { setSelection(*id_it, FALSE); } } else { // this object was probably moved, check its parent if ((mask & LLInventoryObserver::STRUCTURE) != LLInventoryObserver::STRUCTURE) { llwarns << *id_it << " is in model and in view, but STRUCTURE flag not set" << llendl; } LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID()); if (view_item->getParentFolder() != new_parent) { view_item->getParentFolder()->extractItem(view_item); view_item->addToFolder(new_parent, mFolders); } } } else { if (view_item) { if ((mask & LLInventoryObserver::REMOVE) != LLInventoryObserver::REMOVE) { llwarns << *id_it << " is not in model but in view, but REMOVE flag not set" << llendl; } // item in view but not model, need to delete view view_item->destroyView(); } else { llwarns << *id_it << "Item does not exist in either view or model, but notification triggered" << llendl; } } } } } if (!handled) { // it's a small change that only requires a refresh. // *TODO: figure out a more efficient way to do the refresh // since it is expensive on large inventories mFolders->refresh(); } }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLInventoryPanel *panel = mPtr; LLInventoryModel* model = panel->getModel(); if(!model) return true; std::set<LLUUID> selected_items = panel->getRootFolder()->getSelectionList(); std::string name; static int session_num = 1; std::vector<LLUUID> members; EInstantMessage type = IM_SESSION_CONFERENCE_START; // [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) bool fRlvCanStartIM = true; // [/RLVa:KB] for (std::set<LLUUID>::const_iterator iter = selected_items.begin(); iter != selected_items.end(); iter++) { LLUUID item = *iter; LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); if(folder_item) { LLFolderViewEventListener* fve_listener = folder_item->getListener(); if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY)) { LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getListener(); if(!bridge) return true; LLViewerInventoryCategory* cat = bridge->getCategory(); if(!cat) return true; name = cat->getName(); LLUniqueBuddyCollector is_buddy; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; model->collectDescendentsIf(bridge->getUUID(), cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); S32 count = item_array.size(); if(count > 0) { // create the session gIMMgr->setFloaterOpen(TRUE); LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; for(S32 i = 0; i < count; ++i) { id = item_array.at(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) { // [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) fRlvCanStartIM &= RlvActions::canStartIM(id); // [RLVa:KB] members.push_back(id); } } } } else { LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); if(!folder_item) return true; LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener(); if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD) { LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID()); if (inv_item) { LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id = inv_item->getCreatorUUID(); if(at.isBuddyOnline(id)) { // [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) fRlvCanStartIM &= RlvActions::canStartIM(id); // [RLVa:KB] members.push_back(id); } } } //if IT_CALLINGCARD } //if !IT_CATEGORY } } //for selected_items // the session_id is randomly generated UUID which will be replaced later // with a server side generated number // [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) if (!fRlvCanStartIM) { make_ui_sound("UISndIvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); return true; } // [/RLVa:KB] if (name.empty()) { name = llformat("Session %d", session_num++); } gIMMgr->addSession( name, type, members[0], members); return true; }