KDE 4.9 PyKDE API Reference

- KDE's Python API

# KUriFilterPlugin Class Reference

`from PyKDE4.kio import *`

Inherits: QObject

## Detailed Description

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 filterUri.

Abstract class for URI filter plugins.

## Methods

| __init__ (self, QString name, QObject parent=0)
KCModule | configModule (self, QWidget a0, QString a1)
QString | configName (self)
bool | filterUri (self, KUriFilterData data)
QString | iconNameFor (self, KUrl url, KUriFilterData.UriTypes type)
QHostInfo | resolveName (self, QString hostname, long timeout)
| setArguments (self, KUriFilterData data, QString args)
| setErrorMsg (self, KUriFilterData data, QString errmsg)
| setFilteredUri (self, KUriFilterData data, KUrl uri)
| setSearchProvider (self, KUriFilterData data, QString provider, QString term, QChar separator)
| setSearchProviders (self, KUriFilterData data, [KUriFilterSearchProvider] providers)
| setUriType (self, KUriFilterData data, KUriFilterData.UriTypes type)

## Method Documentation

__init__ | ( | self, |
|  | QString | name,
|  | QObject | parent=0
| ) |  |  |

Constructs a filter plugin with a given name

Parameters:

  | parent | the parent object, or 0 for no parent
  | name | the name of the plugin, mandatory

KCModule configModule | ( | self, |
|  | QWidget | a0,
|  | QString | a1
| ) |  |  |

Creates a configuration module for the filter.

It is the responsibility of the caller to delete the module once it is not needed anymore.

Returns:
  A configuration module, 0 if the filter isn't configurable.

QString configName | ( |  | self ) |

Returns the name of the configuration module for the filter.

Returns:
  the name of a configuration module or QString() if none.

bool filterUri | ( | self, |
|  | KUriFilterData | data
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Filters a URI.

Parameters:

  | data | the URI data to be filtered.

Returns:
  A boolean indicating whether the URI has been changed.

QString iconNameFor | ( | self, |
|  | KUrl | url,
|  | KUriFilterData.UriTypes | type
| ) |  |  |

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

Since:
  4.5

QHostInfo resolveName | ( | self, |
|  | QString | hostname,
|  | long | timeout
| ) |  |  |

Performs a DNS lookup for hostname and returns the result.

This function uses the KIO/KHTML 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.

Parameters:

  | hostname | the hostname to lookup.
  | timeout | the amount of time in msecs to wait for the lookup.

Returns:
  the result of the host name lookup.

Since:
  4.7

setArguments | ( | self, |
|  | KUriFilterData | data,
|  | QString | args
| ) |  |  |

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

setErrorMsg | ( | self, |
|  | KUriFilterData | data,
|  | QString | errmsg
| ) |  |  |

Sets the error message in data to errormsg.

setFilteredUri | ( | self, |
|  | KUriFilterData | data,
|  | KUrl | uri
| ) |  |  |

Sets the URL in data to uri.

setSearchProvider | ( | self, |
|  | KUriFilterData | data,
|  | QString | provider,
|  | QString | term,
|  | QChar | separator
| ) |  |  |

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

Since:
  4.5

setSearchProviders | ( | self, |
|  | KUriFilterData | data,
|  | [KUriFilterSearchProvider] | providers
| ) |  |  |

Sets the information about the search providers in data.

Since:
  4.6

setUriType | ( | self, |
|  | KUriFilterData | data,
|  | KUriFilterData.UriTypes | type
| ) |  |  |

Sets the URI type in data to type.