# class KUriFilterData

###

Table of contents
Modules
kio Classes
All Classes

Module | kio
Namespace | global
Class | KUriFilterData
Inherits |

A basic message object used for exchanging filtering information between the filter plugins and the application requesting the filtering service.

Use this object if you require a more detailed information about the URI you want to filter. Any application can create an instance of this class and send it to KUriFilter to have the plugins fill out all possible information about the URI.

Example

    QString text = "kde.org";
    KUriFilterData d = text;
    bool filtered = KUriFilter.self()->filter( d );
    cout << "URL: " << text.toLatin1() << endl
    << "Filtered URL: " << d.uri().url().toLatin1() << endl
    << "URI Type: " << d.uriType() << endl
    << "Was Filtered: " << filtered << endl;

The above code should yield the following output:

    URI: kde.org
    Filtered URI: http://kde.org
    URI Type: 0 <== means NET_PROTOCOL
    Was Filtered: 1 <== means the URL was successfully filtered

A message object for exchanging filtering URI info. Author Dawit Alemayehu <adawit at kde.org>

### enums

- UriTypes = { NET_PROTOCOL, LOCAL_FILE, LOCAL_DIR, EXECUTABLE, HELP, SHELL, BLOCKED, ERROR, UNKNOWN }

enum details

### methods

- KUriFilterData ()

  returns a KUriFilterData object

  Default constructor.

  Creates a UriFilterData object.

- KUriFilterData (url)

  returns a KUriFilterData object

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  Creates a UriFilterData object from the given URL.

  url - is the URL to be filtered.

- KUriFilterData (url)

  returns a KUriFilterData object

  Argument | Type | Default
  --- | --- | ---
  url | QString |

  Creates a UriFilterData object from the given string.

  url - is the string to be filtered.

- KUriFilterData (data)

  returns a KUriFilterData object

  Argument | Type | Default
  --- | --- | ---
  data | KUriFilterData |

  Copy constructor.

  Creates a UriFilterData object from another URI filter data object.

  data - the uri filter data to be copied.

- absolutePath ()

  returns (QString)

  Returns the absolute path if one has already been set. Returns the absolute path, or QString()

  See also hasAbsolutePath()

- argsAndOptions ()

  returns (QString)

  Returns the command line options and arguments for a local resource when present.

  Returns options and arguments when present, otherwise QString()

- checkForExecutables ()

  returns (bool)

  Returns true if the filters should attempt to check whether the supplied uri is an executable. False otherwise.

- errorMsg ()

  returns (QString)

  Returns an error message.

  This functions returns the error message set by the plugin whenever the uri type is set to KUriFilterData.ERROR. Otherwise, it returns a QString().

  Returns the error message or a 0 when there is none.

- hasAbsolutePath ()

  returns (bool)

  Checks whether the supplied data had an absolute path. Returns true if the supplied data has an absolute path

  See also absolutePath()

- hasArgsAndOptions ()

  returns (bool)

  Checks whether the current data is a local resource with command line options and arguments. Returns true if the current data has command line options and arguments

- iconName ()

  returns (QString)

  Returns the name of the icon that matches the current filtered URL.

  NOTE that this function will return a 0 string by default and when no associated icon is found.

  Returns the name of the icon associated with the resource, or QString() if not found

- setAbsolutePath (abs_path)

  returns (bool)

  Argument | Type | Default
  --- | --- | ---
  abs_path | QString |

  Sets the absolute path to be used whenever the supplied data is a relative local URL.

  NOTE: This function should only be used for local resources, i.e. the "file:/" protocol. It is useful for specifying the absolute path in cases where the actual URL might be relative. meta object. If deriving the path from a KUrl, make sure you set the argument for this function to the result of calling path () instead of url ().

  abs_path - the abolute path to the local resource. Returns true if absolute path is successfully set. Otherwise, false.

- setCheckForExecutables (check)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  check | bool |

  Check whether the provided uri is executable or not.

  Setting this to false ensures that typing the name of an executable does not start that application. This is useful in the location bar of a browser. The default value is true.

- setData (url)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  Same as above except the argument is a URL.

  Use this function to set the string to be filtered when you construct an empty filter object.

  url - the URL to be filtered.

- setData (url)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  url | QString |

  Sets the URL to be filtered.

  Use this function to set the string to be filtered when you construct an empty filter object.

  url - the string to be filtered.

- typedString ()

  returns (QString)

  Returns the string as typed by the user, before any URL processing is done

- uri ()

  returns (KUrl)

  Returns the filtered or the original URL.

  This function returns the filtered url if one of the plugins successfully filtered the original URL. Otherwise, it returns the original URL. See hasBeenFiltered() and

  Returns the filtered or original url.

- uriType ()

  returns (KUriFilterData.UriTypes)

  Returns the URI type.

  This method always returns KUriFilterData.UNKNOWN if the given URL was not filtered. Returns the type of the URI

### enums - detail

- UriTypes = { NET_PROTOCOL, LOCAL_FILE, LOCAL_DIR, EXECUTABLE, HELP, SHELL, BLOCKED, ERROR, UNKNOWN }

  | NET_PROTOCOL | - |
  | LOCAL_FILE | - |
  | LOCAL_DIR | - |
  | EXECUTABLE | - |
  | HELP | - |
  | SHELL | - |
  | BLOCKED | - |
  | ERROR | - |
  | UNKNOWN | - |