KIO::NetAccess Class Reference
Net Transparency. Provides an easy, synchronous interface to KIO file operations. More...
#include <netaccess.h>
Inheritance diagram for KIO::NetAccess:

Static Public Member Functions | |
bool | download (const KURL &src, QString &target, QWidget *window) |
bool | download (const KURL &src, QString &target) KDE_DEPRECATED |
void | removeTempFile (const QString &name) |
bool | upload (const QString &src, const KURL &target, QWidget *window) |
bool | upload (const QString &src, const KURL &target) KDE_DEPRECATED |
bool | copy (const KURL &src, const KURL &target, QWidget *window) |
bool | copy (const KURL &src, const KURL &target) KDE_DEPRECATED |
bool | file_copy (const KURL &src, const KURL &dest, int permissions=-1, bool overwrite=false, bool resume=false, QWidget *window=0L) |
bool | file_move (const KURL &src, const KURL &target, int permissions=-1, bool overwrite=false, bool resume=false, QWidget *window=0L) |
bool | dircopy (const KURL &src, const KURL &target, QWidget *window) |
bool | dircopy (const KURL &src, const KURL &target) KDE_DEPRECATED |
bool | dircopy (const KURL::List &src, const KURL &target, QWidget *window=0L) |
bool | move (const KURL &src, const KURL &target, QWidget *window=0L) |
bool | move (const KURL::List &src, const KURL &target, QWidget *window=0L) |
bool | exists (const KURL &url, bool source, QWidget *window) |
bool | exists (const KURL &url, QWidget *window) KDE_DEPRECATED |
bool | exists (const KURL &url) KDE_DEPRECATED |
bool | exists (const KURL &url, bool source) KDE_DEPRECATED |
bool | stat (const KURL &url, KIO::UDSEntry &entry, QWidget *window) |
bool | stat (const KURL &url, KIO::UDSEntry &entry) KDE_DEPRECATED |
bool | del (const KURL &url, QWidget *window) |
bool | del (const KURL &url) KDE_DEPRECATED |
bool | mkdir (const KURL &url, QWidget *window, int permissions=-1) |
bool | mkdir (const KURL &url, int permissions=-1) KDE_DEPRECATED |
QString | fish_execute (const KURL &url, const QString command, QWidget *window) |
bool | synchronousRun (Job *job, QWidget *window, QByteArray *data=0, KURL *finalURL=0, QMap< QString, QString > *metaData=0) |
QString | mimetype (const KURL &url, QWidget *window) |
QString | mimetype (const KURL &url) KDE_DEPRECATED |
QString | lastErrorString () |
int | lastError () |
Friends | |
class | I_like_this_class |
Detailed Description
Net Transparency. Provides an easy, synchronous interface to KIO file operations.NetAccess allows you to do simple file operation (load, save, copy, delete...) without working with KIO::Job directly. 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. The functions appear to be blocking, but the Qt event loop continues running while the operations are handled. This means that the GUI will not freeze.
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.
Port to kio done by David Faure, faure@kde.org
Definition at line 59 of file netaccess.h.
Member Function Documentation
|
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, window ) ) { loadFile( tmpFile ); KIO::NetAccess::removeTempFile( tmpFile ); } else { KMessageBox::error(this, KIO::NetAccess::lastErrorString() ); } Of course, your user interface will still process exposure/repaint events during the download. If the download fails, lastError() and lastErrorString() will be set.
Definition at line 57 of file netaccess.cpp. References filecopyInternal(), KURL::isLocalFile(), KTempFile::name(), KURL::path(), and KURL::setPath(). Referenced by download(). |
|
Definition at line 52 of file netaccess.cpp. References download(). |
|
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.
Definition at line 254 of file netaccess.cpp. |
|
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.
Definition at line 94 of file netaccess.cpp. References filecopyInternal(), KURL::isEmpty(), KURL::isLocalFile(), KURL::path(), and KURL::setPath(). Referenced by KIO::pasteData(), and upload(). |
|
Definition at line 89 of file netaccess.cpp. References upload(). |
|
Alternative to upload 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!). It will be renamed file_copy in KDE4, so better use file_copy.
Definition at line 117 of file netaccess.cpp. References file_copy(). |
|
Definition at line 112 of file netaccess.cpp. References file_copy(). |
|
Full-fledged equivalent of KIO::file_copy.
Definition at line 122 of file netaccess.cpp. References filecopyInternal(). Referenced by copy(). |
|
Full-fledged equivalent of KIO::file_move. Moves or renames *one file*.
Definition at line 131 of file netaccess.cpp. References filecopyInternal(). |
|
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!. This means that it can copy files and directories alike (it should have been named copy()).
Definition at line 144 of file netaccess.cpp. Referenced by dircopy(). |
|
Definition at line 139 of file netaccess.cpp. References dircopy(). |
|
Overloaded method, which takes a list of source URLs.
Definition at line 151 of file netaccess.cpp. References dircopyInternal(). |
|
Full-fledged equivalent of KIO::move. Moves or renames one file or directory.
Definition at line 157 of file netaccess.cpp. |
|
Full-fledged equivalent of KIO::move. Moves or renames a list of files or directories.
Definition at line 164 of file netaccess.cpp. References dircopyInternal(). |
|
Tests whether a URL exists.
Definition at line 185 of file netaccess.cpp. References KURL::isLocalFile(), KURL::path(), and statInternal(). Referenced by exists(), and KDirOperator::mkdir(). |
|
Definition at line 175 of file netaccess.cpp. References exists(). |
|
Definition at line 170 of file netaccess.cpp. References exists(). |
|
Definition at line 180 of file netaccess.cpp. References exists(). |
|
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).
Definition at line 198 of file netaccess.cpp. References m_entry, statInternal(), and KIO::UDSEntry. Referenced by KPropertiesDialog::KPropertiesDialog(), and stat(). |
|
Definition at line 193 of file netaccess.cpp. References stat(), and KIO::UDSEntry. |
|
Deletes a file or a directory in a synchronous way. This is a convenience function for KIO::del (it saves creating a slot and testing for the job result).
Definition at line 212 of file netaccess.cpp. References delInternal(). Referenced by del(). |
|
Definition at line 207 of file netaccess.cpp. References del(). |
|
Creates a directory in a synchronous way.
This is a convenience function for
Definition at line 223 of file netaccess.cpp. References mkdirInternal(). Referenced by mkdir(), and KDirOperator::mkdir(). |
|
Definition at line 218 of file netaccess.cpp. References mkdir(). |
|
Executes a remote process via the fish ioslave in a synchronous way.
Definition at line 229 of file netaccess.cpp. References fish_executeInternal(). |
|
This function executes a job in a synchronous way. If a job fetches some data, pass a QByteArray pointer as data parameter to this function and after the function returns it will contain all the data fetched by this job.
Definition at line 235 of file netaccess.cpp. References synchronousRunInternal(). |
|
Definition at line 242 of file netaccess.cpp. References mimetypeInternal(). |
|
Returns the error string for the last job, in case it failed. Note that this is already translated.
Definition at line 445 of file netaccess.h. |
|
Returns the error code for the last job, in case it failed.
Definition at line 452 of file netaccess.h. |
The documentation for this class was generated from the following files: