Class sh::filesystem::FilesystemOperation

class sh::filesystem::FilesystemOperation

A high-level interface for filesystem operations.

It is always based on the transaction of a Operation instance (which also gives you access to a FilesystemOperation object).

Some calls optionally allow to give an own instance of sh::filesystem::FilesystemOperationProgressMonitor for some additional functionality. Please note that not all calls provide all those functionality (some do not use e.g. the conflict resolution at all). If not provided, a default behavior is applied.

Public Functions

FilesystemOperation(sh::filesystem::Operation *operation)

Constructed only by the infrastructure and made available otherwise.

QList<std::shared_ptr<const sh::filesystem::Eurl>> itemlist(std::shared_ptr<const sh::filesystem::Eurl> eurl, sh::filesystem::FilesystemNodeType type = sh::filesystem::FilesystemNodeType::NONE)

Gets a list of shallot.sh::filesystem::FilesystemNode nodes in a directory (optionally filter by given types).

sh::filesystem::FilesystemNodeType getType(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Gets the shallot.sh::filesystem::FilesystemNodeType node type for an entry.

qint64 getFileSize(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Gets the file size for an entry.

QString getLinkTarget(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Gets the link target for an entry (if it is a link).

bool canGetFileContent(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Can we get the file content for an entry?

std::shared_ptr<QIODevice> getFileContent(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Gets the file content for an entry as QIODevice.

bool canCreateDirectory(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Can we create a given directory?

void createDirectory(std::shared_ptr<const sh::filesystem::Eurl> eurl, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Creates a directory.

Parameters
  • progressmon: An optional progress monitor.

bool canCreateLink(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Can we create a given link?

void createLink(std::shared_ptr<const sh::filesystem::Eurl> eurl, QString target, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Creates a link.

Parameters
  • progressmon: An optional progress monitor.

bool canCreateFile(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Can we create a given file?

void createFile(std::shared_ptr<const sh::filesystem::Eurl> eurl, QIODevice *content, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Creates a file.

Parameters
  • progressmon: An optional progress monitor.

bool canDeleteItem(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Can we delete a given entry?

void deleteItem(std::shared_ptr<const sh::filesystem::Eurl> eurl, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Delete an entry.

Parameters
  • progressmon: An optional progress monitor.

void deleteDirectoryIfEmpty(std::shared_ptr<const sh::filesystem::Eurl> eurl, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Delete a directory entry if empty.

Parameters
  • progressmon: An optional progress monitor.

bool canMoveItem(std::shared_ptr<const sh::filesystem::Eurl> src, std::shared_ptr<const sh::filesystem::Eurl> dest = 0)

Checks if it is allowed to move a certain item.

If the destination is known as well, it might help to pass it as well.

This does not guarantee success in the transfer, but is just a cheap early check.

void moveItems(QList<std::shared_ptr<const sh::filesystem::Eurl>> src, std::shared_ptr<const sh::filesystem::Eurl> dest, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Moves entries.

Parameters
  • dest: The requested new common parent directory.

  • progressmon: An optional progress monitor.

void moveItem(std::shared_ptr<const sh::filesystem::Eurl> src, std::shared_ptr<const sh::filesystem::Eurl> dest, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Moves an entry.

Parameters
  • dest: The new location (not the new parent).

  • progressmon: An optional progress monitor.

bool canCopyItem(std::shared_ptr<const sh::filesystem::Eurl> src, std::shared_ptr<const Eurl> dest = 0)

Checks if it is allowed to copy a certain item.

If the destination is known as well, it might help to pass it as well.

This does not guarantee success in the transfer, but is just a cheap early check.

void copyItems(QList<std::shared_ptr<const sh::filesystem::Eurl>> src, std::shared_ptr<const sh::filesystem::Eurl> dest, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Copies entries.

Parameters
  • dest: The requested new common parent directory.

  • progressmon: An optional progress monitor.

void copyItem(std::shared_ptr<const sh::filesystem::Eurl> src, std::shared_ptr<const sh::filesystem::Eurl> dest, std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> progressmon = 0)

Copies an entry.

Parameters
  • dest: The new location (not the new parent).

  • progressmon: An optional progress monitor.

QList<std::shared_ptr<FilesystemNode>> resolveNodeLink(std::shared_ptr<FilesystemNode> node, bool recursive = true, bool excludeOwn = false)

Resolve a link as node with or without recursion.

std::shared_ptr<const sh::filesystem::Eurl> resolveEurlLink(std::shared_ptr<const sh::filesystem::Eurl> eurl, bool recursive = true, bool excludeOwn = false, int tries = 100)

Resolve a link as sh::filesystem::Eurl with or without recursion.

QList<QString> listExtendedAttributes(std::shared_ptr<const sh::filesystem::Eurl> eurl)
quint64 getExtendedAttributeSize(std::shared_ptr<const sh::filesystem::Eurl> eurl, QString attribute)
QByteArray getExtendedAttribute(std::shared_ptr<const sh::filesystem::Eurl> eurl, QString attribute)
void setExtendedAttribute(std::shared_ptr<const sh::filesystem::Eurl> eurl, QString attribute, QByteArray value)
void removeExtendedAttribute(std::shared_ptr<const sh::filesystem::Eurl> eurl, QString attribute)

Public Static Functions

void addTransferrableDetailColumn(int index, std::shared_ptr<sh::filesystem::DetailColumn> detailColumn)

Registers a detail column for transferring it when file transfer take place.

Parameters
  • index: An integer which controls the order of transferring.

QList<std::shared_ptr<sh::filesystem::DetailColumn>> transferrableDetailColumns()

A list of all detail columns which are registered becoming transferred in file transfers.

Private Functions

std::shared_ptr<sh::filesystem::FilesystemHandler> _handler(std::shared_ptr<const sh::filesystem::Eurl> eurl)
std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> _monitor(std::shared_ptr<sh::filesystem::FilesystemOperationProgressMonitor> m)
std::shared_ptr<const sh::filesystem::Eurl> _resolveIfNeeded(std::shared_ptr<sh::filesystem::FilesystemHandler> handler, std::shared_ptr<const sh::filesystem::Eurl> eurl)

Private Members

Operation *_operation

Private Static Attributes

QMap<int, std::shared_ptr<sh::filesystem::DetailColumn>> _detailColumnsMap
QList<std::shared_ptr<sh::filesystem::DetailColumn>> _detailColumns
QMutex _detailColumnsMutex

Friends

friend class FilesystemOperationTransfers
class MyHandlerTransfer : public sh::filesystem::FilesystemHandler::HandlerTransfer

Public Functions

MyHandlerTransfer(sh::filesystem::FilesystemOperationProgressMonitor *progressmon = 0)
~MyHandlerTransfer()
void respectCancel()
void incrementTransferredBytes(qint64 donebytes)

Private Members

sh::filesystem::FilesystemOperationProgressMonitor *_progressmon