Skip to content

Class WebdavConnection

ClassList > WebdavConnection

More...

  • #include <webdavconnection.h>

Inherits the following classes: QObject

Public Properties

Type Name
property QStringList availablePaths
property QStringList checkedPaths
property bool isDownloadingPath
property bool isFetchingAvailablePaths
property bool isImportingPath
property bool isPasswordStored
property bool isUploadingPath
property QString lastError
property QString password
property double progress
property bool storePassword
property QString url
property QString username

Public Signals

Type Name
signal void availablePathsChanged
signal void checkedPathsChanged
signal void confirmationRequested (const QString & host, const QString & username)
signal void importSuccessful (const QString & path)
signal void isDownloadingPathChanged
signal void isFetchingAvailablePathsChanged
signal void isImportingPathChanged
signal void isPasswordStoredChanged
signal void isUploadingPathChanged
signal void lastErrorChanged
signal void passwordChanged
signal void progressChanged
signal void storePasswordChanged
signal void uploadFinished (bool success, const QString & message)
signal void uploadSkipped (const QString & reason)
signal void urlChanged
signal void usernameChanged

Public Functions

Type Name
WebdavConnection (QObject * parent=nullptr)
QStringList availablePaths () const
Q_INVOKABLE void cancelRequest ()
QStringList checkedPaths () const
Q_INVOKABLE void confirmRequest ()
Q_INVOKABLE void downloadPath (const QString & localPath)
Q_INVOKABLE void fetchAvailablePaths (const QString & remotePath=QString())
Q_INVOKABLE void importPath (const QString & remotePath, const QString & localPath, QString localFolder=QString())
bool isDownloadingPath () const
bool isFetchingAvailablePaths () const
bool isImportingPath () const
bool isPasswordStored () const
bool isUploadingPath () const
QString lastError () const
QString password () const
double progress () const
Q_INVOKABLE void requestUpload (const QString & projectPath, bool force=false)
void setPassword (const QString & password)
void setStorePassword (bool storePassword)
void setUrl (const QString & url)
void setUsername (const QString & username)
bool storePassword () const
Q_INVOKABLE void uploadPaths (const QStringList & localPaths)
QString url () const
QString username () const
~WebdavConnection () = default

Public Static Functions

Type Name
Q_INVOKABLE QStringList findWebdavProjectFolders (const QString & basePath)
Q_INVOKABLE QString findWebdavRootForPath (const QString & path)
Q_INVOKABLE void forgetHistory (const QString & url=QString(), const QString & username=QString())
Q_INVOKABLE bool hasWebdavConfiguration (const QString & path)
Q_INVOKABLE QVariantMap importHistory ()

Detailed Description

The WebDAV connection object allows connecting to a WebDAV endpoint and performing push/pull operations for imported content.

Public Properties Documentation

property availablePaths [1/2]

QStringList WebdavConnection::availablePaths;

property checkedPaths [1/2]

QStringList WebdavConnection::checkedPaths;

property isDownloadingPath [1/2]

bool WebdavConnection::isDownloadingPath;

property isFetchingAvailablePaths [1/2]

bool WebdavConnection::isFetchingAvailablePaths;

property isImportingPath [1/2]

bool WebdavConnection::isImportingPath;

property isPasswordStored [1/2]

bool WebdavConnection::isPasswordStored;

property isUploadingPath [1/2]

bool WebdavConnection::isUploadingPath;

property lastError [1/2]

QString WebdavConnection::lastError;

property password [1/2]

QString WebdavConnection::password;

property progress [1/2]

double WebdavConnection::progress;

property storePassword [1/2]

bool WebdavConnection::storePassword;

property url [1/2]

QString WebdavConnection::url;

property username [1/2]

QString WebdavConnection::username;

Public Signals Documentation

signal availablePathsChanged

void WebdavConnection::availablePathsChanged;

signal checkedPathsChanged

void WebdavConnection::checkedPathsChanged;

signal confirmationRequested

