Exemple #1
0
void
BSlowContextMenu::AddTrashItem()
{
	BPath path;
	if (find_directory(B_TRASH_DIRECTORY, &path) == B_OK) {
		BEntry entry(path.Path());
		Model model(&entry);
		AddOneItem(&model);
	}
}
Exemple #2
0
bool
BNavMenu::AddNextItem()
{
	if (fFlags & kVolumesOnly) {
		BuildVolumeMenu();
		return false;
	}

	BEntry entry;
	if (fContainer->GetNextEntry(&entry) != B_OK) {
		// we're finished
		return false;
	}

	if (TrackerSettings().HideDotFiles()) {
		char name[B_FILE_NAME_LENGTH];
		if (entry.GetName(name) == B_OK && name[0] == '.')
			return true;
	}

	Model model(&entry, true);
	if (model.InitCheck() != B_OK) {
//		PRINT(("not showing hidden item %s, wouldn't open\n", model->Name()));
		return true;
	}

	QueryEntryListCollection* queryContainer
		= dynamic_cast<QueryEntryListCollection*>(fContainer);
	if (queryContainer && !queryContainer->ShowResultsFromTrash()
		&& FSInTrashDir(model.EntryRef())) {
		// query entry is in trash and shall not be shown
		return true;
	}

	ssize_t size = -1;
	PoseInfo poseInfo;

	if (model.Node())
		size = model.Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
			&poseInfo, sizeof(poseInfo));

	model.CloseNode();

	// item might be in invisible
	if (size == sizeof(poseInfo)
			&& !BPoseView::PoseVisible(&model, &poseInfo))
		return true;

	AddOneItem(&model);
	return true;
}
Exemple #3
0
bool
BNavMenu::AddNextItem()
{
	if (fFlags & kVolumesOnly) {
		BuildVolumeMenu();
		return false;
	}
	
	// limit nav menus to 500 items only
	if (fItemList->CountItems() > 500)
		return false;

	BEntry entry;
	if (fContainer->GetNextEntry(&entry) != B_OK) {
		// we're finished
		return false;
	}

	Model model(&entry, true);
	if (model.InitCheck() != B_OK) {
//		PRINT(("not showing hidden item %s, wouldn't open\n", model->Name()));
		return true;
	}

	ssize_t size = -1;
	PoseInfo poseInfo;

	if (model.Node()) 
		size = model.Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
			&poseInfo, sizeof(poseInfo));

	model.CloseNode();
	
	// item might be in invisible
	// ToDo:
	// use more of PoseView's filtering here
	if ((size == sizeof(poseInfo)
			&& !BPoseView::PoseVisible(&model, &poseInfo, false))
		|| (fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device,
			&model, &poseInfo))) {
//		PRINT(("not showing hidden item %s\n", model.Name()));
		return true;
	}

	AddOneItem(&model);
	return true;
}
Exemple #4
0
void
BSlowContextMenu::AddRootItemsIfNeeded()
{
	BVolumeRoster roster;
	roster.Rewind();
	BVolume volume;
	while (roster.GetNextVolume(&volume) == B_OK) {

		BDirectory root;
		BEntry entry;
		if (!volume.IsPersistent()
			|| volume.GetRootDirectory(&root) != B_OK
			|| root.GetEntry(&entry) != B_OK)
			continue;

		Model model(&entry);
		AddOneItem(&model);
	}
}
Exemple #5
0
bool
BSlowContextMenu::AddNextItem()
{
	if (fVolsOnly) {
		BuildVolumeMenu();
		return false;
	}
	
	// limit nav menus to 500 items only
	if (fItemList->CountItems() > 500)
		return false;

	BEntry entry;
	if (fContainer->GetNextEntry(&entry) != B_OK)
		// we're finished
		return false;

	Model model(&entry, true);
	if (model.InitCheck() != B_OK) {
//		PRINT(("not showing hidden item %s, wouldn't open\n", model->Name()));
		return true;
	}

	ssize_t size = -1;
	PoseInfo poseInfo;

	if (model.Node()) 
		size = model.Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
			&poseInfo, sizeof(poseInfo));

	model.CloseNode();
	
	if (!BPoseView::PoseVisible(&model, &poseInfo)) {
		return true;
	}

	AddOneItem(&model);
	return true;
}