KUriFilterPlugin Class

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

Public Functions

KUriFilterPlugin(QObject *parent, const KPluginMetaData &data)
virtual bool filterUri(KUriFilterData &data) const = 0

Protected Functions

QString iconNameFor(const QUrl &url, KUriFilterData::UriTypes type) const
QHostInfo resolveName(const QString &hostname, unsigned long timeout) const
void setArguments(KUriFilterData &data, const QString &args) const
void setErrorMsg(KUriFilterData &data, const QString &errmsg) const
void setFilteredUri(KUriFilterData &data, const QUrl &uri) const
void setSearchProvider(KUriFilterData &data, KUriFilterSearchProvider *provider, const QString &term, const QChar &separator) const
void setSearchProviders(KUriFilterData &data, const QList<KUriFilterSearchProvider *> &providers) const
void setUriType(KUriFilterData &data, KUriFilterData::UriTypes type) const

Detailed Description

@class KUriFilterPlugin kurifilter.h <KUriFilter>

Base class for URI filter plugins.

This class applies a single filter to a URI. All plugins designed to provide URI filtering service should inherit from this abstract class and provide a concrete implementation.

All inheriting classes need to implement the pure virtual function @ref filterUri.

@short Abstract class for URI filter plugins.

Member Function Documentation

[explicit] KUriFilterPlugin::KUriFilterPlugin(QObject *parent, const KPluginMetaData &data)

Constructs a filter plugin with a given name

@param parent the parent object, or @c nullptr for no parent @param name the name of the plugin, mandatory

[pure virtual] bool KUriFilterPlugin::filterUri(KUriFilterData &data) const

Filters a URI.

@param data the URI data to be filtered. @return A boolean indicating whether the URI has been changed.

[protected] QString KUriFilterPlugin::iconNameFor(const QUrl &url, KUriFilterData::UriTypes type) const

Returns the icon name for the given @p url and URI @p type.

[protected] QHostInfo KUriFilterPlugin::resolveName(const QString &hostname, unsigned long timeout) const

Performs a DNS lookup for @p hostname and returns the result.

This function uses the KIO DNS cache to speed up the lookup. It also avoids doing a reverse lookup if the given host name is already an ip address.

Note: All uri filter plugins that need to perform a hostname lookup should use this function.

@param hostname the hostname to lookup. @param timeout the amount of time in msecs to wait for the lookup. @return the result of the host name lookup.

[protected] void KUriFilterPlugin::setArguments(KUriFilterData &data, const QString &args) const

Sets the arguments and options string in @p data to @p args if any were found during filtering.

[protected] void KUriFilterPlugin::setErrorMsg(KUriFilterData &data, const QString &errmsg) const

Sets the error message in @p data to @p errormsg.

[protected] void KUriFilterPlugin::setFilteredUri(KUriFilterData &data, const QUrl &uri) const

Sets the URL in @p data to @p uri.

[protected] void KUriFilterPlugin::setSearchProvider(KUriFilterData &data, KUriFilterSearchProvider *provider, const QString &term, const QChar &separator) const

Sets the name of the search provider, the search term and keyword/term separator in @p data.

[protected] void KUriFilterPlugin::setSearchProviders(KUriFilterData &data, const QList<KUriFilterSearchProvider *> &providers) const

Sets the information about the search @p providers in @p data.

[protected] void KUriFilterPlugin::setUriType(KUriFilterData &data, KUriFilterData::UriTypes type) const

Sets the URI type in @p data to @p type.