KDE 4.9 PyKDE API Reference

- KDE's Python API

# KMimeTypeValidator Class Reference

`from PyKDE4.kdeui import *`

Inherits: QValidator → QObject

## Detailed Description

A QValidator for mime types.

This validator allows you to validate mimetype names (e.g. text/plain, image/jpeg). Note that the validation is only syntactically. It will e.g. not reject "foo/bar", although that particular mime type isn't yet registered. It suffices for the name to adhere to the production

     mime-type := token "/" token ; 'token' is defined in rfc2045

The fixup will simply remove all non-token characters.

Deprecated:

Author:
  Marc Mutz <mutz@kde.org>

## Methods

| __init__ (self, QObject parent=0)
| fixup (self, QString input)
QValidator::State, int pos | validate (self, QString input)

## Method Documentation

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

Creates a new mime type validator.

fixup | ( | self, |
|  | QString | input
| ) |  |  |

Removes all characters that are forbidden in mimetypes.

QValidator::State, int pos validate | ( | self, |
|  | QString | input
| ) |  |  |

Checks for well-formed mimetype. Returns

- Acceptable iff input ~= /^[:allowed chars:]+\/[:allowed chars:]+$/
- Intermediate iff input ~= /^[:allowed chars:]*\/?[:allowed chars:]*$/
- Invalid else