Пример #1
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;
}
Пример #2
0
bool 
TTracker::InTrashNode(const entry_ref *node) const
{
	return FSInTrashDir(node);
}
Пример #3
0
bool
SearchForSignatureEntryList::CanOpenWithFilter(const Model* appModel,
	const BMessage* entriesToOpen, const entry_ref* preferredApp)
{
	ThrowOnAssert(appModel != NULL);

	if (!appModel->IsExecutable() || !appModel->Node()) {
		// weed out non-executable
#if xDEBUG
		BPath path;
		BEntry entry(appModel->EntryRef());
		entry.GetPath(&path);
		PRINT(("filtering out %s- not executable \n", path.Path()));
#endif
		return false;
	}

	if (strcasecmp(appModel->MimeType(), B_APP_MIME_TYPE) != 0) {
		// filter out pe containers on PPC etc.
		return false;
	}

	BFile* file = dynamic_cast<BFile*>(appModel->Node());
	ASSERT(file != NULL);

	char signature[B_MIME_TYPE_LENGTH];
	if (GetAppSignatureFromAttr(file, signature) == B_OK
		&& strcasecmp(signature, kTrackerSignature) == 0) {
		// special case the Tracker - make sure only the running copy is
		// in the list
		app_info trackerInfo;
		if (*appModel->EntryRef() != trackerInfo.ref) {
			// this is an inactive copy of the Tracker, remove it

#if xDEBUG
			BPath path1;
			BPath path2;
			BEntry entry(appModel->EntryRef());
			entry.GetPath(&path1);

			BEntry entry2(&trackerInfo.ref);
			entry2.GetPath(&path2);

			PRINT(("filtering out %s, sig %s, active Tracker at %s, "
				   "result %s, refName %s\n",
				path1.Path(), signature, path2.Path(),
				strerror(be_roster->GetActiveAppInfo(&trackerInfo)),
				trackerInfo.ref.name));
#endif
			return false;
		}
	}

	if (FSInTrashDir(appModel->EntryRef()))
		return false;

	if (ShowAllApplications()) {
		// don't check for these if we didn't look for every single app
		// to not slow filtering down
		uint32 flags;
		BAppFileInfo appFileInfo(dynamic_cast<BFile*>(appModel->Node()));
		if (appFileInfo.GetAppFlags(&flags) != B_OK)
			return false;

		if ((flags & B_BACKGROUND_APP) || (flags & B_ARGV_ONLY))
			return false;

		if (!signature[0])
			// weed out apps with empty signatures
			return false;
	}

	int32 relation = Relation(entriesToOpen, appModel, preferredApp, 0);
	if (relation == kNoRelation && !ShowAllApplications()) {
#if xDEBUG
		BPath path;
		BEntry entry(appModel->EntryRef());
		entry.GetPath(&path);

		PRINT(("filtering out %s, does not handle any of opened files\n",
			path.Path()));
#endif
		return false;
	}

	if (relation != kNoRelation && relation != kSuperhandler
		&& !fGenericFilesOnly) {
		// we hit at least one app that is not a superhandler and
		// handles the document
		fFoundOneNonSuperHandler = true;
	}

	return true;
}
Пример #4
0
bool
TTracker::InTrashNode(const entry_ref* ref) const
{
	return FSInTrashDir(ref);
}