* Added "sortInodes" parameter to CachedEntryIteratorList constructor.
* Moved static CompareInode() to CachedEntryIterator::_CompareInodes(). * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27869 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -43,23 +43,28 @@ All rights reserved.
|
|||||||
#include "NodeWalker.h"
|
#include "NodeWalker.h"
|
||||||
#include "ObjectList.h"
|
#include "ObjectList.h"
|
||||||
|
|
||||||
|
|
||||||
TWalkerWrapper::TWalkerWrapper(WALKER_NS::TWalker *walker)
|
TWalkerWrapper::TWalkerWrapper(WALKER_NS::TWalker *walker)
|
||||||
: fWalker(walker),
|
:
|
||||||
fStatus(B_OK)
|
fWalker(walker),
|
||||||
|
fStatus(B_OK)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TWalkerWrapper::~TWalkerWrapper()
|
TWalkerWrapper::~TWalkerWrapper()
|
||||||
{
|
{
|
||||||
delete fWalker;
|
delete fWalker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TWalkerWrapper::InitCheck() const
|
TWalkerWrapper::InitCheck() const
|
||||||
{
|
{
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TWalkerWrapper::GetNextEntry(BEntry *entry, bool traverse)
|
TWalkerWrapper::GetNextEntry(BEntry *entry, bool traverse)
|
||||||
{
|
{
|
||||||
@@ -67,6 +72,7 @@ TWalkerWrapper::GetNextEntry(BEntry *entry, bool traverse)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TWalkerWrapper::GetNextRef(entry_ref *ref)
|
TWalkerWrapper::GetNextRef(entry_ref *ref)
|
||||||
{
|
{
|
||||||
@@ -74,55 +80,70 @@ TWalkerWrapper::GetNextRef(entry_ref *ref)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
TWalkerWrapper::GetNextDirents(struct dirent *buffer, size_t length, int32 count)
|
TWalkerWrapper::GetNextDirents(struct dirent *buffer, size_t length,
|
||||||
|
int32 count)
|
||||||
{
|
{
|
||||||
int32 result = fWalker->GetNextDirents(buffer, length, count);
|
int32 result = fWalker->GetNextDirents(buffer, length, count);
|
||||||
fStatus = result < 0 ? result : (result ? B_OK : B_ENTRY_NOT_FOUND);
|
fStatus = result < B_OK ? result : (result ? B_OK : B_ENTRY_NOT_FOUND);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TWalkerWrapper::Rewind()
|
TWalkerWrapper::Rewind()
|
||||||
{
|
{
|
||||||
return fWalker->Rewind();
|
return fWalker->Rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
TWalkerWrapper::CountEntries()
|
TWalkerWrapper::CountEntries()
|
||||||
{
|
{
|
||||||
return fWalker->CountEntries();
|
return fWalker->CountEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
EntryListBase::EntryListBase()
|
EntryListBase::EntryListBase()
|
||||||
: fStatus(B_OK)
|
: fStatus(B_OK)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EntryListBase::InitCheck() const
|
EntryListBase::InitCheck() const
|
||||||
{
|
{
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dirent *
|
dirent *
|
||||||
EntryListBase::Next(dirent *ent)
|
EntryListBase::Next(dirent *ent)
|
||||||
{
|
{
|
||||||
return (dirent *)((char *)ent + ent->d_reclen + sizeof(dirent));
|
return (dirent *)((char *)ent + ent->d_reclen + sizeof(dirent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
CachedEntryIterator::CachedEntryIterator(BEntryList *iterator, int32 numEntries,
|
CachedEntryIterator::CachedEntryIterator(BEntryList *iterator, int32 numEntries,
|
||||||
bool sortInodes)
|
bool sortInodes)
|
||||||
: fIterator(iterator),
|
:
|
||||||
fEntryRefBuffer(NULL),
|
fIterator(iterator),
|
||||||
fCacheSize(numEntries),
|
fEntryRefBuffer(NULL),
|
||||||
fNumEntries(0),
|
fCacheSize(numEntries),
|
||||||
fIndex(0),
|
fNumEntries(0),
|
||||||
fDirentBuffer(NULL),
|
fIndex(0),
|
||||||
fCurrentDirent(NULL),
|
fDirentBuffer(NULL),
|
||||||
fSortInodes(sortInodes),
|
fCurrentDirent(NULL),
|
||||||
fSortedList(NULL),
|
fSortInodes(sortInodes),
|
||||||
fEntryBuffer(NULL)
|
fSortedList(NULL),
|
||||||
|
fEntryBuffer(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +156,7 @@ CachedEntryIterator::~CachedEntryIterator()
|
|||||||
delete [] fEntryBuffer;
|
delete [] fEntryBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
CachedEntryIterator::GetNextEntry(BEntry *result, bool traverse)
|
CachedEntryIterator::GetNextEntry(BEntry *result, bool traverse)
|
||||||
{
|
{
|
||||||
@@ -158,14 +180,16 @@ CachedEntryIterator::GetNextEntry(BEntry *result, bool traverse)
|
|||||||
fIndex = 0;
|
fIndex = 0;
|
||||||
}
|
}
|
||||||
*result = fEntryBuffer[fIndex++];
|
*result = fEntryBuffer[fIndex++];
|
||||||
if (fIndex > fNumEntries)
|
if (fIndex > fNumEntries) {
|
||||||
// we are at the end of the cache we loaded up, time to return
|
// we are at the end of the cache we loaded up, time to return
|
||||||
// an error, if we had one
|
// an error, if we had one
|
||||||
return fStatus;
|
return fStatus;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
CachedEntryIterator::GetNextRef(entry_ref *ref)
|
CachedEntryIterator::GetNextRef(entry_ref *ref)
|
||||||
{
|
{
|
||||||
@@ -198,17 +222,18 @@ CachedEntryIterator::GetNextRef(entry_ref *ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
/*static*/ int
|
||||||
CompareInode(const dirent *ent1, const dirent *ent2)
|
CachedEntryIterator::_CompareInodes(const dirent *ent1, const dirent *ent2)
|
||||||
{
|
{
|
||||||
if (ent1->d_ino < ent2->d_ino)
|
if (ent1->d_ino < ent2->d_ino)
|
||||||
return -1;
|
return -1;
|
||||||
else if (ent1->d_ino == ent2->d_ino)
|
if (ent1->d_ino == ent2->d_ino)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size,
|
CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size,
|
||||||
int32 count)
|
int32 count)
|
||||||
@@ -236,14 +261,17 @@ CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size,
|
|||||||
|
|
||||||
fNumEntries += count;
|
fNumEntries += count;
|
||||||
|
|
||||||
int32 currentDirentSize = fCurrentDirent->d_reclen + (ssize_t)sizeof(dirent);
|
int32 currentDirentSize = fCurrentDirent->d_reclen
|
||||||
|
+ (ssize_t)sizeof(dirent);
|
||||||
bufferRemain -= currentDirentSize;
|
bufferRemain -= currentDirentSize;
|
||||||
if (bufferRemain < (sizeof(dirent) + B_FILE_NAME_LENGTH))
|
if (bufferRemain < (sizeof(dirent) + B_FILE_NAME_LENGTH)) {
|
||||||
// cant fit a big entryRef in the buffer, just bail
|
// cant fit a big entryRef in the buffer, just bail
|
||||||
// and start from scratch
|
// and start from scratch
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fCurrentDirent = (dirent *)((char *)fCurrentDirent + currentDirentSize);
|
fCurrentDirent
|
||||||
|
= (dirent *)((char *)fCurrentDirent + currentDirentSize);
|
||||||
}
|
}
|
||||||
fCurrentDirent = fDirentBuffer;
|
fCurrentDirent = fDirentBuffer;
|
||||||
if (fSortInodes) {
|
if (fSortInodes) {
|
||||||
@@ -256,14 +284,15 @@ CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size,
|
|||||||
fSortedList->AddItem(fCurrentDirent, 0);
|
fSortedList->AddItem(fCurrentDirent, 0);
|
||||||
fCurrentDirent = Next(fCurrentDirent);
|
fCurrentDirent = Next(fCurrentDirent);
|
||||||
}
|
}
|
||||||
fSortedList->SortItems(CompareInode);
|
fSortedList->SortItems(&_CompareInodes);
|
||||||
fCurrentDirent = fDirentBuffer;
|
fCurrentDirent = fDirentBuffer;
|
||||||
}
|
}
|
||||||
fIndex = 0;
|
fIndex = 0;
|
||||||
}
|
}
|
||||||
if (fIndex >= fNumEntries)
|
if (fIndex >= fNumEntries) {
|
||||||
// we are done, no more dirents left
|
// we are done, no more dirents left
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (fSortInodes)
|
if (fSortInodes)
|
||||||
fCurrentDirent = fSortedList->ItemAt(fIndex);
|
fCurrentDirent = fSortedList->ItemAt(fIndex);
|
||||||
@@ -282,6 +311,7 @@ CachedEntryIterator::GetNextDirents(struct dirent *ent, size_t size,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
CachedEntryIterator::Rewind()
|
CachedEntryIterator::Rewind()
|
||||||
{
|
{
|
||||||
@@ -296,12 +326,14 @@ CachedEntryIterator::Rewind()
|
|||||||
return fIterator->Rewind();
|
return fIterator->Rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
CachedEntryIterator::CountEntries()
|
CachedEntryIterator::CountEntries()
|
||||||
{
|
{
|
||||||
return fIterator->CountEntries();
|
return fIterator->CountEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CachedEntryIterator::SetTo(BEntryList *iterator)
|
CachedEntryIterator::SetTo(BEntryList *iterator)
|
||||||
{
|
{
|
||||||
@@ -311,25 +343,35 @@ CachedEntryIterator::SetTo(BEntryList *iterator)
|
|||||||
fIterator = iterator;
|
fIterator = iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
CachedDirectoryEntryList::CachedDirectoryEntryList(const BDirectory &dir)
|
CachedDirectoryEntryList::CachedDirectoryEntryList(const BDirectory &dir)
|
||||||
: CachedEntryIterator(0, 40, true),
|
: CachedEntryIterator(0, 40, true),
|
||||||
fDir(dir)
|
fDir(dir)
|
||||||
{
|
{
|
||||||
fStatus = fDir.InitCheck();
|
fStatus = fDir.InitCheck();
|
||||||
SetTo(&fDir);
|
SetTo(&fDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CachedDirectoryEntryList::~CachedDirectoryEntryList()
|
CachedDirectoryEntryList::~CachedDirectoryEntryList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
DirectoryEntryList::DirectoryEntryList(const BDirectory &dir)
|
DirectoryEntryList::DirectoryEntryList(const BDirectory &dir)
|
||||||
: fDir(dir)
|
:
|
||||||
|
fDir(dir)
|
||||||
{
|
{
|
||||||
fStatus = fDir.InitCheck();
|
fStatus = fDir.InitCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DirectoryEntryList::GetNextEntry(BEntry *entry, bool traverse)
|
DirectoryEntryList::GetNextEntry(BEntry *entry, bool traverse)
|
||||||
{
|
{
|
||||||
@@ -337,6 +379,7 @@ DirectoryEntryList::GetNextEntry(BEntry *entry, bool traverse)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DirectoryEntryList::GetNextRef(entry_ref *ref)
|
DirectoryEntryList::GetNextRef(entry_ref *ref)
|
||||||
{
|
{
|
||||||
@@ -344,6 +387,7 @@ DirectoryEntryList::GetNextRef(entry_ref *ref)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
DirectoryEntryList::GetNextDirents(struct dirent *buffer, size_t length,
|
DirectoryEntryList::GetNextDirents(struct dirent *buffer, size_t length,
|
||||||
int32 count)
|
int32 count)
|
||||||
@@ -352,6 +396,7 @@ DirectoryEntryList::GetNextDirents(struct dirent *buffer, size_t length,
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DirectoryEntryList::Rewind()
|
DirectoryEntryList::Rewind()
|
||||||
{
|
{
|
||||||
@@ -359,6 +404,7 @@ DirectoryEntryList::Rewind()
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
DirectoryEntryList::CountEntries()
|
DirectoryEntryList::CountEntries()
|
||||||
{
|
{
|
||||||
@@ -366,12 +412,17 @@ DirectoryEntryList::CountEntries()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
EntryIteratorList::EntryIteratorList()
|
EntryIteratorList::EntryIteratorList()
|
||||||
: fList(5, true),
|
:
|
||||||
fCurrentIndex(0)
|
fList(5, true),
|
||||||
|
fCurrentIndex(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntryIteratorList::~EntryIteratorList()
|
EntryIteratorList::~EntryIteratorList()
|
||||||
{
|
{
|
||||||
int32 count = fList.CountItems();
|
int32 count = fList.CountItems();
|
||||||
@@ -394,10 +445,11 @@ EntryIteratorList::AddItem(BEntryList *walker)
|
|||||||
fList.AddItem(walker);
|
fList.AddItem(walker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EntryIteratorList::GetNextEntry(BEntry *entry, bool traverse)
|
EntryIteratorList::GetNextEntry(BEntry *entry, bool traverse)
|
||||||
{
|
{
|
||||||
for (;;) {
|
while (true) {
|
||||||
if (fCurrentIndex >= fList.CountItems()) {
|
if (fCurrentIndex >= fList.CountItems()) {
|
||||||
fStatus = B_ENTRY_NOT_FOUND;
|
fStatus = B_ENTRY_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
@@ -412,10 +464,11 @@ EntryIteratorList::GetNextEntry(BEntry *entry, bool traverse)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EntryIteratorList::GetNextRef(entry_ref *ref)
|
EntryIteratorList::GetNextRef(entry_ref *ref)
|
||||||
{
|
{
|
||||||
for (;;) {
|
while (true) {
|
||||||
if (fCurrentIndex >= fList.CountItems()) {
|
if (fCurrentIndex >= fList.CountItems()) {
|
||||||
fStatus = B_ENTRY_NOT_FOUND;
|
fStatus = B_ENTRY_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
@@ -430,17 +483,20 @@ EntryIteratorList::GetNextRef(entry_ref *ref)
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
EntryIteratorList::GetNextDirents(struct dirent *buffer, size_t length, int32 count)
|
EntryIteratorList::GetNextDirents(struct dirent *buffer, size_t length,
|
||||||
|
int32 count)
|
||||||
{
|
{
|
||||||
int32 result = 0;
|
int32 result = 0;
|
||||||
for (;;) {
|
while (true) {
|
||||||
if (fCurrentIndex >= fList.CountItems()) {
|
if (fCurrentIndex >= fList.CountItems()) {
|
||||||
fStatus = B_ENTRY_NOT_FOUND;
|
fStatus = B_ENTRY_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = fList.ItemAt(fCurrentIndex)->GetNextDirents(buffer, length, count);
|
result = fList.ItemAt(fCurrentIndex)->GetNextDirents(buffer, length,
|
||||||
|
count);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
break;
|
break;
|
||||||
@@ -451,6 +507,7 @@ EntryIteratorList::GetNextDirents(struct dirent *buffer, size_t length, int32 co
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
EntryIteratorList::Rewind()
|
EntryIteratorList::Rewind()
|
||||||
{
|
{
|
||||||
@@ -462,6 +519,7 @@ EntryIteratorList::Rewind()
|
|||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
EntryIteratorList::CountEntries()
|
EntryIteratorList::CountEntries()
|
||||||
{
|
{
|
||||||
@@ -475,13 +533,17 @@ EntryIteratorList::CountEntries()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CachedEntryIteratorList::CachedEntryIteratorList()
|
// #pragma mark -
|
||||||
: CachedEntryIterator(0, 10, true)
|
|
||||||
|
|
||||||
|
CachedEntryIteratorList::CachedEntryIteratorList(bool sortInodes)
|
||||||
|
: CachedEntryIterator(NULL, 10, sortInodes)
|
||||||
{
|
{
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
SetTo(&fIteratorList);
|
SetTo(&fIteratorList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CachedEntryIteratorList::AddItem(BEntryList *walker)
|
CachedEntryIteratorList::AddItem(BEntryList *walker)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,6 +117,8 @@ public:
|
|||||||
// CachedEntryIterator does not get to own the <iterator>
|
// CachedEntryIterator does not get to own the <iterator>
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static int _CompareInodes(const dirent *ent1, const dirent *ent2);
|
||||||
|
|
||||||
BEntryList *fIterator;
|
BEntryList *fIterator;
|
||||||
entry_ref *fEntryRefBuffer;
|
entry_ref *fEntryRefBuffer;
|
||||||
int32 fCacheSize;
|
int32 fCacheSize;
|
||||||
@@ -185,8 +187,8 @@ protected:
|
|||||||
|
|
||||||
class CachedEntryIteratorList : public CachedEntryIterator {
|
class CachedEntryIteratorList : public CachedEntryIterator {
|
||||||
public:
|
public:
|
||||||
CachedEntryIteratorList();
|
CachedEntryIteratorList(bool sortInodes = true);
|
||||||
void AddItem(BEntryList *);
|
void AddItem(BEntryList *list);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EntryIteratorList fIteratorList;
|
EntryIteratorList fIteratorList;
|
||||||
|
|||||||
@@ -566,8 +566,7 @@ AddSupportingAppForTypeToQuery(SearchForSignatureEntryList *queryIterator,
|
|||||||
static const entry_ref *
|
static const entry_ref *
|
||||||
AddOneRefSignatures(const entry_ref *ref, void *castToIterator)
|
AddOneRefSignatures(const entry_ref *ref, void *castToIterator)
|
||||||
{
|
{
|
||||||
// ToDo:
|
// TODO: resolve cases where each entry has a different type and
|
||||||
// resolve cases where each entry has a different type and
|
|
||||||
// their supporting apps are disjoint sets
|
// their supporting apps are disjoint sets
|
||||||
|
|
||||||
SearchForSignatureEntryList *queryIterator =
|
SearchForSignatureEntryList *queryIterator =
|
||||||
@@ -684,7 +683,6 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
|
|||||||
// publishers to fix up sniffers
|
// publishers to fix up sniffers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BMessage message(*window->EntryList());
|
BMessage message(*window->EntryList());
|
||||||
// make a clone to send
|
// make a clone to send
|
||||||
message.RemoveName("launchUsingSelector");
|
message.RemoveName("launchUsingSelector");
|
||||||
@@ -787,22 +785,25 @@ OpenWithPoseView::CreatePoses(Model **models, PoseInfo *poseInfoArray, int32 cou
|
|||||||
_inherited::CreatePoses(models, poseInfoArray, count, resultingPoses, insertionSort,
|
_inherited::CreatePoses(models, poseInfoArray, count, resultingPoses, insertionSort,
|
||||||
lastPoseIndexPtr, boundsPtr, forceDraw);
|
lastPoseIndexPtr, boundsPtr, forceDraw);
|
||||||
|
|
||||||
if (resultingPoses)
|
if (resultingPoses) {
|
||||||
for (int32 index = 0; index < count; index++)
|
for (int32 index = 0; index < count; index++) {
|
||||||
if (resultingPoses[index] && fHaveCommonPreferredApp
|
if (resultingPoses[index] && fHaveCommonPreferredApp
|
||||||
&& *(models[index]->EntryRef()) == fPreferredRef)
|
&& *(models[index]->EntryRef()) == fPreferredRef) {
|
||||||
// this is our preferred app, select it's pose
|
// this is our preferred app, select it's pose
|
||||||
SelectPose(resultingPoses[index], IndexOfPose(resultingPoses[index]));
|
SelectPose(resultingPoses[index], IndexOfPose(resultingPoses[index]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
OpenWithPoseView::KeyDown(const char *bytes, int32 count)
|
OpenWithPoseView::KeyDown(const char *bytes, int32 count)
|
||||||
{
|
{
|
||||||
if (bytes[0] == B_TAB)
|
if (bytes[0] == B_TAB) {
|
||||||
// just shift the focus, don't tab to the next pose
|
// just shift the focus, don't tab to the next pose
|
||||||
BView::KeyDown(bytes, count);
|
BView::KeyDown(bytes, count);
|
||||||
else
|
} else
|
||||||
_inherited::KeyDown(bytes, count);
|
_inherited::KeyDown(bytes, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1442,40 +1443,40 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case kSupportsSupertype:
|
case kSupportsSupertype:
|
||||||
{
|
{
|
||||||
mimeType.SetTo(model.MimeType());
|
mimeType.SetTo(model.MimeType());
|
||||||
// status_t result = mimeType.GetSupertype(&mimeType);
|
// status_t result = mimeType.GetSupertype(&mimeType);
|
||||||
|
|
||||||
char *type = (char *)mimeType.Type();
|
char *type = (char *)mimeType.Type();
|
||||||
char *tmp = strchr(type, '/');
|
char *tmp = strchr(type, '/');
|
||||||
if (tmp)
|
if (tmp)
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
|
||||||
//PRINT(("getting supertype for %s, result %s, got %s\n",
|
//PRINT(("getting supertype for %s, result %s, got %s\n",
|
||||||
// model.MimeType(), strerror(result), mimeType.Type()));
|
// model.MimeType(), strerror(result), mimeType.Type()));
|
||||||
*description = "Handles any ";
|
*description = "Handles any ";
|
||||||
// *description += mimeType.Type();
|
// *description += mimeType.Type();
|
||||||
*description += type;
|
*description += type;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kSupportsType:
|
case kSupportsType:
|
||||||
{
|
{
|
||||||
mimeType.SetTo(model.MimeType());
|
mimeType.SetTo(model.MimeType());
|
||||||
|
|
||||||
if (preferredApp && *applicationModel->EntryRef() == *preferredApp)
|
if (preferredApp && *applicationModel->EntryRef() == *preferredApp)
|
||||||
// application matches cached preferred app, we are done
|
// application matches cached preferred app, we are done
|
||||||
*description = "Preferred for ";
|
*description = "Preferred for ";
|
||||||
else
|
else
|
||||||
*description = "Handles ";
|
*description = "Handles ";
|
||||||
|
|
||||||
char shortDescription[256];
|
char shortDescription[256];
|
||||||
if (mimeType.GetShortDescription(shortDescription) == B_OK)
|
if (mimeType.GetShortDescription(shortDescription) == B_OK)
|
||||||
*description += shortDescription;
|
*description += shortDescription;
|
||||||
else
|
else
|
||||||
*description += mimeType.Type();
|
*description += mimeType.Type();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1628,7 +1629,8 @@ ConditionalAllAppsIterator::GetNextRef(entry_ref *ref)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
ConditionalAllAppsIterator::GetNextDirents(struct dirent *buffer, size_t length, int32 count)
|
ConditionalAllAppsIterator::GetNextDirents(struct dirent *buffer, size_t length,
|
||||||
|
int32 count)
|
||||||
{
|
{
|
||||||
if (!Iterate())
|
if (!Iterate())
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user