KIO::MimeTypeFinderJob Class

Header: #include <MimeTypeFinderJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)
Inherits: KCompositeJob

Public Functions

MimeTypeFinderJob(const QUrl &url, QObject *parent = nullptr)
virtual ~MimeTypeFinderJob() override
bool isAuthenticationPromptEnabled() const
QString mimeType() const
void setAuthenticationPromptEnabled(bool enable)
void setFollowRedirections(bool b)
void setSuggestedFileName(const QString &suggestedFileName)
QString suggestedFileName() const

Reimplemented Public Functions

virtual void start() override

Detailed Description

@class MimeTypeFinderJob MimeTypeFinderjob.h <KIO/MimeTypeFinderJob>

@brief MimeTypeFinderJob finds out the MIME type of a URL.

@since 5.80

Member Function Documentation

[explicit] MimeTypeFinderJob::MimeTypeFinderJob(const QUrl &url, QObject *parent = nullptr)

@brief Creates an MimeTypeFinderJob for a URL. @param url the URL of the file/directory to examine

[override virtual noexcept] MimeTypeFinderJob::~MimeTypeFinderJob()

Destructor

Note that by default jobs auto-delete themselves after emitting result.

bool MimeTypeFinderJob::isAuthenticationPromptEnabled() const

Returns where authentication prompts are enabled or disabled. @see setAuthenticationPromptEnabled

QString MimeTypeFinderJob::mimeType() const

@return the MIME type. Only valid after the result() signal has been emitted.

void MimeTypeFinderJob::setAuthenticationPromptEnabled(bool enable)

Enable/disable authentication prompt, if the URL requires one. They are enabled by default. This method allows to disable such prompts for jobs that should fail rather than bother the user, if authentication is needed. Example: for starting the associated program (i.e. when OpenUrlJob uses MimeTypeFinderJob), we want auth prompts. But for using a nice icon in a notification, we don't.

See also isAuthenticationPromptEnabled().

void MimeTypeFinderJob::setFollowRedirections(bool b)

Sets whether the job should follow URL redirections. This is enabled by default. @param b whether to follow redirections or not

void MimeTypeFinderJob::setSuggestedFileName(const QString &suggestedFileName)

Sets the file name to use in the case of downloading the file to a tempfile, in order to give it to a non-URL-aware application. Some apps rely on the extension to determine the MIME type of the file. Usually the file name comes from the URL, but in the case of the HTTP Content-Disposition header, we need to override the file name. @param suggestedFileName the file name

See also suggestedFileName().

[override virtual] void MimeTypeFinderJob::start()

Reimplements: KJob::start().

Starts the job. You must call this, after having called all the needed setters.

QString MimeTypeFinderJob::suggestedFileName() const

Returns the suggested filename, either set by setSuggestedFileName or returned by the KIO::get job

See also setSuggestedFileName().