The Q3UrlOperator class provides common operations on URLs. More...

Detailed Description

This class operates on hierarchical structures (such as filesystems) using URLs. Its API facilitates all the common operations:

List fileslistChildren()
Make a directorymkdir()
Remove a fileremove()
Rename a filerename()
Get a fileget()
Put a fileput()
Copy a filecopy()

You can obtain additional information about the URL with isDir() and info(). If a directory is to be traversed using listChildren(), a name filter can be set with setNameFilter().

A Q3UrlOperator can be used like this, for example to download a file (and assuming that the FTP protocol is registered):

Q3UrlOperator *op = new Q3UrlOperator();
op->copy( QString(""),
         "file:///tmp" );

If you want to be notified about success/failure, progress, etc., you can connect to Q3UrlOperator's signals, e.g. to start(), newChildren(), createdDirectory(), removed(), data(), dataTransferProgress(), startedNextCopy(), connectionStateChanged(), finished(), etc. A network operation can be stopped with stop().

The class uses the functionality of registered network protocols to perform these operations. Depending of the protocol of the URL, it uses an appropriate network protocol class for the operations. Each of the operation functions of Q3UrlOperator creates a Q3NetworkOperation object that describes the operation and puts it into the operation queue for the network protocol used. If no suitable protocol could be found (because no implementation of the necessary network protocol is registered), the URL operator emits errors. Not every protocol supports every operation, but error handling deals with this problem.

To register the available network protocols, use the qInitNetworkProtocols() function. The protocols currently supported are:

See also Q3NetworkProtocol and Q3NetworkOperation.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.