KIO::OpenOrExecuteFileInterface Class

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

Public Functions

virtual void promptUserOpenOrExecute(KJob *job, const QString &mimetype)

Signals

void canceled()
void executeFile(bool enable)

Protected Functions

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

Detailed Description

@class OpenOrExecuteFileInterface openorexecutefileinterface.h <KIO/OpenOrExecuteFileInterface> @brief The OpenOrExecuteFileInterface class allows OpenUrlJob to ask the user about how to handle various types of executable files, basically whether to run/execute the file, or in the case of text-based ones (shell scripts and .desktop files) open them as text.

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

@since 5.73

Member Function Documentation

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

Constructor

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

Destructor

[signal] void OpenOrExecuteFileInterface::canceled()

Emitted by promptUserOpenOrExecute() if user selects cancel.

[signal] void OpenOrExecuteFileInterface::executeFile(bool enable)

Emitted by promptUserOpenOrExecute() once the user chooses an action. @param enable true if the user selected to execute/run the file or false if the user selected to open the file as text (the latter is only valid for shell scripts and .desktop files)

[virtual] void OpenOrExecuteFileInterface::promptUserOpenOrExecute(KJob *job, const QString &mimetype)

Show a dialog to ask the user how to handle various types of executable files, basically whether to run/execute the file, or in the case of text-based ones (shell scripts and .desktop files) open them as text.

@param job the job calling this. This is useful if you need to get any of its properties @param mimetype the MIME type of the file being handled

Implementations of this method must emit either executeFile 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, which in turn uses ExecutableFileOpenDialog (from KIOWidgets).