KIO::SimpleJob Class

class KIO::SimpleJob

A simple job (one url and one command). More...

Header: #include <KIO/SimpleJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)
Inherits: KIO::Job
Inherited By:

KIO::EmptyTrashJob, KIO::FileJob, KIO::FileSystemFreeSpaceJob, KIO::ListJob, KIO::MkdirJob, KIO::StatJob, and KIO::TransferJob

Public Functions

bool isRedirectionHandlingEnabled() const
virtual void putOnHold()
void setRedirectionHandlingEnabled(bool handle)
const QUrl &url() const

Static Public Members

void removeOnHold()

Protected Slots

virtual void slotFinished()
virtual void slotMetaData(const KIO::MetaData &_metaData)
KIO::SimpleJob *chmod(const QUrl &url, int permissions)
KIO::SimpleJob *chown(const QUrl &url, const QString &owner, const QString &group)
KIO::SimpleJob *file_delete(const QUrl &src, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *rename(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *rmdir(const QUrl &url)
KIO::SimpleJob *setModificationTime(const QUrl &url, const QDateTime &mtime)
KIO::SimpleJob *special(const QUrl &url, const QByteArray &data, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *symlink(const QString &target, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *unmount(const QString &point, KIO::JobFlags flags = DefaultFlags)

Detailed Description

This is the base class for all jobs that are scheduled. Other jobs are high-level jobs (CopyJob, DeleteJob, FileCopyJob...) that manage subjobs but aren't scheduled directly.

Member Function Documentation

bool SimpleJob::isRedirectionHandlingEnabled() const

Returns true when redirections are handled internally, the default.

[virtual] void SimpleJob::putOnHold()

Abort job. Suspends worker to be reused by another job for the same request.

[static] void SimpleJob::removeOnHold()

Discard suspended worker.

void SimpleJob::setRedirectionHandlingEnabled(bool handle)

Set handle to false to prevent the internal handling of redirections.

When this flag is set, redirection requests are simply forwarded to the caller instead of being handled internally.

See also isRedirectionHandlingEnabled().

[virtual protected slot] void SimpleJob::slotFinished()

Called when the worker marks the job as finished.

[virtual protected slot] void SimpleJob::slotMetaData(const KIO::MetaData &_metaData)

MetaData from the worker is received.

_metaData the meta data

See also metaData().

const QUrl &SimpleJob::url() const

Returns the SimpleJob's URL

Related Non-Members

KIO::SimpleJob *chmod(const QUrl &url, int permissions)

Changes permissions on a file or directory. See the other chmod in chmodjob.h for changing many files or directories.

url The URL of file or directory.

permissions The permissions to set.

Returns the job handling the operation.

KIO::SimpleJob *chown(const QUrl &url, const QString &owner, const QString &group)

Changes ownership and group of a file or directory.

url The URL of file or directory.

owner the new owner

group the new group

Returns the job handling the operation.

KIO::SimpleJob *file_delete(const QUrl &src, KIO::JobFlags flags = DefaultFlags)

Delete a single file.

src File to delete.

flags Can be HideProgressInfo here

Returns the job handling the operation.

KIO::SimpleJob *mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, KIO::JobFlags flags = DefaultFlags)

Mount filesystem.

Special job for kio_file.

ro Mount read-only if true.

fstype File system type (e.g. "ext2", can be empty).

dev Device (e.g. /dev/sda0).

point Mount point, can be null.

flags Can be HideProgressInfo here

Returns the job handling the operation.

KIO::SimpleJob *rename(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Rename a file or directory. Warning: this operation fails if a direct renaming is not possible (like with files or dirs on separate partitions) Use move or file_move in this case.

src The original URL

dest The final URL

flags Can be Overwrite here

Returns the job handling the operation.

KIO::SimpleJob *rmdir(const QUrl &url)

Removes a single directory.

The directory is assumed to be empty. The job will fail if the directory is not empty. Use KIO::del() (DeleteJob) to delete non-empty directories.

url The URL of the directory to remove.

Returns a pointer to the job handling the operation.

KIO::SimpleJob *setModificationTime(const QUrl &url, const QDateTime &mtime)

Changes the modification time on a file or directory.

url The URL of file or directory.

mtime The modification time to set.

Returns the job handling the operation.

KIO::SimpleJob *special(const QUrl &url, const QByteArray &data, KIO::JobFlags flags = DefaultFlags)

Execute any command that is specific to one worker (protocol).

Examples are : HTTP POST, mount and unmount (kio_file)

url The URL isn't passed to the worker, but is used to know which worker to send it to :-)

data Packed data. The meaning is completely dependent on the worker, but usually starts with an int for the command number.

flags Can be HideProgressInfo here

Returns the job handling the operation.

Create or move a symlink. This is the lowlevel operation, similar to file_copy and file_move. It doesn't do any check (other than those the worker does) and it doesn't show rename and skip dialogs - use KIO::link for that.

target The string that will become the "target" of the link (can be relative)

dest The symlink to create.

flags Can be Overwrite and HideProgressInfo

Returns the job handling the operation.

KIO::SimpleJob *unmount(const QString &point, KIO::JobFlags flags = DefaultFlags)

Unmount filesystem.

Special job for kio_file.

point Point to unmount.

flags Can be HideProgressInfo here

Returns the job handling the operation.