KIO::OpenWithHandlerInterface Class

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

Public Functions

virtual void promptUserForApplication(KJob *job, const QList<QUrl> &urls, const QString &mimeType)

Signals

void canceled()
void handled()
void serviceSelected(const KService::Ptr &service)

Protected Functions

OpenWithHandlerInterface(QObject *parent = nullptr)
virtual ~OpenWithHandlerInterface() override

Detailed Description

@class OpenWithHandlerInterface openwithhandlerinterface.h <KIO/OpenWithHandlerInterface> @brief The OpenWithHandlerInterface class allows OpenUrlJob to prompt the user about which application to use to open URLs that do not have an associated application (via the "Open With" dialog).

This extension mechanism for jobs is similar to KIO::JobUiDelegateExtension and UntrustedProgramHandlerInterface.

@since 5.71

Member Function Documentation

[explicit protected] OpenWithHandlerInterface::OpenWithHandlerInterface(QObject *parent = nullptr)

Constructor

[override virtual noexcept protected] OpenWithHandlerInterface::~OpenWithHandlerInterface()

Destructor

[signal] void OpenWithHandlerInterface::canceled()

Emitted by promptUserForApplication() if the user canceled the application selection dialog.

[signal] void OpenWithHandlerInterface::handled()

Emitted by promptUserForApplication() if it fully handled it including launching the app. This is a special case for the native Windows open-with dialog.

[virtual] void OpenWithHandlerInterface::promptUserForApplication(KJob *job, const QList<QUrl> &urls, const QString &mimeType)

Show the "Open With" dialog. @param job the job calling this. Useful to get all its properties @param urls the URLs to open @param mimeType the MIME type of the URLs, if known. Can be empty otherwise.

Implementations of this method must emit either serviceSelected or canceled.

The default implementation in this base class simply emits canceled(). Any application using KIO::JobUiDelegate (from KIOWidgets) will benefit from an automatically registered subclass which implements this method using KOpenWithDialog.

[signal] void OpenWithHandlerInterface::serviceSelected(const KService::Ptr &service)

Emitted by promptUserForApplication() once the user chooses an application. @param service the application chosen by the user