void WebdavConnection::confirmationRequested;

signal importSuccessful

void WebdavConnection::importSuccessful;

signal isDownloadingPathChanged

void WebdavConnection::isDownloadingPathChanged;

signal isFetchingAvailablePathsChanged

void WebdavConnection::isFetchingAvailablePathsChanged;

signal isImportingPathChanged

void WebdavConnection::isImportingPathChanged;

signal isPasswordStoredChanged

void WebdavConnection::isPasswordStoredChanged;

signal isUploadingPathChanged

void WebdavConnection::isUploadingPathChanged;

signal lastErrorChanged

void WebdavConnection::lastErrorChanged;

signal passwordChanged

void WebdavConnection::passwordChanged;

signal progressChanged

void WebdavConnection::progressChanged;

signal storePasswordChanged

void WebdavConnection::storePasswordChanged;

signal uploadFinished

void WebdavConnection::uploadFinished;

signal uploadSkipped

void WebdavConnection::uploadSkipped;

signal urlChanged

void WebdavConnection::urlChanged;

signal usernameChanged

void WebdavConnection::usernameChanged;

Public Functions Documentation

function WebdavConnection

explicit WebdavConnection::WebdavConnection (
    QObject * parent=nullptr
) 

function availablePaths [2/2]

inline QStringList WebdavConnection::availablePaths () const

Returns a list of fetched available paths.

See also: fetchAvailablePaths


function cancelRequest

Q_INVOKABLE void WebdavConnection::cancelRequest () 

Cancels a requested download or upload operation. If an upload is active, the per-project upload lock is released. For automatic uploads, uploadFinished() is emitted with a failure status.

See also: confirmationRequested

See also: isDownloadingPath

See also: isUploadingPath


function checkedPaths [2/2]

inline QStringList WebdavConnection::checkedPaths () const

Returns a list of checked paths.

See also: fetchAvailablePaths


function confirmRequest

Q_INVOKABLE void WebdavConnection::confirmRequest () 

Launches a requested download or upload operation after the user has confirmed they want to proceed. This is typically called in response to confirmationRequested().

See also: confirmationRequested

See also: isDownloadingPath

See also: isUploadingPath


function downloadPath

Q_INVOKABLE void WebdavConnection::downloadPath (
    const QString & localPath
) 

Download new and modified files from an imported remote path. localPath the local path within which a remote path was imported into

Note:

This is not a synchronization process; files removed remotely will not be removed locally. Furthermore, all files modified remotely will overwrite locally-stored files.


function fetchAvailablePaths

Q_INVOKABLE void WebdavConnection::fetchAvailablePaths (
    const QString & remotePath=QString()
) 

Fetches available remote paths from the current WebDAV endpoint.


function importPath

Q_INVOKABLE void WebdavConnection::importPath (
    const QString & remotePath,
    const QString & localPath,
    QString localFolder=QString()
) 

Imports a remote path into a local path stored on the device. remotePath the remote path on the WebDAV endpoint. localPath the local path localFolder the local folder name containing the imported remote path content


function isDownloadingPath [2/2]

inline bool WebdavConnection::isDownloadingPath () const

Returns TRUE if the WebDAV connection is conducting a download operation.


function isFetchingAvailablePaths [2/2]

inline bool WebdavConnection::isFetchingAvailablePaths () const

Returns TRUE if the WebDAV connection is conducting a fetching of available remote paths.


function isImportingPath [2/2]

inline bool WebdavConnection::isImportingPath () const

Returns TRUE if the WebDAV connection is conducting an import operation.


function isPasswordStored [2/2]

inline bool WebdavConnection::isPasswordStored () const

Returns TRUE if a password has been stored for a given pair of username and WebDAV URL endpoint.


function isUploadingPath [2/2]

inline bool WebdavConnection::isUploadingPath () const

Returns TRUE if the WebDAV connection is conducting an upload operation.


function lastError [2/2]

inline QString WebdavConnection::lastError () const

