Class sh::filesystem::FilesystemNode

class sh::filesystem::FilesystemNode : public QObject, public std::enable_shared_from_this<FilesystemNode>

A representation of a location in the filesystem tree.

It represents filesystem nodes like a file or a directory in sh::filesystem::FilesystemModel.

Please note: Instances can be associated with any kind of elements in the filesystem (files, directories, links, …). It might also point to something which does not exist at all (see parentnode). The documentation sometimes explicitly makes a difference between those kinds (files, directories, links, …; often called ‘node type’). But it often uses the term ‘file’ implicitly while meaning all kinds of elements; assuming that e.g. a directory is just a special kind of a file. It should be clear from the particular context which meaning applies.

Subclassed by sh::filesystem::LoadOnDemandPlaceholderFilesystemNode

Public Functions

~FilesystemNode()
std::shared_ptr<const sh::filesystem::Eurl> eurl()

Returns the sh::filesystem::Eurl entry address.

sh::filesystem::FilesystemModel *model()

Convenience shortcut to the sh::filesystem::FilesystemModel.

QString displayName()

Returns the display name (what the user interface displays).

void setDisplayName(QString displayname)

Sets the display name (what the user interface displays).

sh::filesystem::FilesystemHandler *handler()

Returns the handler which is responsible for this node. This should be the same as sh::filesystem::FilesystemHandlerRegister.findHandler(eurl.scheme).

int nodetype()

Returns the FilesystemNodeType node type.

int childnodeCount()

Returns the number of children nodes.

std::shared_ptr<sh::filesystem::FilesystemNode> childnode(int i)

Returns i-th child node.

sh::filesystem::ModelBackedFilesystemNodeList *childnodes()

Returns the list of children.

std::shared_ptr<sh::filesystem::FilesystemNode> parentnode() const

Returns the parent node.

This is 0 if the node does not exist in the model (i.e. not yet inserted or removed afterwards). In most cases, this can be interpreted as ‘file currently does not exist’.

int index()

Returns the index of this node in the parent’s list of children.

void addChild(std::shared_ptr<sh::filesystem::FilesystemNode> node)

Adds a new child. Not allowed to call more than once for a node.

void removeChild(std::shared_ptr<sh::filesystem::FilesystemNode> node)

Removes a new child. Not allowed to call more than once for a node.

bool isFetchingSubitems()

Checks if currently subitems are fetched (i.e. the ‘loading’ node is shown).

QIcon icon()

Returns the node icon.

void setIcon(QIcon icon)

Sets the node icon.

bool isHidden()

Returns if the node is hidden.

Note: It’s not difficult for the user to also show the hidden items.

void setHidden(bool v)

Sets if the node is hidden.

See also isHidden().

void addDetail(std::shared_ptr<sh::filesystem::DetailColumn> column)

Adds a detail to this node.

std::shared_ptr<sh::filesystem::DetailColumn> getDetailColumnByIndex(int index)

Returns the i-th detail column registered to this node.

int getDetailColumnsCount() const

Returns the number of detail columns registered to this node.

bool isRootNode() const

Checks if this is the root node of the model.

bool isConfigured() const

Checks if this node was already configured by a handler.

void requestDetails(bool force = true)

Requests to fetch details for this node.

bool isAlive() const

Checks if this node currently exists in the model.

QList<std::shared_ptr<sh::filesystem::FilesystemNode>> linkDestinationNodes() const

Returns the list of link source nodes. If this node is a link, the link destination nodes may influence the behavior and appearance of this node.

This information does not come from inside but must be set from outside the model implementation.

void setLinkDestinationNodes(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> linkdestinations)

Sets the list of link destination nodes. If this node is a link, the link destination nodes may influence the behavior and appearance of this node.

void requestContainedItems(sh::filesystem::FilesystemNodeType type = FilesystemNodeType::NONE)

Requests to fetch the children of this node with help of the filesystem handler.

FilesystemNode(sh::filesystem::FilesystemModel *model, std::shared_ptr<const sh::filesystem::Eurl> eurl, QString displayname, sh::filesystem::FilesystemHandler *handler, FilesystemNodeType nodetype, bool ishidden)

Constructed only by the infrastructure and made available otherwise.

Signals

void removed()

Is emitted when this node is not placed in the tree anymore. This does not mean the physical deletion of the instance, but just means it is not alive from now on.

void _detailsAvailable()

Is emitted when values for detail columns arrived.

void iconChanged()

Is emitted when the icon changed.

void isHiddenChanged()

Is emitted when the hidden flag changed.

Private Functions

void setDetail(std::shared_ptr<sh::filesystem::DetailColumn> column, QVariant value)
int getInsertPositionForDetailColumn(std::shared_ptr<sh::filesystem::DetailColumn> newCol)

Friends

friend class sh::filesystem::FilesystemModel
friend class sh::filesystem::DetailColumn
friend class LoadOnDemandPlaceholderFilesystemNode
friend class sh::filesystem::FilesystemModelFileviewProxy
friend class sh::filesystem::FilesystemModelSubtreeProxy
friend class sh::filesystem::ModelBackedFilesystemNodeList