#include <netaccess.h>
Static Public Methods | |
| bool | download (const KURL &src, QString &target) |
| void | removeTempFile (const QString &name) |
| bool | upload (const QString &src, const KURL &target) |
| bool | copy (const KURL &src, const KURL &target) |
| bool | dircopy (const KURL &src, const KURL &target) |
| bool | exists (const KURL &url) |
| bool | exists (const KURL &url, bool source) |
| bool | stat (const KURL &url, KIO::UDSEntry &entry) |
| bool | del (const KURL &url) |
| bool | mkdir (const KURL &url, int permissions=-1) |
| QString | mimetype (const KURL &url) |
| QString | lastErrorString () |
Net Transparency, formerly provided by kfmlib, but now done with KIO::Job.
This class isn't meant to be used as a class but only as a simple namespace for static functions, though an instance of the class is built for internal purposes. Whereas a KIO::Job is asynchronous, meaning that the developer has to connect slots for it, KIO::NetAccess provides synchronous downloads and uploads, as well as temporary file creation and removal.
Port to kio done by David Faure, faure@kde.org
Definition at line 52 of file netaccess.h.
|
||||||||||||
|
Alternative method for copying over the network. Overwrite is false, so this will fail if This one takes two URLs and is a direct equivalent of KIO::file_copy (not KIO::copy!). |
|
|
Deletes a file or a directory in an synchronous way. This is a convenience function for KIO::del (it saves creating a slot and testing for the job result).
|
|
||||||||||||
|
Alternative method for copying over the network. Overwrite is false, so this will fail if This one takes two URLs and is a direct equivalent of KIO::copy!. |
|
||||||||||||
|
Downloads a file from an arbitrary URL (
If the argument for
Special case: If the URL is of kind file:, then no downloading is processed but the full filename is returned in
Download is synchronous. That means you can use it like this, (assuming
QString tmpFile;
if( KIO::NetAccess::download( u, tmpFile ) )
{
loadFile( tmpFile );
KIO::NetAccess::removeTempFile( tmpFile );
}
Of course, your user interface will still process exposure/repaint events during the download.
|
|
||||||||||||
|
Overloaded version of exists A stat() can have two meanings. Either we want to read from this URL, or to check if we can write to it. First case is "source", second is "dest". It is necessary to know what the StatJob is for, to tune the kioslave's behaviour (e.g. with FTP) Tests whether a URL exists.
|
|
|
Tests whether a URL exists. This is a convenience function for KIO::stat (it saves creating a slot and testing for the job result).
|
|
|
Returns the error string for the last job, in case it failed. Definition at line 220 of file netaccess.h. |
|
|
Determines the mimetype of a given URL. This is a convenience function for KIO::mimetype. You should call this only when really necessary. KMimeType::findByURL can determine extension a lot faster, but less reliably for remote files. Only when findByURL() returns unknown (application/octet-stream) then this one should be used.
|
|
||||||||||||
|
Creates a directory in a synchronous way.
This is a convenience function for
|
|
|
Removes the specified file if and only if it was created by KIO::NetAccess as a temporary file for a former download. Note: This means that if you created your temporary with KTempFile, use KTempFile::unlink() or KTempFile::setAutoDelete() to have it removed.
|
|
||||||||||||
|
Tests whether a URL exists and return information on it. This is a convenience function for KIO::stat (it saves creating a slot and testing for the job result).
|
|
||||||||||||
|
Uploads file Both must be specified, unlike download. Note that this is assumed to be used for saving a file over the network, so overwriting is set to true. This is not the case with copy.
|
1.2.18