Returns the last error string captured by the WebDAV connection.


function password [2/2]

inline QString WebdavConnection::password () const

Returns the authentication password.


function progress [2/2]

double WebdavConnection::progress () const

Returns the progress of an ongoing import, download, or upload operation.

Note:

The returned value's range is 0.0 to 1.0.


function requestUpload

Q_INVOKABLE void WebdavConnection::requestUpload (
    const QString & projectPath,
    bool force=false
) 

Requests an automatic upload for the WebDAV imported project that contains projectPath. This is intended for background or scheduled upload workflows and will not prompt the user for credentials. The upload is skipped if the project is not WebDAV imported, if another upload is already running for the same project (upload lock), if no stored password is available, or if no local changes are detected since the last successful automatic upload (unless force is TRUE).

If the upload does not start, uploadSkipped() is emitted with the reason. If it starts, uploadFinished() is emitted when the upload completes.


function setPassword

void WebdavConnection::setPassword (
    const QString & password
) 

Sets the authentication password.


function setStorePassword

void WebdavConnection::setStorePassword (
    bool storePassword
) 

Sets whether the current authentication password will be saved upon successful list or file transfer operation

Parameters:

  • storePassword set to TRUE to store the current authentication password.

function setUrl

void WebdavConnection::setUrl (
    const QString & url
) 

Sets the WebDAV URL endpoint used to connect, list, and transfer files.

Parameters:

  • url the URL endpoint string

function setUsername

void WebdavConnection::setUsername (
    const QString & username
) 

Sets the authentication username.


function storePassword [2/2]

inline bool WebdavConnection::storePassword () const

Returns TRUE if the current authentication password will be saved upon successful list or file transfer operation.


function uploadPaths

Q_INVOKABLE void WebdavConnection::uploadPaths (
    const QStringList & localPaths
) 

Uploads one or more local files and/or folders to the WebDAV endpoint associated with a project previously imported via WebDAV. The provided localPaths must all belong to the same imported project (i.e. share the same WebDAV configuration); otherwise no upload is started and lastError() is set.

Note:

This is not a synchronization process; files removed locally will not be removed remotely. Modified local files will overwrite their remote versions. Hidden dot-folders are ignored, and the WebDAV configuration and lock files are never uploaded.

Before the upload starts, confirmationRequested() is emitted so the UI can ask the user to confirm. Call confirmRequest() to proceed or cancelRequest() to abort.


function url [2/2]

inline QString WebdavConnection::url () const

Returns the WebDAV URL endpoint used to connect, list, and transfer files.


function username [2/2]

inline QString WebdavConnection::username () const

Returns the authentication username.


function ~WebdavConnection

WebdavConnection::~WebdavConnection () = default

Public Static Functions Documentation

function findWebdavProjectFolders

static Q_INVOKABLE QStringList WebdavConnection::findWebdavProjectFolders (
    const QString & basePath
) 

Scans a directory recursively and returns all folders containing a WebDAV configuration file.

Parameters:

  • basePath the directory to scan

Returns:

list of absolute paths to WebDAV project folders


function findWebdavRootForPath

static Q_INVOKABLE QString WebdavConnection::findWebdavRootForPath (
    const QString & path
) 

Finds the WebDAV project root by walking up from the given path.

Parameters:

  • path the file or folder path to start from

Returns:

the project root path, or empty string if not found


function forgetHistory

static Q_INVOKABLE void WebdavConnection::forgetHistory (
    const QString & url=QString(),
    const QString & username=QString()
) 

function hasWebdavConfiguration

static Q_INVOKABLE bool WebdavConnection::hasWebdavConfiguration (
    const QString & path
) 

Returns TRUE if a given path contains a WebDAV configuration JSON file or is parented to a folder containing such a file.


function importHistory

static Q_INVOKABLE QVariantMap WebdavConnection::importHistory () 

Returns a list of import history.



The documentation for this class was generated from the following file src/core/webdavconnection.h