void LLMakeOutfitDialog::getIncludedItems(LLInventoryModel::item_array_t& item_list)
{
	LLInventoryModel::cat_array_t *cats;
	LLInventoryModel::item_array_t *items;
	gInventory.getDirectDescendentsOf(LLAppearanceMgr::instance().getCOF(), cats, items);
	for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); iter != items->end(); ++iter)
	{
		LLViewerInventoryItem* item = (*iter);
		if (!item)
			continue;
		if (item->isWearableType())
		{
			LLWearableType::EType type = item->getWearableType();
			if (type < LLWearableType::WT_COUNT && childGetValue(mCheckBoxList[type].first).asBoolean())
			{
				item_list.push_back(item);
			}
		}
		else
		{
			LLViewerJointAttachment* attachment = gAgentAvatarp->getWornAttachmentPoint(item->getLinkedUUID());
			if (attachment && childGetValue(std::string("checkbox_")+attachment->getName()).asBoolean())
			{
				item_list.push_back(item);
			}
		}
	}
}
Esempio n. 2
0
void LLFriendCardsManager::syncFriendsFolder()
{
	LLAvatarTracker::buddy_map_t all_buddies;
	LLAvatarTracker::instance().copyBuddyList(all_buddies);

	// 1. Remove Friend Cards for non-friends
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;

	gInventory.collectDescendents(findFriendAllSubfolderUUIDImpl(), cats, items, LLInventoryModel::EXCLUDE_TRASH);

	LLInventoryModel::item_array_t::const_iterator it;
	for (it = items.begin(); it != items.end(); ++it)
	{
		lldebugs << "Check if buddy is in list: " << (*it)->getName() << " " << (*it)->getCreatorUUID() << llendl;
		if (NULL == get_ptr_in_map(all_buddies, (*it)->getCreatorUUID()))
		{
			lldebugs << "NONEXISTS, so remove it" << llendl;
			removeFriendCardFromInventory((*it)->getCreatorUUID());
		}
	}

	// 2. Add missing Friend Cards for friends
	LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
	llinfos << "try to build friends, count: " << all_buddies.size() << llendl;
	for(; buddy_it != all_buddies.end(); ++buddy_it)
	{
		const LLUUID& buddy_id = (*buddy_it).first;
		addFriendCardToInventory(buddy_id);
	}
}
void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array)
{
	getIDs().clear();
	LLInventoryModel::item_array_t::const_iterator it = item_array.begin();
	for( ; item_array.end() != it; ++it)
	{
		getIDs().push_back((*it)->getUUID());
	}
	mNeedsRefresh = true;
}
Esempio n. 4
0
void LLFriendCardsManager::removeFriendCardFromInventory(const LLUUID& avatarID)
{
	LLInventoryModel::item_array_t items;
	findMatchedFriendCards(avatarID, items);

	LLInventoryModel::item_array_t::const_iterator it;
	for (it = items.begin(); it != items.end(); ++ it)
	{
		gInventory.removeItem((*it)->getUUID());
	}
}
Esempio n. 5
0
void LLFloaterWorldMap::buildLandmarkIDLists()
{
	LLCtrlListInterface *list = childGetListInterface("landmark combo");
	if (!list)
	{
		return;
	}

    // Delete all but the "None" entry
	S32 list_size = list->getItemCount();
	if (list_size > 1)
	{
		list->selectItemRange(1, -1);
		list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
	}

	mLandmarkItemIDList.reset();
	mLandmarkAssetIDList.reset();

	// Get all of the current landmarks
	mLandmarkAssetIDList.put( LLUUID::null );
	mLandmarkItemIDList.put( LLUUID::null );

	mLandmarkAssetIDList.put( sHomeID );
	mLandmarkItemIDList.put( sHomeID );

	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLIsType is_landmark(LLAssetType::AT_LANDMARK);
	gInventory.collectDescendentsIf(gAgent.getInventoryRootID(),
									cats,
									items,
									LLInventoryModel::EXCLUDE_TRASH,
									is_landmark);

	std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
	
	S32 count = items.count();
	for(S32 i = 0; i < count; ++i)
	{
		LLInventoryItem* item = items.get(i);

		list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());

		mLandmarkAssetIDList.put( item->getAssetUUID() );
		mLandmarkItemIDList.put( item->getUUID() );
	}
	list->sortByColumn(std::string("landmark name"), TRUE);

	list->selectFirstItem();
}
Esempio n. 6
0
// Checked: 2013-10-12 (RLVa-1.4.9)
bool RlvCommandOptionGetPath::getItemIDs(LLWearableType::EType wtType, uuid_vec_t& idItems)
{
	uuid_vec_t::size_type cntItemsPrev = idItems.size();

	LLInventoryModel::cat_array_t folders; LLInventoryModel::item_array_t items;
	LLFindWearablesOfType f(wtType);
	gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), folders, items, false, f);
	for (LLInventoryModel::item_array_t::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
	{
		const LLViewerInventoryItem* pItem = *itItem;
		if (pItem)
			idItems.push_back(pItem->getLinkedUUID());
	}

	return (cntItemsPrev != idItems.size());
}
Esempio n. 7
0
const LLUUID& LLFriendCardsManager::findFriendCardInventoryUUIDImpl(const LLUUID& avatarID)
{
	LLUUID friendAllSubfolderUUID = findFriendAllSubfolderUUIDImpl();
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLInventoryModel::item_array_t::const_iterator it;

	// it is not necessary to check friendAllSubfolderUUID against NULL. It will be processed by collectDescendents
	gInventory.collectDescendents(friendAllSubfolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH);
	for (it = items.begin(); it != items.end(); ++it)
	{
		if ((*it)->getCreatorUUID() == avatarID)
			return (*it)->getUUID();
	}

	return LLUUID::null;
}
void LLFloaterGesture::buildGestureList()
{
	S32 scroll_pos = mGestureList->getScrollPos();
	uuid_vec_t selected_items;
	getSelectedIds(selected_items);
	LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
//	mGestureList->deleteAllItems(); // <FS:ND/> Don't recreate the list over and over.

	LLGestureMgr::item_map_t::const_iterator it;
	const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
	for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
	{
		addGesture(it->first,it->second, mGestureList);
	}
	// <FS:PP> FIRE-5646: Option to show only active gestures
	// if (gInventory.isCategoryComplete(mGestureFolderID))
	if (gInventory.isCategoryComplete(mGestureFolderID) && !gSavedPerAccountSettings.getBOOL("FSShowOnlyActiveGestures"))
	// </FS:PP> FIRE-5646: Option to show only active gestures
	{
		LLIsType is_gesture(LLAssetType::AT_GESTURE);
		LLInventoryModel::cat_array_t categories;
		LLInventoryModel::item_array_t items;
		gInventory.collectDescendentsIf(mGestureFolderID, categories, items,
				LLInventoryModel::EXCLUDE_TRASH, is_gesture);

		for (LLInventoryModel::item_array_t::iterator it = items.begin(); it!= items.end(); ++it)
		{
			LLInventoryItem* item = it->get();
			if (active_gestures.find(item->getUUID()) == active_gestures.end())
			{
				// if gesture wasn't loaded yet, we can display only name
				addGesture(item->getUUID(), NULL, mGestureList);
			}
		}
	}

	// attempt to preserve scroll position through re-builds
	// since we do re-build whenever something gets dirty
	for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
	{
		mGestureList->selectByID(*it);
	}
	mGestureList->setScrollPos(scroll_pos);
}
Esempio n. 9
0
//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 get_is_parent_to_worn_item(const LLUUID& id)
{
	const LLViewerInventoryCategory* cat = gInventory.getCategory(id);
	if (!cat)
	{
		return FALSE;
	}

	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLInventoryCollectAllItems collect_all;
	gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), cats, items, LLInventoryModel::EXCLUDE_TRASH, collect_all);

	for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
	{
		const LLViewerInventoryItem * const item = *it;

		llassert(item->getIsLinkType());

		LLUUID linked_id = item->getLinkedUUID();
		const LLViewerInventoryItem * const linked_item = gInventory.getItem(linked_id);

		if (linked_item)
		{
			LLUUID parent_id = linked_item->getParentUUID();

			while (!parent_id.isNull())
			{
				LLInventoryCategory * parent_cat = gInventory.getCategory(parent_id);

				if (cat == parent_cat)
				{
					return TRUE;
				}

				parent_id = parent_cat->getParentUUID();
			}
		}
	}

	return FALSE;
}
Esempio n. 11
0
void LLFriendCardsManager::collectFriendsLists(folderid_buddies_map_t& folderBuddiesMap) const
{
	folderBuddiesMap.clear();

	LLInventoryModel::cat_array_t* listFolders;
	LLInventoryModel::item_array_t* items;

	// get folders in the Friend folder. Items should be NULL due to Cards should be in lists.
	gInventory.getDirectDescendentsOf(findFriendFolderUUIDImpl(), listFolders, items);

	if (NULL == listFolders)
		return;

	LLInventoryModel::cat_array_t::const_iterator itCats;	// to iterate Friend Lists (categories)
	LLInventoryModel::item_array_t::const_iterator itBuddy;	// to iterate Buddies in each List
	LLInventoryModel::cat_array_t* fakeCatsArg;
	for (itCats = listFolders->begin(); itCats != listFolders->end(); ++itCats)
	{
		if (items)
			items->clear();

		// *HACK: Only Friends/All content will be shown for now
		// *TODO: Remove this hack, implement sorting if it will be needded by spec.
		if ((*itCats)->getUUID() != findFriendAllSubfolderUUIDImpl())
			continue;

		gInventory.getDirectDescendentsOf((*itCats)->getUUID(), fakeCatsArg, items);

		if (NULL == items)
			continue;

		uuid_vec_t buddyUUIDs;
		for (itBuddy = items->begin(); itBuddy != items->end(); ++itBuddy)
		{
			buddyUUIDs.push_back((*itBuddy)->getCreatorUUID());
		}

		folderBuddiesMap.insert(make_pair((*itCats)->getUUID(), buddyUUIDs));
	}
}
Esempio n. 12
0
//static
void LLLocalInventory::loadInvCache(std::string filename)
{
    std::string extension = gDirUtilp->getExtension(filename);
    std::string inv_filename = filename;
    if(extension == "gz")
    {
        LLUUID random;
        random.generate();
        inv_filename = filename.substr(0, filename.length() - 3) + "." + random.asString();

        if(!gunzip_file(filename, inv_filename))
        {
            // failure... message?
            return;
        }
    }

    LLInventoryModel::cat_array_t cats;
    LLInventoryModel::item_array_t items;
    bool is_cache_obsolete = false;
    if(LLInventoryModel::loadFromFile(inv_filename, cats, items, is_cache_obsolete))
    {
        // create a container category for everything
        LLViewerInventoryCategory* container = new LLViewerInventoryCategory(gAgent.getID());
        container->rename(gDirUtilp->getBaseFileName(filename, false));
        LLUUID container_id;
        container_id.generate();
        container->setUUID(container_id);
        container->setParent(gSystemFolderRoot);
        container->setPreferredType(LLFolderType::FT_NONE);
        LLInventoryModel::update_map_t container_update;
        ++container_update[container->getParentUUID()];
        gInventory.accountForUpdate(container_update);
        gInventory.updateCategory(container);
        gInventory.notifyObservers();

        LLViewerInventoryCategory* orphaned_items = new LLViewerInventoryCategory(gAgent.getID());
        orphaned_items->rename("Orphaned Items");
        LLUUID orphaned_items_id;

        orphaned_items_id.generate();
        orphaned_items->setUUID(orphaned_items_id);
        orphaned_items->setParent(container_id);
        orphaned_items->setPreferredType(LLFolderType::FT_NONE);

        LLInventoryModel::update_map_t orphaned_items_update;
        ++orphaned_items_update[orphaned_items->getParentUUID()];
        gInventory.accountForUpdate(orphaned_items_update);
        gInventory.updateCategory(orphaned_items);
        gInventory.notifyObservers();

        //conflict handling
        std::map<LLUUID,LLUUID> conflicting_cats;
        int dropped_cats = 0;
        int dropped_items = 0;

        // Add all categories
        LLInventoryModel::cat_array_t::iterator cat_iter = cats.begin();
        LLInventoryModel::cat_array_t::iterator cat_end = cats.end();
        for(; cat_iter != cat_end; ++cat_iter)
        {
            // Conditionally change its parent
            // Note: Should I search for missing parent id's?

            //if the parent is null, it goes in the very root of the tree!
            if((*cat_iter)->getParentUUID().isNull())
            {
                (*cat_iter)->setParent(container_id);
            }
            // If the parent exists and outside of pretend inventory, generate a new uuid
            else if(gInventory.getCategory((*cat_iter)->getParentUUID()))
            {
                if(!gInventory.isObjectDescendentOf((*cat_iter)->getParentUUID(), gSystemFolderRoot, TRUE))
                {
                    std::map<LLUUID,LLUUID>::iterator itr = conflicting_cats.find((*cat_iter)->getParentUUID());
                    if(itr == conflicting_cats.end())
                    {
                        dropped_cats++;
                        continue;
                    }
                    (*cat_iter)->setParent(itr->second);
                }
            } else {
                //well balls, this is orphaned.
                (*cat_iter)->setParent(orphaned_items_id);
            }
            // If this category already exists, generate a new uuid
            if(gInventory.getCategory((*cat_iter)->getUUID()))
            {
                LLUUID cat_random;
                cat_random.generate();
                conflicting_cats[(*cat_iter)->getUUID()] = cat_random;
                (*cat_iter)->setUUID(cat_random);
            }

            LLInventoryModel::update_map_t update;
            ++update[(*cat_iter)->getParentUUID()];
            gInventory.accountForUpdate(update);
            gInventory.updateCategory(*cat_iter);
            gInventory.notifyObservers();
        }

        // Add all items
        LLInventoryModel::item_array_t::iterator item_iter = items.begin();
        LLInventoryModel::item_array_t::iterator item_end = items.end();
        for(; item_iter != item_end; ++item_iter)
        {
            // Conditionally change its parent
            // Note: Should I search for missing parent id's?

            //if the parent is null, it goes in the very root of the tree!
            if((*item_iter)->getParentUUID().isNull())
            {
                (*item_iter)->setParent(container_id);
            }

            // If the parent exists and outside of pretend inventory, generate a new uuid
            if(gInventory.getCategory((*item_iter)->getParentUUID()))
            {
                if(!gInventory.isObjectDescendentOf((*item_iter)->getParentUUID(), gSystemFolderRoot, TRUE))
                {
                    std::map<LLUUID,LLUUID>::iterator itr = conflicting_cats.find((*item_iter)->getParentUUID());
                    if(itr == conflicting_cats.end())
                    {
                        dropped_items++;
                        continue;
                    }
                    (*item_iter)->setParent(itr->second);
                }
            } else {
                //well balls, this is orphaned.
                (*item_iter)->setParent(orphaned_items_id);
            }
            // Avoid conflicts with real inventory...
            // If this item id already exists, generate a new uuid
            if(gInventory.getItem((*item_iter)->getUUID()))
            {
                LLUUID item_random;
                item_random.generate();
                (*item_iter)->setUUID(item_random);
            }

            LLInventoryModel::update_map_t update;
            ++update[(*item_iter)->getParentUUID()];
            gInventory.accountForUpdate(update);
            gInventory.updateItem(*item_iter);
            gInventory.notifyObservers();
        }

        // Quality time
        if(dropped_items || dropped_cats)
        {
            std::ostringstream message;
            message << "Some items were ignored due to conflicts:\n\n";
            if(dropped_cats) message << dropped_cats << " folders\n";
            if(dropped_items) message << dropped_items << " items\n";

            LLSD args;
            args["ERROR_MESSAGE"] = message.str();
            LLNotificationsUtil::add("ErrorMessage", args);
        }
        conflicting_cats.clear();// srsly dont think this is need but w/e :D
    }

    // remove temporary unzipped file
    if(extension == "gz")
    {
        LLFile::remove(inv_filename);
    }

}
// Checked: 2010-03-18 (RLVa-1.2.0)
void RlvFloaterLocks::refreshAll() const
{
	LLScrollListCtrl* pLockList = getChild<LLScrollListCtrl>("lock_list");
	pLockList->operateOnAll(LLCtrlListInterface::OP_DELETE);

	if (!isAgentAvatarValid())
		return;

	//
	// Set-up a row we can just reuse
	//
	LLSD sdRow;
	LLSD& sdColumns = sdRow["columns"];
	sdColumns[0]["column"] = "lock_type";   sdColumns[0]["type"] = "text";
	sdColumns[1]["column"] = "lock_addrem"; sdColumns[1]["type"] = "text";
	sdColumns[2]["column"] = "lock_target"; sdColumns[2]["type"] = "text";
	sdColumns[3]["column"] = "lock_origin"; sdColumns[3]["type"] = "text";

	//
	// List attachment locks
	//
	sdColumns[0]["value"] = "Attachment";
	sdColumns[1]["value"] = "rem";

	const RlvAttachmentLocks::rlv_attachobjlock_map_t& attachObjRem = gRlvAttachmentLocks.getAttachObjLocks();
	for (RlvAttachmentLocks::rlv_attachobjlock_map_t::const_iterator itAttachObj = attachObjRem.begin(); 
			itAttachObj != attachObjRem.end(); ++itAttachObj)
	{
		sdColumns[2]["value"] = rlvGetItemNameFromObjID(itAttachObj->first);
		sdColumns[3]["value"] = rlvGetItemNameFromObjID(itAttachObj->second);

		pLockList->addElement(sdRow, ADD_BOTTOM);
	}

	//
	// List attachment point locks
	//
	sdColumns[0]["value"] = "Attachment Point";

	sdColumns[1]["value"] = "add";
	const RlvAttachmentLocks::rlv_attachptlock_map_t& attachPtAdd = gRlvAttachmentLocks.getAttachPtLocks(RLV_LOCK_ADD);
	for (RlvAttachmentLocks::rlv_attachptlock_map_t::const_iterator itAttachPt = attachPtAdd.begin(); 
			itAttachPt != attachPtAdd.end(); ++itAttachPt)
	{
		const LLViewerJointAttachment* pAttachPt = 
			get_if_there(gAgentAvatarp->mAttachmentPoints, itAttachPt->first, static_cast<LLViewerJointAttachment*>(NULL));
		sdColumns[2]["value"] = pAttachPt->getName();
		sdColumns[3]["value"] = rlvGetItemNameFromObjID(itAttachPt->second);

		pLockList->addElement(sdRow, ADD_BOTTOM);
	}

	sdColumns[1]["value"] = "rem";
	const RlvAttachmentLocks::rlv_attachptlock_map_t& attachPtRem = gRlvAttachmentLocks.getAttachPtLocks(RLV_LOCK_REMOVE);
	for (RlvAttachmentLocks::rlv_attachptlock_map_t::const_iterator itAttachPt = attachPtRem.begin(); 
			itAttachPt != attachPtRem.end(); ++itAttachPt)
	{
		const LLViewerJointAttachment* pAttachPt = 
			get_if_there(gAgentAvatarp->mAttachmentPoints, itAttachPt->first, static_cast<LLViewerJointAttachment*>(NULL));
		sdColumns[2]["value"] = pAttachPt->getName();
		sdColumns[3]["value"] = rlvGetItemNameFromObjID(itAttachPt->second);

		pLockList->addElement(sdRow, ADD_BOTTOM);
	}

	//
	// List wearable type locks
	//
	sdColumns[0]["value"] = "Wearable Type";

	sdColumns[1]["value"] = "add";
	const RlvWearableLocks::rlv_wearabletypelock_map_t& wearableTypeAdd = gRlvWearableLocks.getWearableTypeLocks(RLV_LOCK_ADD);
	for (RlvWearableLocks::rlv_wearabletypelock_map_t::const_iterator itWearableType = wearableTypeAdd.begin(); 
			itWearableType != wearableTypeAdd.end(); ++itWearableType)
	{
		sdColumns[2]["value"] = LLWearableType::getTypeLabel(itWearableType->first);
		sdColumns[3]["value"] = rlvGetItemNameFromObjID(itWearableType->second);

		pLockList->addElement(sdRow, ADD_BOTTOM);
	}

	sdColumns[1]["value"] = "rem";
	const RlvWearableLocks::rlv_wearabletypelock_map_t& wearableTypeRem = gRlvWearableLocks.getWearableTypeLocks(RLV_LOCK_REMOVE);
	for (RlvWearableLocks::rlv_wearabletypelock_map_t::const_iterator itWearableType = wearableTypeRem.begin(); 
			itWearableType != wearableTypeRem.end(); ++itWearableType)
	{
		sdColumns[2]["value"] = LLWearableType::getTypeName(itWearableType->first);
		sdColumns[3]["value"] = rlvGetItemNameFromObjID(itWearableType->second);

		pLockList->addElement(sdRow, ADD_BOTTOM);
	}

	//
	// List "nostrip" (soft) locks
	//
	sdColumns[1]["value"] = "nostrip";
	sdColumns[3]["value"] = "(Agent)";

	LLInventoryModel::cat_array_t folders; LLInventoryModel::item_array_t items;
	LLFindWearablesEx f(true, true);
	gInventory.collectDescendentsIf(LLAppearanceMgr::instance().getCOF(), folders, items, FALSE, f);

	for (LLInventoryModel::item_array_t::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
	{
		const LLViewerInventoryItem* pItem = *itItem;
		if (!RlvForceWear::instance().isStrippable(pItem->getUUID()))
		{
			sdColumns[0]["value"] = rlvGetItemType(pItem);
			sdColumns[2]["value"] = rlvGetItemName(pItem);

			pLockList->addElement(sdRow, ADD_BOTTOM);
		}
	}

	//
	// List folder locks
	//
	{
		// Folder lock descriptors
		const RlvFolderLocks::folderlock_list_t& folderLocks = RlvFolderLocks::instance().getFolderLocks();
		for (RlvFolderLocks::folderlock_list_t::const_iterator itFolderLock = folderLocks.begin(); 
				itFolderLock != folderLocks.end(); ++itFolderLock)
		{
			const RlvFolderLocks::folderlock_descr_t* pLockDescr = *itFolderLock;
			if (pLockDescr)
			{
				sdColumns[0]["value"] = "Folder Descriptor";
				sdColumns[1]["value"] =
					rlvLockMaskToString(pLockDescr->eLockType) + "/" +
					rlvFolderLockPermissionToString(pLockDescr->eLockPermission) + "/" +
					rlvFolderLockScopeToString(pLockDescr->eLockScope);
				sdColumns[2]["value"] = rlvFolderLockSourceToTarget(pLockDescr->lockSource);
				sdColumns[3]["value"] = rlvGetItemNameFromObjID(pLockDescr->idRlvObj);

				pLockList->addElement(sdRow, ADD_BOTTOM);
			}
		}
	}

	{
		// Folder locked attachments and wearables
		uuid_vec_t idItems;
		const uuid_vec_t& folderLockAttachmentsIds = RlvFolderLocks::instance().getAttachmentLookups();
		idItems.insert(idItems.end(), folderLockAttachmentsIds.begin(), folderLockAttachmentsIds.end());
		const uuid_vec_t& folderLockWearabels = RlvFolderLocks::instance().getWearableLookups();
		idItems.insert(idItems.end(), folderLockWearabels.begin(), folderLockWearabels.end());

		for (uuid_vec_t::const_iterator itItemId = idItems.begin(); itItemId != idItems.end(); ++itItemId)
		{
			const LLViewerInventoryItem* pItem = gInventory.getItem(*itItemId);
			if (pItem)
			{
				sdColumns[0]["value"] = rlvGetItemType(pItem);
				sdColumns[1]["value"] = rlvLockMaskToString(RLV_LOCK_REMOVE);
				sdColumns[2]["value"] = rlvGetItemName(pItem);
				sdColumns[3]["value"] = "<Folder Lock>";

				pLockList->addElement(sdRow, ADD_BOTTOM);
			}
		}
	}
}
Esempio n. 14
0
void LLFloaterWorldMap::buildLandmarkIDLists()
{
	LLCtrlListInterface *list = mListLandmarkCombo;
	if (!list) return;
	
    // Delete all but the "None" entry
	S32 list_size = list->getItemCount();
	if (list_size > 1)
	{
		list->selectItemRange(1, -1);
		list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
	}
	
	mLandmarkItemIDList.reset();
	mLandmarkAssetIDList.reset();
	
	// Get all of the current landmarks
	mLandmarkAssetIDList.put( LLUUID::null );
	mLandmarkItemIDList.put( LLUUID::null );
	
	mLandmarkAssetIDList.put( sHomeID );
	mLandmarkItemIDList.put( sHomeID );
	
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLIsType is_landmark(LLAssetType::AT_LANDMARK);
	gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
									cats,
									items,
									LLInventoryModel::EXCLUDE_TRASH,
									is_landmark);
	
	std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
	std::list<LLInventoryItem*> usedLMs;

	BOOL filterLandmarks = gSavedSettings.getBOOL("WorldmapFilterDuplicateLandmarks");
	S32 count = items.count();
	for(S32 i = 0; i < count; ++i)
	{
		LLInventoryItem* item = items.get(i);

		if (filterLandmarks)
		{
			bool skip = false;
			for (std::list<LLInventoryItem*>::iterator it = usedLMs.begin(); it != usedLMs.end(); ++it)
			{
				if ((*it)->getAssetUUID() == item->getAssetUUID())
				{
					skip = true;
					break;
				}
			}
			if (skip) continue;
			usedLMs.push_front(item);
		}
		
		list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());
		
		mLandmarkAssetIDList.put( item->getAssetUUID() );
		mLandmarkItemIDList.put( item->getUUID() );
	}
	
	list->selectFirstItem();
}