KIO Namespace

A namespace for KIO globals. More...

Header: #include <KIO>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)

Classes

(since 5.78) class AskUserActionInterface
class AuthInfo
(since 5.42) class BatchRenameJob
class ChmodJob
class CopyJob
class DavJob
class DeleteJob
(since 5.0) class DesktopExecParser
class DirectorySizeJob
(since 5.2) class EmptyTrashJob
class FileCopyJob
class FileJob
(since 5.3) class FileSystemFreeSpaceJob
(since 5.101) class ForwardingWorkerBase
class Job
(since 5.0) class JobUiDelegateExtension
(since 5.0) class JobUiDelegateFactory
class ListJob
(since 5.80) class MimeTypeFinderJob
class MimetypeJob
class MkdirJob
(since 5.4) class MkpathJob
(since 5.76) class NameFinderJob
class OpenWith
(since 5.2) class RestoreJob
class SimpleJob
class SpecialJob
class StatJob
class StoredTransferJob
class TransferJob
class UDSEntry
(since 5.70) class UntrustedProgramHandlerInterface
(since 5.96) class WorkerBase
class WorkerConfig
class WorkerResult

Types

enum Error { ERR_CANNOT_OPEN_FOR_READING, ERR_CANNOT_OPEN_FOR_WRITING, ERR_CANNOT_LAUNCH_PROCESS, ERR_INTERNAL, ERR_MALFORMED_URL, …, ERR_TRASH_FILE_TOO_LARGE }
enum Info { INF_TOTAL_SIZE, INF_PROCESSED_SIZE, INF_SPEED, INF_REDIRECTION, INF_MIME_TYPE, …, INF_SSLERROR }
enum JobFlag { DefaultFlags, HideProgressInfo, Resume, Overwrite, NoPrivilegeExecution }
flags JobFlags
enum LoadType { Reload, NoReload }
enum Message { MSG_DATA, MSG_DATA_REQ, MSG_ERROR, MSG_CONNECTED, MSG_FINISHED, …, MSG_WORKER_STATUS }
(since 5.43) enum PrivilegeOperationStatus { OperationAllowed, OperationCanceled, OperationNotAllowed }
(since 5.0) enum RenameDialog_Option { RenameDialog_Overwrite, RenameDialog_OverwriteItself, RenameDialog_Skip, RenameDialog_MultipleItems, RenameDialog_Resume, …, RenameDialog_SourceIsDirectory }
flags RenameDialog_Options
enum RenameDialog_Result { Result_Cancel, Result_Rename, Result_Skip, Result_AutoSkip, Result_Overwrite, …, Result_ReplaceAllInvalidChars }
(since 5.0) enum SkipDialog_Option { SkipDialog_MultipleItems, SkipDialog_Replace_Invalid_Chars, SkipDialog_Hide_Retry }
flags SkipDialog_Options
(since 5.69) enum StatDetail { StatNoDetails, StatBasic, StatUser, StatResolveSymlink, StatAcl, …, StatDefaultDetails }
flags StatDetails
UDSEntryList

Functions

