Tracker: style fixes to Model class
This commit is contained in:
+52
-16
@@ -38,6 +38,9 @@ All rights reserved.
|
||||
// Consider moving iconFrom logic to BPose
|
||||
// use a more efficient way of storing file type and preferred app strings
|
||||
|
||||
|
||||
#include "Model.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -60,8 +63,6 @@ All rights reserved.
|
||||
#include <Volume.h>
|
||||
#include <VolumeRoster.h>
|
||||
|
||||
#include "Model.h"
|
||||
|
||||
#include "Attributes.h"
|
||||
#include "Bitmaps.h"
|
||||
#include "FindPanel.h"
|
||||
@@ -71,23 +72,29 @@ All rights reserved.
|
||||
#include "Tracker.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
|
||||
#ifdef CHECK_OPEN_MODEL_LEAKS
|
||||
BObjectList<Model>* writableOpenModelList = NULL;
|
||||
BObjectList<Model>* readOnlyOpenModelList = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
extern
|
||||
#ifdef _IMPEXP_BE
|
||||
_IMPEXP_BE
|
||||
#endif
|
||||
bool CheckNodeIconHintPrivate(const BNode*, bool);
|
||||
}
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
// #pragma mark - Model()
|
||||
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "Model"
|
||||
|
||||
|
||||
Model::Model()
|
||||
:
|
||||
fPreferredAppName(NULL),
|
||||
@@ -362,6 +369,9 @@ Model::Name() const
|
||||
|
||||
case kDesktopNode:
|
||||
return B_TRANSLATE_NOCOLLECT(kDesktopNodeName);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (fHasLocalizedName && gLocalizedNamePreferred)
|
||||
@@ -378,6 +388,7 @@ Model::OpenNode(bool writable)
|
||||
return B_OK;
|
||||
|
||||
OpenNodeCommon(writable);
|
||||
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
@@ -399,6 +410,7 @@ Model::UpdateStatAndOpenNode(bool writable)
|
||||
return fStatus;
|
||||
|
||||
OpenNodeCommon(writable);
|
||||
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
@@ -605,7 +617,8 @@ Model::FinishSettingUpType()
|
||||
// disk again for models that do not have an icon defined by the node
|
||||
if (IsNodeOpen()
|
||||
&& fBaseType != kLinkNode
|
||||
&& !CheckNodeIconHintPrivate(fNode, dynamic_cast<TTracker*>(be_app) == NULL)
|
||||
&& !CheckNodeIconHintPrivate(fNode,
|
||||
dynamic_cast<TTracker*>(be_app) == NULL)
|
||||
&& !HasVectorIconHint(fNode)) {
|
||||
// when checking for the node icon hint, if we are libtracker,
|
||||
// only check for small icons - checking for the large icons
|
||||
@@ -689,9 +702,9 @@ Model::FinishSettingUpType()
|
||||
}
|
||||
|
||||
char name[B_FILE_NAME_LENGTH];
|
||||
BVolume volume(NodeRef()->device);
|
||||
BVolume volume(NodeRef()->device);
|
||||
if (volume.InitCheck() == B_OK && volume.GetName(name) == B_OK) {
|
||||
if (fVolumeName)
|
||||
if (fVolumeName != NULL)
|
||||
DeletePreferredAppVolumeNameLinkTo();
|
||||
|
||||
fVolumeName = strdup(name);
|
||||
@@ -834,13 +847,15 @@ Model::GetPreferredAppForBrokenSymLink(BString &result)
|
||||
= info.GetPreferredApp(result.LockBuffer(B_MIME_TYPE_LENGTH));
|
||||
result.UnlockBuffer();
|
||||
|
||||
if (error != B_OK)
|
||||
if (error != B_OK) {
|
||||
// Tracker will have to do
|
||||
result = kTrackerSignature;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Node monitor updating stuff
|
||||
// #pragma mark - Node monitor updating methods
|
||||
|
||||
|
||||
void
|
||||
Model::UpdateEntryRef(const node_ref* dirNode, const char* name)
|
||||
@@ -949,7 +964,9 @@ Model::StatChanged()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mime handling stuff
|
||||
|
||||
// #pragma mark - Mime handling methods
|
||||
|
||||
|
||||
bool
|
||||
Model::IsDropTarget(const Model* forDocument, bool traverse) const
|
||||
@@ -964,7 +981,8 @@ Model::IsDropTarget(const Model* forDocument, bool traverse) const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!forDocument)
|
||||
|
||||
if (forDocument == NULL)
|
||||
return true;
|
||||
|
||||
if (traverse) {
|
||||
@@ -983,9 +1001,10 @@ Model::IsDropTarget(const Model* forDocument, bool traverse) const
|
||||
|
||||
return SupportsMimeType(mimeType, 0) != kDoesNotSupportType;
|
||||
}
|
||||
|
||||
// do some mime-based matching
|
||||
const char* documentMimeType = forDocument->MimeType();
|
||||
if (!documentMimeType)
|
||||
if (documentMimeType == NULL)
|
||||
return false;
|
||||
|
||||
return SupportsMimeType(documentMimeType, 0) != kDoesNotSupportType;
|
||||
@@ -995,11 +1014,11 @@ Model::IsDropTarget(const Model* forDocument, bool traverse) const
|
||||
Model::CanHandleResult
|
||||
Model::CanHandleDrops() const
|
||||
{
|
||||
if (IsDirectory())
|
||||
if (IsDirectory()) {
|
||||
// directories take anything
|
||||
// resolve permissions here
|
||||
return kCanHandle;
|
||||
|
||||
}
|
||||
|
||||
if (IsSymLink()) {
|
||||
// descend into symlink and try again on it's target
|
||||
@@ -1039,6 +1058,7 @@ enum {
|
||||
kMatch
|
||||
};
|
||||
|
||||
|
||||
static int32
|
||||
MatchMimeTypeString(/*const */BString* documentType, const char* handlerType)
|
||||
{
|
||||
@@ -1050,9 +1070,10 @@ MatchMimeTypeString(/*const */BString* documentType, const char* handlerType)
|
||||
int32 supertypeOnlyLength = 0;
|
||||
const char* tmp = strstr(handlerType, "/");
|
||||
|
||||
if (!tmp)
|
||||
if (tmp == NULL) {
|
||||
// no subtype - supertype string only
|
||||
supertypeOnlyLength = (int32)strlen(handlerType);
|
||||
}
|
||||
|
||||
if (supertypeOnlyLength) {
|
||||
// compare just the supertype
|
||||
@@ -1089,8 +1110,8 @@ Model::SupportsMimeType(const char* type, const BObjectList<BString>* list,
|
||||
return kDoesNotSupportType;
|
||||
|
||||
for (int32 index = 0; ; index++) {
|
||||
|
||||
// check if this model lists the type of dropped document as supported
|
||||
|
||||
const char* mimeSignature;
|
||||
ssize_t bufferLength;
|
||||
|
||||
@@ -1109,7 +1130,7 @@ Model::SupportsMimeType(const char* type, const BObjectList<BString>* list,
|
||||
|
||||
int32 match;
|
||||
|
||||
if (type || (list != NULL && list->IsEmpty())) {
|
||||
if (type != NULL || (list != NULL && list->IsEmpty())) {
|
||||
BString typeString(type);
|
||||
match = MatchMimeTypeString(&typeString, mimeSignature);
|
||||
} else {
|
||||
@@ -1148,6 +1169,7 @@ Model::IsDropTargetForList(const BObjectList<BString>* list) const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return SupportsMimeType(0, list) != kDoesNotSupportType;
|
||||
}
|
||||
|
||||
@@ -1284,6 +1306,7 @@ Model::GetVersionString(BString &result, version_kind kind)
|
||||
sprintf(vstr, "%" B_PRId32 ".%" B_PRId32 ".%" B_PRId32, version.major,
|
||||
version.middle, version.minor);
|
||||
result = vstr;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -1359,30 +1382,41 @@ Model::PrintToStream(int32 level, bool deep)
|
||||
case kUnknownSource:
|
||||
PRINT(("unknown\n"));
|
||||
break;
|
||||
|
||||
case kUnknownNotFromNode:
|
||||
PRINT(("unknown but not from a node\n"));
|
||||
break;
|
||||
|
||||
case kTrackerDefault:
|
||||
PRINT(("tracker default\n"));
|
||||
break;
|
||||
|
||||
case kTrackerSupplied:
|
||||
PRINT(("tracker supplied\n"));
|
||||
break;
|
||||
|
||||
case kMetaMime:
|
||||
PRINT(("metamime\n"));
|
||||
break;
|
||||
|
||||
case kPreferredAppForType:
|
||||
PRINT(("preferred app for type\n"));
|
||||
break;
|
||||
|
||||
case kPreferredAppForNode:
|
||||
PRINT(("preferred app for node\n"));
|
||||
break;
|
||||
|
||||
case kNode:
|
||||
PRINT(("node\n"));
|
||||
break;
|
||||
|
||||
case kVolume:
|
||||
PRINT(("volume\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PRINT(("model %s opened %s \n", !IsNodeOpen() ? "not " : "",
|
||||
@@ -1497,6 +1531,7 @@ Model::TrackIconSource(icon_size size)
|
||||
#ifdef CHECK_OPEN_MODEL_LEAKS
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void
|
||||
@@ -1514,6 +1549,7 @@ DumpOpenModels(bool extensive)
|
||||
printf("%s\n", readOnlyOpenModelList->ItemAt(index)->Name());
|
||||
}
|
||||
}
|
||||
|
||||
if (writableOpenModelList) {
|
||||
int32 count = writableOpenModelList->CountItems();
|
||||
printf("%ld models open writable:\n", count);
|
||||
|
||||
+165
-163
@@ -31,11 +31,10 @@ of Be Incorporated in the United States and other countries. Other brand product
|
||||
names are registered trademarks or trademarks of their respective holders.
|
||||
All rights reserved.
|
||||
*/
|
||||
#ifndef _NU_MODEL_H
|
||||
#define _NU_MODEL_H
|
||||
|
||||
|
||||
// Dedicated to BModel
|
||||
#ifndef _NU_MODEL_H
|
||||
#define _NU_MODEL_H
|
||||
|
||||
|
||||
#include <AppFileInfo.h>
|
||||
@@ -53,6 +52,7 @@ class BHandler;
|
||||
class BEntry;
|
||||
class BQuery;
|
||||
|
||||
|
||||
#if __GNUC__ && __GNUC__ < 3
|
||||
// using std::stat instead of just stat here because of what
|
||||
// seems to be a gcc bug involving namespace and struct stat interaction
|
||||
@@ -63,6 +63,7 @@ typedef struct std::stat StatStruct;
|
||||
typedef struct stat StatStruct;
|
||||
#endif
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
enum {
|
||||
@@ -74,197 +75,197 @@ enum {
|
||||
};
|
||||
|
||||
class Model {
|
||||
public:
|
||||
Model();
|
||||
Model(const Model &);
|
||||
Model(const BEntry* entry, bool open = false, bool writable = false);
|
||||
Model(const entry_ref*, bool traverse = false, bool open = false,
|
||||
bool writable = false);
|
||||
Model(const node_ref* dirNode, const node_ref* node, const char* name,
|
||||
bool open = false, bool writable = false);
|
||||
~Model();
|
||||
public:
|
||||
Model();
|
||||
Model(const Model &);
|
||||
Model(const BEntry* entry, bool open = false, bool writable = false);
|
||||
Model(const entry_ref*, bool traverse = false, bool open = false,
|
||||
bool writable = false);
|
||||
Model(const node_ref* dirNode, const node_ref* node, const char* name,
|
||||
bool open = false, bool writable = false);
|
||||
~Model();
|
||||
|
||||
Model& operator=(const Model&);
|
||||
Model& operator=(const Model&);
|
||||
|
||||
status_t InitCheck() const;
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetTo(const BEntry*, bool open = false,
|
||||
bool writable = false);
|
||||
status_t SetTo(const entry_ref*, bool traverse = false,
|
||||
bool open = false, bool writable = false);
|
||||
status_t SetTo(const node_ref* dirNode, const node_ref* node,
|
||||
const char* name, bool open = false, bool writable = false);
|
||||
status_t SetTo(const BEntry*, bool open = false,
|
||||
bool writable = false);
|
||||
status_t SetTo(const entry_ref*, bool traverse = false,
|
||||
bool open = false, bool writable = false);
|
||||
status_t SetTo(const node_ref* dirNode, const node_ref* node,
|
||||
const char* name, bool open = false, bool writable = false);
|
||||
|
||||
int CompareFolderNamesFirst(const Model* compareModel) const;
|
||||
int CompareFolderNamesFirst(const Model* compareModel) const;
|
||||
|
||||
// node management
|
||||
status_t OpenNode(bool writable = false);
|
||||
// also used to switch from read-only to writable
|
||||
void CloseNode();
|
||||
bool IsNodeOpen() const;
|
||||
bool IsNodeOpenForWriting() const;
|
||||
// node management
|
||||
status_t OpenNode(bool writable = false);
|
||||
// also used to switch from read-only to writable
|
||||
void CloseNode();
|
||||
bool IsNodeOpen() const;
|
||||
bool IsNodeOpenForWriting() const;
|
||||
|
||||
status_t UpdateStatAndOpenNode(bool writable = false);
|
||||
// like OpenNode, called on zombie poses to check if they turned
|
||||
// real, starts by rereading the stat structure
|
||||
status_t UpdateStatAndOpenNode(bool writable = false);
|
||||
// like OpenNode, called on zombie poses to check if they turned
|
||||
// real, starts by rereading the stat structure
|
||||
|
||||
// basic getters
|
||||
const char* Name() const;
|
||||
const entry_ref* EntryRef() const;
|
||||
const node_ref* NodeRef() const;
|
||||
const StatStruct* StatBuf() const;
|
||||
// basic getters
|
||||
const char* Name() const;
|
||||
const entry_ref* EntryRef() const;
|
||||
const node_ref* NodeRef() const;
|
||||
const StatStruct* StatBuf() const;
|
||||
|
||||
BNode* Node() const;
|
||||
// returns null if not Open
|
||||
void GetPath(BPath*) const;
|
||||
void GetEntry(BEntry*) const;
|
||||
BNode* Node() const;
|
||||
// returns NULL if not open
|
||||
void GetPath(BPath*) const;
|
||||
void GetEntry(BEntry*) const;
|
||||
|
||||
const char* MimeType() const;
|
||||
const char* PreferredAppSignature() const;
|
||||
// only not-null if not default for type and not self for app
|
||||
void SetPreferredAppSignature(const char*);
|
||||
const char* MimeType() const;
|
||||
const char* PreferredAppSignature() const;
|
||||
// only not-null if not default for type and not self for app
|
||||
void SetPreferredAppSignature(const char*);
|
||||
|
||||
void GetPreferredAppForBrokenSymLink(BString &result);
|
||||
// special purpose call - if a symlink is unresolvable, it makes
|
||||
// sense to be able to get at it's preferred handler which may be
|
||||
// different from the Tracker. Used by the network neighborhood.
|
||||
void GetPreferredAppForBrokenSymLink(BString &result);
|
||||
// special purpose call - if a symlink is unresolvable, it makes
|
||||
// sense to be able to get at it's preferred handler which may be
|
||||
// different from the Tracker. Used by the network neighborhood.
|
||||
|
||||
// type getters
|
||||
bool IsFile() const;
|
||||
bool IsDirectory() const;
|
||||
bool IsQuery() const;
|
||||
bool IsQueryTemplate() const;
|
||||
bool IsContainer() const;
|
||||
bool IsExecutable() const;
|
||||
bool IsSymLink() const;
|
||||
bool IsRoot() const;
|
||||
bool IsTrash() const;
|
||||
bool IsDesktop() const;
|
||||
bool IsVolume() const;
|
||||
bool IsVirtualDirectory() const;
|
||||
// type getters
|
||||
bool IsFile() const;
|
||||
bool IsDirectory() const;
|
||||
bool IsQuery() const;
|
||||
bool IsQueryTemplate() const;
|
||||
bool IsContainer() const;
|
||||
bool IsExecutable() const;
|
||||
bool IsSymLink() const;
|
||||
bool IsRoot() const;
|
||||
bool IsTrash() const;
|
||||
bool IsDesktop() const;
|
||||
bool IsVolume() const;
|
||||
bool IsVirtualDirectory() const;
|
||||
|
||||
IconSource IconFrom() const;
|
||||
void SetIconFrom(IconSource);
|
||||
// where is this model getting it's icon from
|
||||
IconSource IconFrom() const;
|
||||
void SetIconFrom(IconSource);
|
||||
// where is this model getting it's icon from
|
||||
|
||||
void ResetIconFrom();
|
||||
// called from the attribute changed calls to force a lookup of
|
||||
// a new icon
|
||||
void ResetIconFrom();
|
||||
// called from the attribute changed calls to force a lookup of
|
||||
// a new icon
|
||||
|
||||
// symlink handling calls, mainly used by the IconCache
|
||||
const Model* ResolveIfLink() const;
|
||||
Model* ResolveIfLink();
|
||||
// works on anything
|
||||
Model* LinkTo() const;
|
||||
// fast, works only on symlinks
|
||||
void SetLinkTo(Model*);
|
||||
// symlink handling calls, mainly used by the IconCache
|
||||
const Model* ResolveIfLink() const;
|
||||
Model* ResolveIfLink();
|
||||
// works on anything
|
||||
Model* LinkTo() const;
|
||||
// fast, works only on symlinks
|
||||
void SetLinkTo(Model*);
|
||||
|
||||
status_t GetLongVersionString(BString &, version_kind);
|
||||
status_t GetVersionString(BString &, version_kind);
|
||||
status_t AttrAsString(BString &, int64* value,
|
||||
const char* attributeName, uint32 attributeType);
|
||||
status_t GetLongVersionString(BString &, version_kind);
|
||||
status_t GetVersionString(BString &, version_kind);
|
||||
status_t AttrAsString(BString &, int64* value,
|
||||
const char* attributeName, uint32 attributeType);
|
||||
|
||||
// Node monitor update call
|
||||
void UpdateEntryRef(const node_ref* dirRef, const char* name);
|
||||
bool AttrChanged(const char*);
|
||||
// returns true if pose needs to update it's icon, etc.
|
||||
// pass null to force full update
|
||||
bool StatChanged();
|
||||
// returns true if pose needs to update it's icon
|
||||
// Node monitor update call
|
||||
void UpdateEntryRef(const node_ref* dirRef, const char* name);
|
||||
bool AttrChanged(const char*);
|
||||
// returns true if pose needs to update it's icon, etc.
|
||||
// pass null to force full update
|
||||
bool StatChanged();
|
||||
// returns true if pose needs to update it's icon
|
||||
|
||||
status_t WatchVolumeAndMountPoint(uint32, BHandler*);
|
||||
// correctly handles boot volume name watching
|
||||
status_t WatchVolumeAndMountPoint(uint32, BHandler*);
|
||||
// correctly handles boot volume name watching
|
||||
|
||||
bool IsDropTarget(const Model* forDocument = 0,
|
||||
bool traverse = false) const;
|
||||
// if nonzero <forDocument> passed, mime info is used to
|
||||
// resolve if document can be opened
|
||||
// if zero, all executables, directories and volumes pass
|
||||
// if traverse, dereference symlinks
|
||||
bool IsDropTargetForList(const BObjectList<BString>* list) const;
|
||||
// <list> contains mime types of all documents about to be handled
|
||||
// by model
|
||||
bool IsDropTarget(const Model* forDocument = 0,
|
||||
bool traverse = false) const;
|
||||
// if nonzero <forDocument> passed, mime info is used to
|
||||
// resolve if document can be opened
|
||||
// if zero, all executables, directories and volumes pass
|
||||
// if traverse, dereference symlinks
|
||||
bool IsDropTargetForList(const BObjectList<BString>* list) const;
|
||||
// <list> contains mime types of all documents about to be handled
|
||||
// by model
|
||||
|
||||
#if DEBUG
|
||||
void PrintToStream(int32 level = 1, bool deep = false);
|
||||
void TrackIconSource(icon_size);
|
||||
#endif
|
||||
#if DEBUG
|
||||
void PrintToStream(int32 level = 1, bool deep = false);
|
||||
void TrackIconSource(icon_size);
|
||||
#endif
|
||||
|
||||
bool IsSuperHandler() const;
|
||||
int32 SupportsMimeType(const char* type,
|
||||
const BObjectList<BString>* list, bool exactReason = false) const;
|
||||
// pass in one string in <type> or a bunch in <list>
|
||||
// if <exactReason> false, returns as soon as it figures out that
|
||||
// app supports a given type, if true, returns an exact reason
|
||||
bool IsSuperHandler() const;
|
||||
int32 SupportsMimeType(const char* type,
|
||||
const BObjectList<BString>* list, bool exactReason = false) const;
|
||||
// pass in one string in <type> or a bunch in <list>
|
||||
// if <exactReason> false, returns as soon as it figures out that
|
||||
// app supports a given type, if true, returns an exact reason
|
||||
|
||||
// get rid of this??
|
||||
ssize_t WriteAttr(const char* attr, type_code type, off_t,
|
||||
const void* buffer, size_t );
|
||||
// cover call, creates a writable node and writes out attributes
|
||||
// into it; work around for file nodes not being writeable
|
||||
ssize_t WriteAttrKillForeign(const char* attr,
|
||||
const char* foreignAttr, type_code type, off_t,
|
||||
const void* buffer, size_t);
|
||||
// get rid of this??
|
||||
ssize_t WriteAttr(const char* attr, type_code type, off_t,
|
||||
const void* buffer, size_t );
|
||||
// cover call, creates a writable node and writes out attributes
|
||||
// into it; work around for file nodes not being writeable
|
||||
ssize_t WriteAttrKillForeign(const char* attr,
|
||||
const char* foreignAttr, type_code type, off_t,
|
||||
const void* buffer, size_t);
|
||||
|
||||
bool Mimeset(bool force);
|
||||
// returns true if mime type changed
|
||||
bool Mimeset(bool force);
|
||||
// returns true if mime type changed
|
||||
|
||||
bool HasLocalizedName() const;
|
||||
bool HasLocalizedName() const;
|
||||
|
||||
private:
|
||||
status_t OpenNodeCommon(bool writable);
|
||||
void SetupBaseType();
|
||||
void FinishSettingUpType();
|
||||
void DeletePreferredAppVolumeNameLinkTo();
|
||||
void CacheLocalizedName();
|
||||
private:
|
||||
status_t OpenNodeCommon(bool writable);
|
||||
void SetupBaseType();
|
||||
void FinishSettingUpType();
|
||||
void DeletePreferredAppVolumeNameLinkTo();
|
||||
void CacheLocalizedName();
|
||||
|
||||
status_t FetchOneQuery(const BQuery*, BHandler* target,
|
||||
BObjectList<BQuery>*, BVolume*);
|
||||
status_t FetchOneQuery(const BQuery*, BHandler* target,
|
||||
BObjectList<BQuery>*, BVolume*);
|
||||
|
||||
enum CanHandleResult {
|
||||
kCanHandle,
|
||||
kCannotHandle,
|
||||
kNeedToCheckType
|
||||
};
|
||||
enum CanHandleResult {
|
||||
kCanHandle,
|
||||
kCannotHandle,
|
||||
kNeedToCheckType
|
||||
};
|
||||
|
||||
CanHandleResult CanHandleDrops() const;
|
||||
CanHandleResult CanHandleDrops() const;
|
||||
|
||||
enum NodeType {
|
||||
kPlainNode,
|
||||
kExecutableNode,
|
||||
kDirectoryNode,
|
||||
kLinkNode,
|
||||
kQueryNode,
|
||||
kQueryTemplateNode,
|
||||
kVolumeNode,
|
||||
kRootNode,
|
||||
kTrashNode,
|
||||
kDesktopNode,
|
||||
kVirtualDirectoryNode,
|
||||
kUnknownNode
|
||||
};
|
||||
enum NodeType {
|
||||
kPlainNode,
|
||||
kExecutableNode,
|
||||
kDirectoryNode,
|
||||
kLinkNode,
|
||||
kQueryNode,
|
||||
kQueryTemplateNode,
|
||||
kVolumeNode,
|
||||
kRootNode,
|
||||
kTrashNode,
|
||||
kDesktopNode,
|
||||
kVirtualDirectoryNode,
|
||||
kUnknownNode
|
||||
};
|
||||
|
||||
entry_ref fEntryRef;
|
||||
StatStruct fStatBuf;
|
||||
BString fMimeType;
|
||||
// should use string that may be shared for common types
|
||||
entry_ref fEntryRef;
|
||||
StatStruct fStatBuf;
|
||||
BString fMimeType;
|
||||
// should use string that may be shared for common types
|
||||
|
||||
// bit of overloading hackery here to save on footprint
|
||||
union {
|
||||
char* fPreferredAppName; // used if we are neither a volume
|
||||
// nor a symlink
|
||||
char* fVolumeName; // used if we are a volume
|
||||
Model* fLinkTo; // used if we are a symlink
|
||||
};
|
||||
// bit of overloading hackery here to save on footprint
|
||||
union {
|
||||
char* fPreferredAppName; // used if we are neither a volume
|
||||
// nor a symlink
|
||||
char* fVolumeName; // used if we are a volume
|
||||
Model* fLinkTo; // used if we are a symlink
|
||||
};
|
||||
|
||||
uint8 fBaseType;
|
||||
uint8 fIconFrom;
|
||||
bool fWritable;
|
||||
BNode* fNode;
|
||||
status_t fStatus;
|
||||
BString fLocalizedName;
|
||||
bool fHasLocalizedName;
|
||||
bool fLocalizedNameIsCached;
|
||||
uint8 fBaseType;
|
||||
uint8 fIconFrom;
|
||||
bool fWritable;
|
||||
BNode* fNode;
|
||||
status_t fStatus;
|
||||
BString fLocalizedName;
|
||||
bool fHasLocalizedName;
|
||||
bool fLocalizedNameIsCached;
|
||||
};
|
||||
|
||||
|
||||
@@ -544,4 +545,5 @@ ModelNodeLazyOpener::OpenNode(bool writable)
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
#endif // _NU_MODEL_H
|
||||
|
||||
Reference in New Issue
Block a user