KIO::OpenOrExecuteFileInterface Class
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. More...
Header: | #include <KIO/OpenOrExecuteFileInterface> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KIO) target_link_libraries(mytarget PRIVATE KIOGui) |
Since: | KDE Frameworks 5.73 |
Inherits: | QObject |
Public Functions
virtual void | promptUserOpenOrExecute(KJob *job, const QString &mimetype) |
Signals
void | canceled() |
void | executeFile(bool enable) |
Protected Functions
OpenOrExecuteFileInterface(QObject *parent = nullptr) |
Detailed Description
This extension mechanism for jobs is similar to KIO::JobUiDelegateExtension, OpenWithHandlerInterface and UntrustedProgramHandlerInterface.
Member Function Documentation
[explicit protected]
OpenOrExecuteFileInterface::OpenOrExecuteFileInterface(QObject *parent = nullptr)
Constructor
[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.
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.
job the job calling this. This is useful if you need to get any of its properties
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).