(since 5.42) KIO::BatchRenameJob *batchRename(const QList<QUrl> &src, const QString &newName, int index, QChar placeHolder, KIO::JobFlags flags = DefaultFlags)
QString buildErrorString(int errorCode, const QString &errorText)
unsigned int calculateRemainingSeconds(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed)
KIO::SimpleJob *chmod(const QUrl &url, int permissions)
KIO::ChmodJob *chmod(const KFileItemList &lstItems, int permissions, int mask, const QString &newOwner, const QString &newGroup, bool recursive, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *chown(const QUrl &url, const QString &owner, const QString &group)
QFileDevice::Permissions convertPermissions(int permissions)
QString convertSeconds(unsigned int seconds)
QString convertSize(KIO::filesize_t size)
QString convertSizeFromKiB(KIO::filesize_t kibSize)
KIO::CopyJob *copy(const QList<QUrl> &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *copy(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *copyAs(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KJobUiDelegate *createDefaultJobUiDelegate()
(since 5.98) KJobUiDelegate *createDefaultJobUiDelegate(KJobUiDelegate::Flags flags, QWidget *window)
(since 5.84) KIO::DavJob *davPropFind(const QUrl &url, const QString &properties, const QString &depth, KIO::JobFlags flags = DefaultFlags)
(since 5.84) KIO::DavJob *davPropPatch(const QUrl &url, const QString &properties, KIO::JobFlags flags = DefaultFlags)
KIO::DavJob *davReport(const QUrl &url, const QString &report, const QString &depth, KIO::JobFlags flags = DefaultFlags)
KIO::DavJob *davSearch(const QUrl &url, const QString &nsURI, const QString &qName, const QString &query, KIO::JobFlags flags = DefaultFlags)
QString decodeFileName(const QString &str)
(since 5.0) KIO::JobUiDelegateExtension *defaultJobUiDelegateExtension()
(since 6.0) KIO::JobUiDelegateFactory *defaultJobUiDelegateFactory()
KIO::DeleteJob *del(const QList<QUrl> &src, KIO::JobFlags flags = DefaultFlags)
KIO::DeleteJob *del(const QUrl &src, KIO::JobFlags flags = DefaultFlags)
(since 5.78) T delegateExtension(KJob *job)
KIO::DirectorySizeJob *directorySize(const KFileItemList &lstItems)
KIO::DirectorySizeJob *directorySize(const QUrl &directory)
(since 5.2) KIO::EmptyTrashJob *emptyTrash()
QString encodeFileName(const QString &str)
(since 5.0) QString favIconForUrl(const QUrl &url)
KIO::FileSystemFreeSpaceJob *fileSystemFreeSpace(const QUrl &url)
KIO::FileCopyJob *file_copy(const QUrl &src, const QUrl &dest, KIO::JobFlags flags)
KIO::FileCopyJob *file_copy(const QUrl &src, const QUrl &dest, int permissions = -1, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *file_delete(const QUrl &src, KIO::JobFlags flags = DefaultFlags)
KIO::FileCopyJob *file_move(const QUrl &src, const QUrl &dest, int permissions = -1, KIO::JobFlags flags = DefaultFlags)
KIO::TransferJob *get(const QUrl &url, KIO::LoadType reload = NoReload, KIO::JobFlags flags = DefaultFlags)
KJobTrackerInterface *getJobTracker()
(since 4.7.3) KIO::TransferJob *http_delete(const QUrl &url, KIO::JobFlags flags = DefaultFlags)
KIO::TransferJob *http_post(const QUrl &url, const QByteArray &postData, KIO::JobFlags flags = DefaultFlags)
KIO::TransferJob *http_post(const QUrl &url, QIODevice *device, qint64 size = -1, KIO::JobFlags flags = DefaultFlags)
(since 5.0) QString iconNameForUrl(const QUrl &url)
QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize)
KIO::CopyJob *link(const QList<QUrl> &src, const QUrl &destDir, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *link(const QUrl &src, const QUrl &destDir, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *linkAs(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::ListJob *listDir(const QUrl &url, KIO::JobFlags flags = DefaultFlags, KIO::ListJob::ListFlags listFlags = ListJob::ListFlag::IncludeHidden)
KIO::ListJob *listRecursive(const QUrl &url, KIO::JobFlags flags = DefaultFlags, KIO::ListJob::ListFlags listFlags = ListJob::ListFlag::IncludeHidden)
KIO::MimetypeJob *mimetype(const QUrl &url, KIO::JobFlags flags = DefaultFlags)
KIO::MkdirJob *mkdir(const QUrl &url, int permissions = -1)
(since 5.4) KIO::MkpathJob *mkpath(const QUrl &url, const QUrl &baseUrl = QUrl(), KIO::JobFlags flags = DefaultFlags)
KIO::StatJob *mostLocalUrl(const QUrl &url, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *move(const QList<QUrl> &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *move(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *moveAs(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
QString number(KIO::filesize_t size)
KIO::FileJob *open(const QUrl &url, QIODeviceBase::OpenMode mode)
KIO::TransferJob *put(const QUrl &url, int permissions, KIO::JobFlags flags = DefaultFlags)
QByteArray rawErrorDetail(int errorCode, const QString &errorText, const QUrl *reqUrl = nullptr, int method = -1)
KIO::SimpleJob *rename(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
(since 5.2) KIO::RestoreJob *restoreFromTrash(const QList<QUrl> &urls, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *rmdir(const QUrl &url)
(since 5.0) void setDefaultJobUiDelegateExtension(KIO::JobUiDelegateExtension *extension)
(since 6.0) void setDefaultJobUiDelegateFactory(KIO::JobUiDelegateFactory *factory)
KIO::SimpleJob *setModificationTime(const QUrl &url, const QDateTime &mtime)
KIO::SimpleJob *special(const QUrl &url, const QByteArray &data, KIO::JobFlags flags = DefaultFlags)
KIO::StatJob *stat(const QUrl &url, KIO::JobFlags flags = DefaultFlags)
(since 6.0) KIO::StatJob *stat(const QUrl &url, KIO::StatJob::StatSide side, KIO::StatDetails details = KIO::StatDefaultDetails, KIO::JobFlags flags = DefaultFlags)
KIO::StoredTransferJob *storedGet(const QUrl &url, KIO::LoadType reload = NoReload, KIO::JobFlags flags = DefaultFlags)
KIO::StoredTransferJob *storedHttpPost(const QByteArray &arr, const QUrl &url, KIO::JobFlags flags = DefaultFlags)
KIO::StoredTransferJob *storedHttpPost(QIODevice *device, const QUrl &url, qint64 size = -1, KIO::JobFlags flags = DefaultFlags)
(since 5.10) KIO::StoredTransferJob *storedPut(QIODevice *input, const QUrl &url, int permissions, KIO::JobFlags flags = DefaultFlags)
KIO::StoredTransferJob *storedPut(const QByteArray &arr, const QUrl &url, int permissions, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *symlink(const QString &target, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *trash(const QList<QUrl> &src, KIO::JobFlags flags = DefaultFlags)
KIO::CopyJob *trash(const QUrl &src, KIO::JobFlags flags = DefaultFlags)
KIO::SimpleJob *unmount(const QString &point, KIO::JobFlags flags = DefaultFlags)
QString unsupportedActionErrorString(const QString &protocol, int cmd)
(since 5.0) QUrl upUrl(const QUrl &url)
(since 5.63) bool operator!=(const KIO::UDSEntry &entry, const KIO::UDSEntry &other)
QDBusArgument &operator<<(QDBusArgument &argument, const KIO::AuthInfo &a)
QDataStream &operator<<(QDataStream &s, const KIO::AuthInfo &a)
(since 5.63) bool operator==(const KIO::UDSEntry &entry, const KIO::UDSEntry &other)
QDataStream &operator>>(QDataStream &s, KIO::AuthInfo &a)
const QDBusArgument &operator>>(const QDBusArgument &argument, KIO::AuthInfo &a)

Detailed Description

Classes

class AskUserActionInterface

The AskUserActionInterface class allows a KIO::Job to prompt the user for a decision when e.g. copying directories/files and there is a conflict (e.g. a file with the same name already exists at the destination). More...

class AuthInfo

A two way messaging class for passing authentication information. More...

class BatchRenameJob

A KIO job that renames multiple files in one go. More...

class ChmodJob

This job changes permissions on a list of files or directories, optionally in a recursive manner. More...

class CopyJob

CopyJob is used to move, copy or symlink files and directories. More...

class DavJob

class DeleteJob

A more complex Job to delete files and directories. More...

class DesktopExecParser

Parses the Exec= line from a .desktop file, and process all the '%' placeholders, e.g. handling URLs vs local files. More...

class DirectorySizeJob

Computes a directory size. More...

class EmptyTrashJob

class FileCopyJob

class FileJob

class FileSystemFreeSpaceJob

A KIO job that retrieves the total and available size of a filesystem. More...

class ForwardingWorkerBase

Worker that forwards to other workers. More...

class Job

class JobUiDelegateExtension

class JobUiDelegateFactory

A factory for creating job ui delegates. More...

class ListJob

A ListJob is allows you to get the get the content of a directory. More...

class MimeTypeFinderJob

MimeTypeFinderJob finds out the MIME type of a URL. More...

class MimetypeJob

class MkdirJob

class MkpathJob

A KIO job that creates a directory, after creating all parent directories necessary for this. More...

class NameFinderJob

NameFinderJob finds a valid "New Folder" name. More...

class OpenWith

Core class for open with style dialog handling. More...

class RestoreJob

RestoreJob is used to restore files from the trash. More...

class SimpleJob

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

class SpecialJob

A class that sends a special command to a KIO worker. More...

class StatJob

A KIO job that retrieves information about a file or directory. More...

class StoredTransferJob

StoredTransferJob is a TransferJob (for downloading or uploading data) that also stores a QByteArray with the data, making it simpler to use than the standard TransferJob. More...

class TransferJob

The transfer job pumps data into and/or out of a KIO worker. More...

class UDSEntry

Universal Directory Service. More...

class UntrustedProgramHandlerInterface

The UntrustedProgramHandlerInterface class allows ApplicationLauncherJob to prompt the user about an untrusted executable or desktop file. More...

class WorkerBase

WorkerBase is the class to use to implement a worker - simply inherit WorkerBase in your worker. More...

class WorkerConfig

This class manages the configuration for KIO workers based on protocol and host. More...

class WorkerResult

The result of a worker call. More...

Type Documentation

enum KIO::Error

Error codes that can be emitted by KIO.

ConstantValueDescription
KIO::ERR_CANNOT_OPEN_FOR_READINGKJob::UserDefinedError + 1 
KIO::ERR_CANNOT_OPEN_FOR_WRITINGKJob::UserDefinedError + 2 
KIO::ERR_CANNOT_LAUNCH_PROCESSKJob::UserDefinedError + 3 
KIO::ERR_INTERNALKJob::UserDefinedError + 4 
KIO::ERR_MALFORMED_URLKJob::UserDefinedError + 5 
KIO::ERR_UNSUPPORTED_PROTOCOLKJob::UserDefinedError + 6 
KIO::ERR_NO_SOURCE_PROTOCOLKJob::UserDefinedError + 7 
KIO::ERR_UNSUPPORTED_ACTIONKJob::UserDefinedError + 8 
KIO::ERR_IS_DIRECTORYKJob::UserDefinedError + 9... where a file was expected
KIO::ERR_IS_FILEKJob::UserDefinedError + 10... where a directory was expected (e.g. listing)
KIO::ERR_DOES_NOT_EXISTKJob::UserDefinedError + 11 
KIO::ERR_FILE_ALREADY_EXISTKJob::UserDefinedError + 12 
KIO::ERR_DIR_ALREADY_EXISTKJob::UserDefinedError + 13 
KIO::ERR_UNKNOWN_HOSTKJob::UserDefinedError + 14 
KIO::ERR_ACCESS_DENIEDKJob::UserDefinedError + 15 
KIO::ERR_WRITE_ACCESS_DENIEDKJob::UserDefinedError + 16 
KIO::ERR_CANNOT_ENTER_DIRECTORYKJob::UserDefinedError + 17 
KIO::ERR_PROTOCOL_IS_NOT_A_FILESYSTEMKJob::UserDefinedError + 18 
KIO::ERR_CYCLIC_LINKKJob::UserDefinedError + 19 
KIO::ERR_USER_CANCELEDKJob::KilledJobError 
KIO::ERR_CYCLIC_COPYKJob::UserDefinedError + 21 
KIO::ERR_CANNOT_CREATE_SOCKETKJob::UserDefinedError + 22 
KIO::ERR_CANNOT_CONNECTKJob::UserDefinedError + 23 
KIO::ERR_CONNECTION_BROKENKJob::UserDefinedError + 24 
KIO::ERR_NOT_FILTER_PROTOCOLKJob::UserDefinedError + 25 
KIO::ERR_CANNOT_MOUNTKJob::UserDefinedError + 26 
KIO::ERR_CANNOT_UNMOUNTKJob::UserDefinedError + 27 
KIO::ERR_CANNOT_READKJob::UserDefinedError + 28 
KIO::ERR_CANNOT_WRITEKJob::UserDefinedError + 29 
KIO::ERR_CANNOT_BINDKJob::UserDefinedError + 30 
KIO::ERR_CANNOT_LISTENKJob::UserDefinedError + 31 
KIO::ERR_CANNOT_ACCEPTKJob::UserDefinedError + 32 
KIO::ERR_CANNOT_LOGINKJob::UserDefinedError + 33 
KIO::ERR_CANNOT_STATKJob::UserDefinedError + 34 
KIO::ERR_CANNOT_CLOSEDIRKJob::UserDefinedError + 35 
KIO::ERR_CANNOT_MKDIRKJob::UserDefinedError + 37 
KIO::ERR_CANNOT_RMDIRKJob::UserDefinedError + 38 
KIO::ERR_CANNOT_RESUMEKJob::UserDefinedError + 39 
KIO::ERR_CANNOT_RENAMEKJob::UserDefinedError + 40 
KIO::ERR_CANNOT_CHMODKJob::UserDefinedError + 41 
KIO::ERR_CANNOT_DELETEKJob::UserDefinedError + 42 
KIO::ERR_WORKER_DIED (since Qt 5.96)KJob::UserDefinedError + 43The text argument is the protocol that the dead worker supported. This means for example: file, ftp, http, ...
KIO::ERR_OUT_OF_MEMORYKJob::UserDefinedError + 44 
KIO::ERR_UNKNOWN_PROXY_HOSTKJob::UserDefinedError + 45 
KIO::ERR_CANNOT_AUTHENTICATEKJob::UserDefinedError + 46 
KIO::ERR_ABORTEDKJob::UserDefinedError + 47Action got aborted from application side
KIO::ERR_INTERNAL_SERVERKJob::UserDefinedError + 48 
KIO::ERR_SERVER_TIMEOUTKJob::UserDefinedError + 49 
KIO::ERR_SERVICE_NOT_AVAILABLEKJob::UserDefinedError + 50 
KIO::ERR_UNKNOWNKJob::UserDefinedError + 51 
KIO::ERR_UNKNOWN_INTERRUPTKJob::UserDefinedError + 53 
KIO::ERR_CANNOT_DELETE_ORIGINALKJob::UserDefinedError + 54 
KIO::ERR_CANNOT_DELETE_PARTIALKJob::UserDefinedError + 55 
KIO::ERR_CANNOT_RENAME_ORIGINALKJob::UserDefinedError + 56 
KIO::ERR_CANNOT_RENAME_PARTIALKJob::UserDefinedError + 57 
KIO::ERR_NEED_PASSWDKJob::UserDefinedError + 58 
KIO::ERR_CANNOT_SYMLINKKJob::UserDefinedError + 59 
KIO::ERR_NO_CONTENTKJob::UserDefinedError + 60Action succeeded but no content will follow
KIO::ERR_DISK_FULLKJob::UserDefinedError + 61 
KIO::ERR_IDENTICAL_FILESKJob::UserDefinedError + 62src==dest when moving/copying
KIO::ERR_WORKER_DEFINED (since Qt 5.96)KJob::UserDefinedError + 63For worker specified errors that can be rich text. Email links will be handled by the standard email app and all hrefs will be handled by the standard browser. <a href="exec:/khelpcenter ?"> will be forked.
KIO::ERR_UPGRADE_REQUIREDKJob::UserDefinedError + 64A transport upgrade is required to access this object. For instance, TLS is demanded by the server in order to continue
KIO::ERR_POST_DENIEDKJob::UserDefinedError + 65Issued when trying to POST data to a certain Ports
KIO::ERR_CANNOT_SEEKKJob::UserDefinedError + 66 
KIO::ERR_CANNOT_SETTIMEKJob::UserDefinedError + 67Emitted by setModificationTime
KIO::ERR_CANNOT_CHOWNKJob::UserDefinedError + 68 
KIO::ERR_POST_NO_SIZEKJob::UserDefinedError + 69 
KIO::ERR_DROP_ON_ITSELF (since Qt 5.6)KJob::UserDefinedError + 70from KIO::DropJob
KIO::ERR_CANNOT_MOVE_INTO_ITSELF (since Qt 5.18)KJob::UserDefinedError + 71emitted by KIO::move
KIO::ERR_PASSWD_SERVER (since Qt 5.24)KJob::UserDefinedError + 72returned by WorkerBase::openPasswordDialog
KIO::ERR_CANNOT_CREATE_WORKER (since Qt 5.96)KJob::UserDefinedError + 73used by Worker::createWorker
KIO::ERR_FILE_TOO_LARGE_FOR_FAT32 (since Qt 5.54)KJob::UserDefinedError + 74 
KIO::ERR_OWNER_DIED (since Qt 5.54)KJob::UserDefinedError + 75Value used between kuiserver and views when the job owner disappears unexpectedly. It should not be emitted by workers
KIO::ERR_PRIVILEGE_NOT_REQUIRED (since Qt 5.60)KJob::UserDefinedError + 76used by file ioworker
KIO::ERR_CANNOT_TRUNCATE (since Qt 5.66)KJob::UserDefinedError + 77used by FileJob::truncate
KIO::ERR_SYMLINKS_NOT_SUPPORTED (since Qt 5.88)KJob::UserDefinedError + 78Indicates failure to create a symlink due to the underlying filesystem (FAT/ExFAT) not supporting them. Used by e.g. CopyJob
KIO::ERR_TRASH_FILE_TOO_LARGE (since Qt 5.100)KJob::UserDefinedError + 79Moving files/dirs to the Trash failed due to size constraints

enum KIO::Info

Identifiers for KIO informational messages.

enum KIO::JobFlag
flags KIO::JobFlags

Flags for the job properties. Not all flags are supported in all cases. Please see documentation of the calling function!

ConstantValueDescription
KIO::DefaultFlags0Show the progress info GUI, no Resume and no Overwrite
KIO::HideProgressInfo1Hide progress information dialog, i.e. don't show a GUI.
KIO::Resume2When set, automatically append to the destination file if it exists already. WARNING: this is NOT the builtin support for offering the user to resume a previous partial download. The Resume option is much less used, it allows to append to an existing file. This is used by KIO::put(), KIO::file_copy(), KIO::file_move()
KIO::Overwrite4When set, automatically overwrite the destination if it exists already. This is used by KIO::rename(), KIO::put(), KIO::file_copy(), KIO::file_move(), KIO::symlink(). Otherwise the operation will fail with ERR_FILE_ALREADY_EXIST or ERR_DIR_ALREADY_EXIST
KIO::NoPrivilegeExecution (since Qt 5.43)8When set, notifies the worker that application/job does not want privilege execution. So in case of failure due to insufficient privileges show an error without attempting to run the operation as root first

The JobFlags type is a typedef for QFlags<JobFlag>. It stores an OR combination of JobFlag values.

enum KIO::LoadType

ConstantValue
KIO::Reload0
KIO::NoReload1

enum KIO::Message

Identifiers for KIO data messages.

[since 5.43] enum KIO::PrivilegeOperationStatus

Specifies privilege file operation status.

ConstantValue
KIO::OperationAllowed1
KIO::OperationCanceled2
KIO::OperationNotAllowed3

This enum was introduced in 5.43.

[since 5.0] enum KIO::RenameDialog_Option
flags KIO::RenameDialog_Options

ConstantValueDescription
KIO::RenameDialog_Overwrite1We have an existing destination, show details about it and offer to overwrite it
KIO::RenameDialog_OverwriteItself2Warn that the current operation would overwrite a file with itself, which is not allowed
KIO::RenameDialog_Skip4Offer a "Skip" button, to skip other files too. Requires RenameDialog_MultipleItems
KIO::RenameDialog_MultipleItems8Set if the current operation concerns multiple files, so it makes sense to offer buttons that apply the user's choice to all files/folders
KIO::RenameDialog_Resume16Offer a "Resume" button (plus "Resume All" if RenameDialog_MultipleItems)
KIO::RenameDialog_NoRename64Don't offer a "Rename" button
KIO::RenameDialog_DestIsDirectory (since Qt 5.78)128The destination is a directory, the dialog updates labels and tooltips accordingly
KIO::RenameDialog_SourceIsDirectory (since Qt 5.78)256The source is a directory, the dialog updates labels and tooltips accordingly

This enum was introduced in 5.0.

The RenameDialog_Options type is a typedef for QFlags<RenameDialog_Option>. It stores an OR combination of RenameDialog_Option values.

enum KIO::RenameDialog_Result

The result of a rename or skip dialog

ConstantValueDescription
KIO::Result_Cancel0 
KIO::Result_Rename1 
KIO::Result_Skip2 
KIO::Result_AutoSkip3 
KIO::Result_Overwrite4 
KIO::Result_OverwriteAll5 
KIO::Result_Resume6 
KIO::Result_Rename1 
KIO::Result_Retry9 
KIO::Result_OverwriteWhenOlder (since Qt 5.77)10Can be returned only when multiple files are passed, Option overwrite is passed and files modification times are valid
KIO::Result_ReplaceInvalidChars (since Qt 5.86)11Can be returned if the user selects to replace any character disallowed by the destination filesystem with an underscore "_". See SkipDialog_Option::SkipDialog_Replace_Invalid_Chars
KIO::Result_ReplaceAllInvalidChars (since Qt 5.86)12The same as Result_ReplaceInvalidChars, but the user selected to automatically replace any invalid character, without being asked about every file/folder

[since 5.0] enum KIO::SkipDialog_Option
flags KIO::SkipDialog_Options

* * *

ConstantValueDescription
KIO::SkipDialog_MultipleItems8Set if the current operation concerns multiple files, so it makes sense to offer buttons that apply the user's choice to all files/folders. *
KIO::SkipDialog_Replace_Invalid_Chars (since Qt 5.86)16Set if the current operation involves copying files/folders with certain characters in their names that are not supported by the destination filesystem (e.g. VFAT and NTFS disallow "*" in file/folder names). This will make the SkipDialog show a "Replace" button that can be used to instruct the underlying job to replace any problematic character with an underscore "_" *
KIO::SkipDialog_Hide_Retry (since Qt 5.88)32Set if the current operation cannot be retried. For example if there is an issue that involves the destination filesystem support, e.g. VFAT and ExFat don't support symlinks, then retrying doesn't make sense.

This enum was introduced in 5.0.

The SkipDialog_Options type is a typedef for QFlags<SkipDialog_Option>. It stores an OR combination of SkipDialog_Option values.

[since 5.69] enum KIO::StatDetail
flags KIO::StatDetails

Describes the fields that a stat command will retrieve

ConstantValueDescription
KIO::StatNoDetails0x0No field returned, useful to check if a file exists
KIO::StatBasic0x1Filename, access, type, size, linkdest
KIO::StatUser0x2uid, gid
KIO::StatResolveSymlink0x8Resolve symlinks
KIO::StatAcl0x10ACL data
KIO::StatInode0x20dev, inode
KIO::StatRecursiveSize (since Qt 5.70)0x40Recursive size
KIO::StatMimeType (since Qt 5.82)0x80MIME type
KIO::StatDefaultDetailsStatBasic | StatUser | StatTime | StatAcl | StatResolveSymlinkDefault StatDetail flag when creating a StatJob. Equivalent to setting StatBasic | StatUser | StatTime | StatAcl | StatResolveSymlink

This enum was introduced in 5.69.

The StatDetails type is a typedef for QFlags<StatDetail>. It stores an OR combination of StatDetail values.

See also UDSEntry and StatDetails.

UDSEntryList

A directory listing is a list of UDSEntry instances.

To list the name and size of all the files in a directory listing you would do:

KIO::UDSEntryList::ConstIterator it = entries.begin();
const KIO::UDSEntryList::ConstIterator end = entries.end();
for (; it != end; ++it) {
  const KIO::UDSEntry& entry = *it;
  QString name = entry.stringValue( KIO::UDSEntry::UDS_NAME );
  bool isDir = entry.isDir();
  KIO::filesize_t size = entry.numberValue( KIO::UDSEntry::UDS_SIZE, -1 );
  ...
}

Function Documentation

[since 5.42] KIO::BatchRenameJob *batchRename(const QList<QUrl> &src, const QString &newName, int index, QChar placeHolder, KIO::JobFlags flags = DefaultFlags)

Renames multiple files at once.

The new filename is obtained by replacing the characters represented by placeHolder by the index index.

E.g. Calling batchRename({"file:///Test.jpg"}, "Test #" 12, '#') renames the file to "Test 12.jpg". A connected sequence of placeholders results in leading zeros. batchRename({"file:///Test.jpg"}, "Test ####" 12, '#') renames the file to "Test 0012.jpg". And if no placeholder is there then index is appended to newName. Calling batchRename({"file:///Test.jpg"}, "NewTest" 12, '#') renames the file to "NewTest12.jpg".

src The list of items to rename.

newName The base name to use in all new filenames.

index The integer(incremented after renaming a file) to add to the base name.

placeHolder The character(s) which index will replace.

Returns a pointer to the job handling the operation.

This function was introduced in 5.42.

QString KIO::buildErrorString(int errorCode, const QString &errorText)

Returns a translated error message for errorCode using the additional error information provided by errorText.

errorCode the error code

errorText the additional error text

unsigned int KIO::calculateRemainingSeconds(KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed)

Calculates remaining time in seconds from total size, processed size and speed.

totalSize total size in bytes

processedSize processed size in bytes

speed speed in bytes per second

Returns calculated remaining time in seconds

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::ChmodJob *chmod(const KFileItemList &lstItems, int permissions, int mask, const QString &newOwner, const QString &newGroup, bool recursive, KIO::JobFlags flags = DefaultFlags)

Creates a job that changes permissions/ownership on several files or directories, optionally recursively. This version of chmod uses a KFileItemList so that it directly knows what to do with the items. TODO: a version that takes a QList<QUrl>, and a general job that stats each url and returns a KFileItemList.

Note that change of ownership is only supported for local files.

Inside directories, the "x" bits will only be changed for files that had at least one "x" bit before, and for directories. This emulates the behavior of chmod +X.

lstItems The file items representing several files or directories.

permissions the permissions we want to set

mask the bits we are allowed to change. For instance, if mask is 0077, we don't change the "user" bits, only "group" and "others".

newOwner If non-empty, the new owner for the files

newGroup If non-empty, the new group for the files

recursive whether to open directories recursively

flags We support HideProgressInfo here

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.

QFileDevice::Permissions KIO::convertPermissions(int permissions)

Converts KIO file permissions from mode_t to QFile::Permissions format.

This is a convenience function for converting KIO permissions parameter from mode_t to QFile::Permissions.

permissions KIO file permissions.

Returns -1 if permissions is -1, otherwise its OR'ed QFile::Permission equivalent.

QString KIO::convertSeconds(unsigned int seconds)

Convert @p seconds to a string representing number of days, hours, minutes and seconds

seconds number of seconds to convert

Returns string representation in a locale depending format

QString KIO::convertSize(KIO::filesize_t size)

Converts size from bytes to the string representation.

size size in bytes

Returns converted size as a string - e.g. 123.4 KiB , 12.0 MiB

QString KIO::convertSizeFromKiB(KIO::filesize_t kibSize)

Converts size from kibi-bytes (2^10) to the string representation.

kibSize size in kibi-bytes (2^10)

Returns converted size as a string - e.g. 123.4 KiB , 12.0 MiB

KIO::CopyJob *copy(const QList<QUrl> &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Copy a list of file/dirs src into a destination directory dest.

src the list of files and/or directories

dest the destination

flags copy() supports HideProgressInfo and Overwrite. Note: Overwrite has the meaning of both "write into existing directories" and "overwrite existing files". However if "dest" exists, then src is copied into a subdir of dest, just like "cp" does.

Returns the job handling the operation

KIO::CopyJob *copy(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Copy a file or directory src into the destination dest, which can be a file (including the final filename) or a directory (into which src will be copied).

This emulates the cp command completely.

src the file or directory to copy dest the destination flags copy() supports HideProgressInfo and Overwrite. Note: Overwrite has the meaning of both "write into existing directories" and "overwrite existing files". However if "dest" exists, then src is copied into a subdir of dest, just like "cp" does. Use copyAs if you don't want that.

Returns the job handling the operation

See also copyAs().

KIO::CopyJob *copyAs(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Copy a file or directory src into the destination dest, which is the destination name in any case, even for a directory.

As opposed to copy(), this doesn't emulate cp, but is the only way to copy a directory, giving it a new name and getting an error box if a directory already exists with the same name (or writing the contents of src into dest, when using Overwrite).

src the file or directory to copy dest the destination flags copyAs() supports HideProgressInfo and Overwrite.

Note: Overwrite has the meaning of both "write into existing directories" and "overwrite existing files".

Returns the job handling the operation

KJobUiDelegate *createDefaultJobUiDelegate()

Convenience method: use default factory, if there's one, to create a delegate and return it.

[since 5.98] KJobUiDelegate *createDefaultJobUiDelegate(KJobUiDelegate::Flags flags, QWidget *window)

Convenience method: use default factory, if there's one, to create a delegate and return it.

This function was introduced in 5.98.

[since 5.84] KIO::DavJob *davPropFind(const QUrl &url, const QString &properties, const QString &depth, KIO::JobFlags flags = DefaultFlags)

Creates a new DavJob that issues a PROPFIND command. PROPFIND retrieves the properties of the resource identified by the given \p url.

url the URL of the resource

properties a propfind document that describes the properties that should be retrieved

depth the depth of the request. Can be "0", "1" or "infinity"

flags We support HideProgressInfo here

Returns the new DavJob

This function was introduced in 5.84.

[since 5.84] KIO::DavJob *davPropPatch(const QUrl &url, const QString &properties, KIO::JobFlags flags = DefaultFlags)

Creates a new DavJob that issues a PROPPATCH command. PROPPATCH sets the properties of the resource identified by the given url.

url the URL of the resource

properties a PROPPACTCH document that describes the properties that should be modified and its new values

flags We support HideProgressInfo here

Returns the new DavJob

This function was introduced in 5.84.

KIO::DavJob *davReport(const QUrl &url, const QString &report, const QString &depth, KIO::JobFlags flags = DefaultFlags)

Creates a new DavJob that issues a REPORT command.

url the URL of the resource

report a REPORT document that describes the request to make

depth the depth of the request. Can be "0", "1" or "infinity"

flags We support HideProgressInfo here

Returns the new DavJob

KIO::DavJob *davSearch(const QUrl &url, const QString &nsURI, const QString &qName, const QString &query, KIO::JobFlags flags = DefaultFlags)

Creates a new DavJob that issues a SEARCH command.

url the URL of the resource

nsURI the URI of the search method's qualified name

qName the local part of the search method's qualified name

query the search string

flags We support HideProgressInfo here

Returns the new DavJob

QString KIO::decodeFileName(const QString &str)

Decodes (from the filename to the text displayed) This doesn't do anything anymore, it used to do the opposite of encodeFileName when encodeFileName was using %2F for '/'.

str the file name to decode

Returns the decoded file name

[since 5.0] KIO::JobUiDelegateExtension *defaultJobUiDelegateExtension()

Returns the default job UI delegate extension to be used by all KIO jobs (in which HideProgressInfo is not set) Can return nullptr, if no kio GUI library is loaded.

This function was introduced in 5.0.

See also setDefaultJobUiDelegateExtension().

[since 6.0] KIO::JobUiDelegateFactory *defaultJobUiDelegateFactory()

Returns the default job UI delegate factory to be used by all KIO jobs (in which HideProgressInfo is not set) Can return nullptr, if no kio GUI library is loaded.

This function was introduced in 6.0.

See also setDefaultJobUiDelegateFactory().

KIO::DeleteJob *del(const QList<QUrl> &src, KIO::JobFlags flags = DefaultFlags)

Deletes a list of files or directories.

src the files to delete

flags We support HideProgressInfo here

Returns the job handling the operation

KIO::DeleteJob *del(const QUrl &src, KIO::JobFlags flags = DefaultFlags)

Delete a file or directory.

src file to delete

flags We support HideProgressInfo here

Returns the job handling the operation

[since 5.78] template <typename T> T delegateExtension(KJob *job)

Returns the child of the job's uiDelegate() that implements the given extension, or nullptr if none was found (or if the job had no uiDelegate).

This function was introduced in 5.78.

KIO::DirectorySizeJob *directorySize(const KFileItemList &lstItems)

Computes a directory size (by doing a recursive listing). Connect to the result signal (this is the preferred solution to avoid blocking the GUI), or use exec() for a synchronous (blocking) calculation.

This one lists the items from lstItems. The reason we asks for items instead of just urls, is so that we directly know if the item is a file or a directory, and in case of a file, we already have its size.

KIO::DirectorySizeJob *directorySize(const QUrl &directory)

Computes a directory size (by doing a recursive listing). Connect to the result signal (this is the preferred solution to avoid blocking the GUI), or use exec() for a synchronous (blocking) calculation.

This one lists a single directory.

[since 5.2] KIO::EmptyTrashJob *emptyTrash()

Empties the trash.

Returns a pointer to the job handling the operation.

This function was introduced in 5.2.

QString KIO::encodeFileName(const QString &str)

Encodes (from the text displayed to the real filename) This translates '/' into a "unicode fraction slash", QChar(0x2044). Used by KIO::link, for instance.

str the file name to encode

Returns the encoded file name

[since 5.0] QString KIO::favIconForUrl(const QUrl &url)

Return the "favicon" (see http://www.favicon.com) for the given url, if available. Does NOT attempt to download the favicon, it only returns one that is already available.

If unavailable, returns QString(). Use KIO::FavIconRequestJob instead of this method if you can wait for the favicon to be downloaded.

url the URL of the favicon

Returns the path to the icon (to be passed to QIcon()), or QString()

This function was introduced in 5.0.

KIO::FileSystemFreeSpaceJob *fileSystemFreeSpace(const QUrl &url)

Get a filesystem's total and available space.

url Url to the filesystem.

Returns the job handling the operation.

KIO::FileCopyJob *file_copy(const QUrl &src, const QUrl &dest, KIO::JobFlags flags)

Overload for catching code mistakes. Do NOT call this method (it is not implemented), insert a value for permissions (-1 by default) before the JobFlags.

KIO::FileCopyJob *file_copy(const QUrl &src, const QUrl &dest, int permissions = -1, KIO::JobFlags flags = DefaultFlags)

Copy a single file.

Uses either WorkerBase::copy() if the worker supports that or get() and put() otherwise.

src Where to get the file

dest Where to put the file

permissions the file mode permissions to set on dest; if this is -1 (the default) no special permissions will be set on dest, i.e. it'll have the default system permissions for newly created files, and the owner and group permissions are not preserved.

flags Can be JobFlag::HideProgressInfo, Overwrite and Resume here WARNING: Setting JobFlag::Resume means that the data will be appended to dest if dest exists

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::FileCopyJob *file_move(const QUrl &src, const QUrl &dest, int permissions = -1, KIO::JobFlags flags = DefaultFlags)

Move a single file.

Use either WorkerBase::rename() if the worker supports that, or copy() and del() otherwise, or eventually get() & put() & del()

src Where to get the file

dest Where to put the file

permissions the file mode permissions to set on dest; if this is -1 (the default), no special permissions are set on dest, i.e. it'll have the default system permissions for newly created files, and the owner and group permissions are not preserved.

flags Can be HideProgressInfo, Overwrite and Resume here WARNING: Setting JobFlag::Resume means that the data will be appended to dest if dest exists

Returns the job handling the operation

KIO::TransferJob *get(const QUrl &url, KIO::LoadType reload = NoReload, KIO::JobFlags flags = DefaultFlags)

Get (means: read). This is the job to use in order to "download" a file into memory. The worker emits the data through the data() signal.

Special case: if you want to determine the MIME type of the file first, and then read it with the appropriate component, you can still use a KIO::get() directly. When that job emits the mimeType signal, (which is guaranteed to happen before it emits any data), put the job on hold:

job->putOnHold();

and forget about the job. The next time someone does a KIO::get() on the same URL (even in another process) this job will be resumed. This saves KIO from doing two requests to the server.

url the URL of the file

reload Reload to reload the file, NoReload if it can be taken from the cache

flags Can be HideProgressInfo here

Returns the job handling the operation.

KJobTrackerInterface *KIO::getJobTracker()

Returns the job tracker to be used by all KIO jobs (in which HideProgressInfo is not set)

[since 4.7.3] KIO::TransferJob *http_delete(const QUrl &url, KIO::JobFlags flags = DefaultFlags)

HTTP DELETE.

Though this function servers the same purpose as KIO::file_delete, unlike file_delete it accommodates HTTP specific actions such as redirections.

url url resource to delete.

flags Can be HideProgressInfo here

Returns the job handling the operation.

This function was introduced in 4.7.3.

KIO::TransferJob *http_post(const QUrl &url, const QByteArray &postData, KIO::JobFlags flags = DefaultFlags)

HTTP POST (for form data).

Example:

job = KIO::http_post( url, postData, KIO::HideProgressInfo );
job->addMetaData("content-type", contentType );

postData is the data that you want to send and

contentType is the complete HTTP header line that specifies the content's MIME type, for example "Content-Type: text/xml".

You MUST specify content-type!

Often contentType is "Content-Type: application/x-www-form-urlencoded" and the postData is then an ASCII string (without null-termination!) with characters like space, linefeed and percent escaped like %20, %0A and %25.

url Where to write the data.

postData Encoded data to post.

flags Can be HideProgressInfo here

Returns the job handling the operation.

KIO::TransferJob *http_post(const QUrl &url, QIODevice *device, qint64 size = -1, KIO::JobFlags flags = DefaultFlags)

HTTP POST.

This function, unlike the one that accepts a QByteArray, accepts an IO device from which to read the encoded data to be posted to the server in order to to avoid holding the content of very large post requests, e.g. multimedia file uploads, in memory.

url Where to write the data.

device the device to read from

size Size of the encoded post data.

flags Can be HideProgressInfo here

Returns the job handling the operation.

[since 5.0] QString KIO::iconNameForUrl(const QUrl &url)

Return the icon name for a URL. Most of the time this returns the MIME type icon, but also has fallback to favicon and protocol-specific icon.

Pass this to QIcon::fromTheme().

This function was introduced in 5.0.

QString KIO::itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize)

Helper for showing information about a set of files and directories items the number of items (= @p files + @p dirs + number of symlinks :)

files the number of files

dirs the number of dirs

size the sum of the size of the @p files

showSize whether to show the size in the result

Returns the summary string

Create several links If the protocols and hosts are the same, a Unix symlink will be created. Otherwise, a .desktop file of Type Link and pointing to the src URL will be created.

src The existing files or directories, 'targets' of the link.

destDir Destination directory where the links will be created.

flags link() supports HideProgressInfo only

Returns the job handling the operation

Create a link. If the protocols and hosts are the same, a Unix symlink will be created. Otherwise, a .desktop file of Type Link and pointing to the src URL will be created.

src The existing file or directory, 'target' of the link.

destDir Destination directory where the link will be created.

flags link() supports HideProgressInfo only

Returns the job handling the operation

KIO::CopyJob *linkAs(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Create a link. Unlike link() this operation will fail when dest is an existing directory rather than the final name for the link. If the protocols and hosts are the same, a Unix symlink will be created. Otherwise, a .desktop file of Type Link and pointing to the src URL will be created.

src The existing file or directory, 'target' of the link.

dest Destination (i.e. the final symlink)

flags linkAs() supports HideProgressInfo only

Returns the job handling the operation

See also link() and copyAs().

KIO::ListJob *listDir(const QUrl &url, KIO::JobFlags flags = DefaultFlags, KIO::ListJob::ListFlags listFlags = ListJob::ListFlag::IncludeHidden)

List the contents of url, which is assumed to be a directory.

"." and ".." are returned, filter them out if you don't want them.

url the url of the directory

flags Can be HideProgressInfo here

includeHidden true for all files, false to cull out UNIX hidden files/dirs (whose names start with dot)

Returns the job handling the operation.

KIO::ListJob *listRecursive(const QUrl &url, KIO::JobFlags flags = DefaultFlags, KIO::ListJob::ListFlags listFlags = ListJob::ListFlag::IncludeHidden)

The same as the previous method, but recurses subdirectories. Directory links are not followed.

"." and ".." are returned but only for the toplevel directory. Filter them out if you don't want them.

url the url of the directory

flags Can be HideProgressInfo here

includeHidden true for all files, false to cull out UNIX hidden files/dirs (whose names start with dot)

Returns the job handling the operation.

KIO::MimetypeJob *mimetype(const QUrl &url, KIO::JobFlags flags = DefaultFlags)

Find MIME type for one file or directory.

If you are going to download the file right after determining its MIME type, then don't use this, prefer using a KIO::get() job instead. See the note about putting the job on hold once the MIME type is determined.

url the URL of the file

flags Can be HideProgressInfo here

Returns the job handling the operation.

KIO::MkdirJob *mkdir(const QUrl &url, int permissions = -1)

Creates a single directory.

url The URL of the directory to create.

permissions The permissions to set after creating the directory (unix-style), -1 for default permissions. Returns a pointer to the job handling the operation.

[since 5.4] KIO::MkpathJob *mkpath(const QUrl &url, const QUrl &baseUrl = QUrl(), KIO::JobFlags flags = DefaultFlags)

Creates a directory, creating parent directories as needed. Unlike KIO::mkdir(), the job will succeed if the directory exists already.

url The URL of the directory to create.

baseUrl Optionally, the URL to start from, which is known to exist (e.g. the directory currently listed).

flags mkpath() supports HideProgressInfo.

If baseUrl is not an ancestor of url, baseUrl will be ignored.

Returns a pointer to the job handling the operation.

This function was introduced in 5.4.

KIO::StatJob *mostLocalUrl(const QUrl &url, KIO::JobFlags flags = DefaultFlags)

Tries to map a local URL for the given URL, using a KIO job. This only makes sense for protocols that have Class ":local" (such protocols most likely have KIO workers that set UDSEntry::UDS_LOCAL_PATH); ideally you should check the URL protocol Class before creating a StatJob. See KProtocolInfo::protocolClass().

Starts a (stat) job for determining the "most local URL" for a given URL. Retrieve the result with StatJob::mostLocalUrl in the result slot.

url The URL we are stat'ing.

Sample usage:

Here the KIO worker name is "foo", which for example could be:

  • "desktop", "fonts", "kdeconnect", these have class ":local"
  • "ftp", "sftp", "smb", these have class ":internet"
QUrl url(QStringLiteral("foo://bar/");
if (url.isLocalFile()) { // If it's a local URL, there is no need to stat
   [...]
} else if (KProtocolInfo::protocolClass(url.scheme()) == QLatin1String(":local")) {
    // Not a local URL, but if the protocol class is ":local", we may be able to stat
    // and get a "most local URL"
    auto *job = KIO::mostLocalUrl(url);
    job->uiDelegate()->setWindow(this);
    connect(job, &KJob::result, this, &MyClass::slotMostLocalUrlResult);
    [...]
    // And in slotMostLocalUrlResult(KJob *job)
    if (job->error()) {
        [...] // Doesn't exist, ideally show an error message
    } else {
        const QUrl localUrl = job->mostLocalUrl();
        // localUrl = file:///local/path/to/bar/
        [...]
    }
}

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::CopyJob *move(const QList<QUrl> &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Moves a list of files or directories src to the given destination dest.

src the list of files or directories to copy

dest the destination

flags move() supports HideProgressInfo and Overwrite. Note: Overwrite has the meaning of both "write into existing directories" and "overwrite existing files". However if "dest" exists, then src is copied into a subdir of dest, just like "cp" does.

Returns the job handling the operation

See also copy().

KIO::CopyJob *move(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Moves a file or directory src to the given destination dest.

src the file or directory to copy

dest the destination

flags move() supports HideProgressInfo and Overwrite. Note: Overwrite has the meaning of both "write into existing directories" and "overwrite existing files". However if "dest" exists, then src is copied into a subdir of dest, just like "cp" does.

Returns the job handling the operation

See also copy() and moveAs().

KIO::CopyJob *moveAs(const QUrl &src, const QUrl &dest, KIO::JobFlags flags = DefaultFlags)

Moves a file or directory src to the given destination dest. Unlike move() this operation will not move src into dest when dest exists: it will either fail, or move the contents of src into it if Overwrite is set.

src the file or directory to copy

dest the destination

flags moveAs() supports HideProgressInfo and Overwrite. Note: Overwrite has the meaning of both "write into existing directories" and "overwrite existing files".

Returns the job handling the operation

See also copyAs().

QString KIO::number(KIO::filesize_t size)

Converts a size to a string representation Not unlike QString::number(...)

size size in bytes

Returns converted size as a string - e.g. 123456789

KIO::FileJob *open(const QUrl &url, QIODeviceBase::OpenMode mode)

Open ( random access I/O )

The file-job emits open() when opened

On error the open() signal is not emitted. To catch errors please connect to the result() signal.

url the URL of the file

mode the access privileges: see OpenMode

Returns the file-handling job. It will never return 0. Errors are handled asynchronously (emitted as signals).

KIO::TransferJob *put(const QUrl &url, int permissions, KIO::JobFlags flags = DefaultFlags)

Put (means: write)

url Where to write data.

permissions May be -1. In this case no special permission mode is set.

flags Can be HideProgressInfo, Overwrite and Resume here. WARNING: Setting Resume means that the data will be appended to dest if dest exists.

Returns the job handling the operation.

See also multi_get().

QByteArray KIO::rawErrorDetail(int errorCode, const QString &errorText, const QUrl *reqUrl = nullptr, int method = -1)

Returns translated error details for errorCode using the additional error information provided by errorText , reqUrl (the request URL), and the KIO worker method .

errorCode the error code

errorText the additional error text

reqUrl the request URL

method the KIO worker method

Returns the following data:

  • QString errorName - the name of the error
  • QString techName - if not null, the more technical name of the error
  • QString description - a description of the error
  • QStringList causes - a list of possible causes of the error
  • QStringList solutions - a liso of solutions for the error

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.

[since 5.2] KIO::RestoreJob *restoreFromTrash(const QList<QUrl> &urls, KIO::JobFlags flags = DefaultFlags)

Restore a set of trashed files or directories.

urls the trash:/ URLs to restore. The trash implementation will know where the files came from and will restore them to their original location.

flags restoreFromTrash() supports HideProgressInfo.

Returns the job handling the operation

This function was introduced in 5.2.

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.

[since 5.0] void setDefaultJobUiDelegateExtension(KIO::JobUiDelegateExtension *extension)

Internal. Allows the KIO widgets library to register its widget-based job UI delegate extension automatically.

This function was introduced in 5.0.

See also defaultJobUiDelegateExtension().

[since 6.0] void setDefaultJobUiDelegateFactory(KIO::JobUiDelegateFactory *factory)

Internal. Allows the KIO widgets library to register its widget-based job UI delegate factory automatically.

This function was introduced in 6.0.

See also defaultJobUiDelegateFactory().

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.

KIO::StatJob *stat(const QUrl &url, KIO::JobFlags flags = DefaultFlags)

Find all details for one file or directory.

url the URL of the file

flags Can be HideProgressInfo here

Returns the job handling the operation.

[since 6.0] KIO::StatJob *stat(const QUrl &url, KIO::StatJob::StatSide side, KIO::StatDetails details = KIO::StatDefaultDetails, KIO::JobFlags flags = DefaultFlags)

Find all details for one file or directory. This version of the call includes two additional booleans, sideIsSource and details.

url the URL of the file

side is SourceSide when stating a source file (we will do a get on it if the stat works) and DestinationSide when stating a destination file (target of a copy). The reason for this parameter is that in some cases the KIO worker might not be able to determine a file's existence (e.g. HTTP doesn't allow it, FTP has issues with case-sensitivity on some systems). When the worker can't reliably determine the existence of a file, it will:

  • be optimistic if SourceSide, i.e. it will assume the file exists, and if it doesn't this will appear when actually trying to download it
  • be pessimistic if DestinationSide, i.e. it will assume the file doesn't exist, to prevent showing "about to overwrite" errors to the user. If you simply want to check for existence without downloading/uploading afterwards, then you should use DestinationSide.

details selects the level of details we want. You should minimize the detail level for better performance.

flags Can be HideProgressInfo here

Returns the job handling the operation.

This function was introduced in 6.0.

KIO::StoredTransferJob *storedGet(const QUrl &url, KIO::LoadType reload = NoReload, KIO::JobFlags flags = DefaultFlags)

Get (means: read), into a single QByteArray.

url the URL of the file

reload Reload to reload the file, NoReload if it can be taken from the cache

flags Can be HideProgressInfo here

Returns the job handling the operation.

KIO::StoredTransferJob *storedHttpPost(const QByteArray &arr, const QUrl &url, KIO::JobFlags flags = DefaultFlags)

HTTP POST (means: write) data from a single QByteArray.

arr The data to write

url Where to write data.

flags Can be HideProgressInfo here.

Returns the job handling the operation.

KIO::StoredTransferJob *storedHttpPost(QIODevice *device, const QUrl &url, qint64 size = -1, KIO::JobFlags flags = DefaultFlags)

HTTP POST (means: write) data from the given IO device.

device Device from which the encoded data to be posted is read. Must be open for reading.

url Where to write data.

size Size of the encoded data to be posted.

flags Can be HideProgressInfo here.

Returns the job handling the operation.

[since 5.10] KIO::StoredTransferJob *storedPut(QIODevice *input, const QUrl &url, int permissions, KIO::JobFlags flags = DefaultFlags)

Put (means: write) data from a QIODevice.

input The data to write, a device to read from. Must be open for reading (data will be read from the current position).

url Where to write data.

permissions May be -1. In this case no special permission mode is set.

flags Can be HideProgressInfo, Overwrite and Resume here. WARNING: Setting Resume means that the data will be appended to dest if dest exists.

Returns the job handling the operation.

This function was introduced in 5.10.

KIO::StoredTransferJob *storedPut(const QByteArray &arr, const QUrl &url, int permissions, KIO::JobFlags flags = DefaultFlags)

Put (means: write) data from a single QByteArray.

arr The data to write

url Where to write data.

permissions May be -1. In this case no special permission mode is set.

flags Can be HideProgressInfo, Overwrite and Resume here. WARNING: Setting Resume means that the data will be appended to dest if dest exists.

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::CopyJob *trash(const QList<QUrl> &src, KIO::JobFlags flags = DefaultFlags)

Trash a list of files or directories. This is currently only supported for local files and directories.

src the files to delete

flags trash() supports HideProgressInfo only

Returns the job handling the operation

KIO::CopyJob *trash(const QUrl &src, KIO::JobFlags flags = DefaultFlags)

Trash a file or directory. This is currently only supported for local files and directories. Use QUrl::fromLocalFile to create a URL from a local file path.

src file to delete

flags trash() supports HideProgressInfo only

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.

QString KIO::unsupportedActionErrorString(const QString &protocol, int cmd)

Returns an appropriate error message if the given command cmd is an unsupported action (ERR_UNSUPPORTED_ACTION).

protocol name of the protocol

cmd given command

See also enum and Command.

[since 5.0] QUrl KIO::upUrl(const QUrl &url)

This function is useful to implement the "Up" button in a file manager for example.

Returns a URL that is a level higher

This function was introduced in 5.0.

[since 5.63] bool KIO::operator!=(const KIO::UDSEntry &entry, const KIO::UDSEntry &other)

Returns true if the entry does not contain the same data as the other

This function was introduced in 5.63.

QDBusArgument &KIO::operator<<(QDBusArgument &argument, const KIO::AuthInfo &a)

QDataStream &KIO::operator<<(QDataStream &s, const KIO::AuthInfo &a)

[since 5.63] bool KIO::operator==(const KIO::UDSEntry &entry, const KIO::UDSEntry &other)

Returns true if the entry contains the same data as the other

This function was introduced in 5.63.

QDataStream &KIO::operator>>(QDataStream &s, KIO::AuthInfo &a)

const QDBusArgument &KIO::operator>>(const QDBusArgument &argument, KIO::AuthInfo &a)