KIO::ListJob Class

class KIO::ListJob

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

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

Public Types

enum class ListFlag { IncludeHidden }
flags ListFlags

Public Functions

const QUrl &redirectionUrl() const
void setUnrestricted(bool unrestricted)

Signals

void entries(KIO::Job *job, const KIO::UDSEntryList &list)
void permanentRedirection(KIO::Job *job, const QUrl &fromUrl, const QUrl &toUrl)
void redirection(KIO::Job *job, const QUrl &url)
void subError(KIO::ListJob *job, KIO::ListJob *subJob)
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)

Detailed Description

Don't create the job directly, but use KIO::listRecursive() or KIO::listDir() instead.

See also KIO::listRecursive() and KIO::listDir().

Member Type Documentation

enum class ListJob::ListFlag
flags ListJob::ListFlags

ConstantValueDescription
KIO::ListJob::ListFlag::IncludeHidden1 << 0Include hidden files in the listing.

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

Member Function Documentation

[signal] void ListJob::entries(KIO::Job *job, const KIO::UDSEntryList &list)

This signal emits the entry found by the job while listing. The progress signals aren't specific to ListJob. It simply uses SimpleJob's processedSize (number of entries listed) and totalSize (total number of entries, if known), as well as percent.

job the job that emitted this signal

list the list of UDSEntries

[signal] void ListJob::permanentRedirection(KIO::Job *job, const QUrl &fromUrl, const QUrl &toUrl)

Signals a permanent redirection. The redirection itself is handled internally.

job the job that emitted this signal

fromUrl the original URL

toUrl the new URL

[signal] void ListJob::redirection(KIO::Job *job, const QUrl &url)

Signals a redirection. Use to update the URL shown to the user. The redirection itself is handled internally.

job the job that is redirected

url the new url

const QUrl &ListJob::redirectionUrl() const

Returns the ListJob's redirection URL. This will be invalid if there was no redirection.

void ListJob::setUnrestricted(bool unrestricted)

Do not apply any KIOSK restrictions to this job.

[signal] void ListJob::subError(KIO::ListJob *job, KIO::ListJob *subJob)

This signal is emitted when a sub-directory could not be listed. The job keeps going, thus doesn't result in an overall error.

job the job that emitted the signal

subJob the job listing a sub-directory, which failed. Use url(), error() and errorText() on that job to find out more.

Related Non-Members

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.