Pages
API Documentation
On this page

KIO::ListJob Class

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

List of all members, including inherited members

Public Types

Public Functions

Signals

Detailed Description

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

See also KIO::listRecursive(), KIO::listDir()

Member Type Documentation

enum ListJob::ListFlag

flags ListJob::ListFlags

Constant Value Description
KIO::ListJob::ListFlag::ExcludeHidden (since Qt 6.23) 0 Don't include items whose name starts with '.'
KIO::ListJob::ListFlag::IncludeHidden 1 << 0 Include hidden files in the listing.
KIO::ListJob::ListFlag::ExcludeDot (since Qt 6.23) 2 << 0 Skip the '.' entry for the root dir, there are always skipped for sub-directories
KIO::ListJob::ListFlag::ExcludeDotDot (since Qt 6.23) 1 << 2 Skip the '..' entry for the root dir, there are always skipped for sub-directories
KIO::ListJob::ListFlag::ExcludeDotAndDotDot (since Qt 6.23) `ExcludeDot ExcludeDotDot`

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.

[since 6.25] void ListJob::setDetails(KIO::StatDetails details)

Selects the level of details we want.

This function was introduced in Qt 6.25.

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.

KIO::ListJob *listDir(const QUrl &url, KIO::JobFlags flags = DefaultFlags, 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

listFlags Can be used to control whether hidden files are included

Returns the job handling the operation.

KIO::ListJob *listRecursive(const QUrl &url, KIO::JobFlags flags = DefaultFlags, 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

listFlags Can be used to control whether hidden files are included

Returns the job handling the operation.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.