KIO::OpenFileManagerWindowJob Class

Open a File Manager Window. More...

Header: #include <KIO/OpenFileManagerWindowJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KIOGui)
Since: KDE Frameworks 5.24
Inherits: KJob

Public Types

enum Errors { NoValidUrlsError, LaunchFailedError }

Public Functions

OpenFileManagerWindowJob(QObject *parent = nullptr)
QList<QUrl> highlightUrls() const
void setHighlightUrls(const QList<QUrl> &highlightUrls)
void setStartupId(const QByteArray &startupId)
QByteArray startupId() const

Reimplemented Public Functions

virtual void start() override
(since 5.24) KIO::OpenFileManagerWindowJob *highlightInFileManager(const QList<QUrl> &urls, const QByteArray &asn = QByteArray())

Detailed Description

Using this job you can open a file manager window and highlight specific files within a folder. This can be useful if you downloaded a file and want to present it to the user without the user having to manually search the file in its parent folder. This can also be used for a "Show in Parent Folder" functionality.

On Linux, this job will use the org.freedesktop.FileManager1 interface to highlight the files and/or folders. If this fails, the parent directory of the first URL will be opened in the default file manager instead.

Note that this job is really only about highlighting certain items which means if you, for example, pass it just a URL to a folder it will not open this particular folder but instead highlight it within its parent folder.

If you just want to open a folder, use OpenUrlJob instead.

Member Type Documentation

enum OpenFileManagerWindowJob::Errors

Errors the job may emit

ConstantValueDescription
KIO::OpenFileManagerWindowJob::NoValidUrlsErrorKJob::UserDefinedErrorNo valid URLs to highlight have been specified
KIO::OpenFileManagerWindowJob::LaunchFailedError101Failed to launch the file manager

Member Function Documentation

[explicit] OpenFileManagerWindowJob::OpenFileManagerWindowJob(QObject *parent = nullptr)

Creates an OpenFileManagerWindowJob

QList<QUrl> OpenFileManagerWindowJob::highlightUrls() const

The files and/or folders to highlight

See also setHighlightUrls().

void OpenFileManagerWindowJob::setHighlightUrls(const QList<QUrl> &highlightUrls)

Set the files and/or folders to highlight

See also highlightUrls().

void OpenFileManagerWindowJob::setStartupId(const QByteArray &startupId)

Sets the platform-specific startup id of the file manager launch.

startupId startup id, if any (otherwise "").

For X11, this would be the id for the Startup Notification protocol.

For Wayland, this would be the token for the XDG Activation protocol.

See also startupId().

[override virtual] void OpenFileManagerWindowJob::start()

Reimplements: KJob::start().

Starts the job

QByteArray OpenFileManagerWindowJob::startupId() const

The Startup ID

See also setStartupId().

Related Non-Members

[since 5.24] KIO::OpenFileManagerWindowJob *highlightInFileManager(const QList<QUrl> &urls, const QByteArray &asn = QByteArray())

Convenience method for creating a job to highlight a certain file or folder.

It will create a job for a given URL(s) and automatically start it.

This function was introduced in KDE Frameworks 5.24.