KDE 4.6 PyKDE API Reference

- KDE's Python API

# KMimeTypeChooserDialog Class Reference

`from PyKDE4.kio import *`

Inherits: KDialog → QDialog → QWidget → QObject

## Detailed Description

A Dialog to choose some mimetypes. Provides a checkable tree list of mimetypes, with icons and optinally comments and patterns, and an (optional) button to display the KDE mimetype editor.

Here is an example, using the dialog to set the text of two lineedits:

        QString text = i18n("Select the MimeTypes you want for this file type.");
        QStringList list = QStringList.split( QRegExp("\\s*;\\s*"), leMimetypes->text() );
        KMimeTypeChooserDialog dlg( i18n("Select Mime Types"), text, list, "text", this );
        if ( dlg.exec() == KDialog.Accepted ) {
          leWildcards->setText( dlg.chooser()->patterns().join(";") );
          leMimetypes->setText( dlg.chooser()->mimeTypes().join(";") );
        }

"KMimeTypeChooserDialog in action"

Author:
  Anders Lund (anders at alweb dk) dec 19, 2001

## Methods

| __init__ (self, QString caption=QString(), QString text=QString(), QStringList selectedMimeTypes=QStringList(), QString defaultGroup=QString(), QStringList groupsToShow=QStringList(), int visuals=KMimeTypeChooser.Comments|KMimeTypeChooser.Patterns|KMimeTypeChooser.EditButton, QWidget parent=0)
| __init__ (self, QString caption, QString text, QStringList selectedMimeTypes, QString defaultGroup, QWidget parent=0)
KMimeTypeChooser | chooser (self)

## Method Documentation

__init__ | ( | self, |
|  | QString | caption=QString(),
|  | QString | text=QString(),
|  | QStringList | selectedMimeTypes=QStringList(),
|  | QString | defaultGroup=QString(),
|  | QStringList | groupsToShow=QStringList(),
|  | int | visuals=KMimeTypeChooser.Comments|KMimeTypeChooser.Patterns|KMimeTypeChooser.EditButton,
|  | QWidget | parent=0
| ) |  |  |

Create a KMimeTypeChooser dialog.

Parameters:

  | caption | The title of the dialog
  | text | A Text to display above the list
  | selectedMimeTypes | A list of mimetype names, theese will be checked in the list if they exist. patterns will be added to the list view.
  | visuals | A OR'd KMimetypeChooser.Visuals enum to decide which data and buttons to display.
  | defaultGroup | The group to open when no groups are selected (like "text"). If not provided, no group is opened. If groupsToShow is provided and defaultGroup is not a member of that, it is ignored.
  | groupsToShow | a list of mimetype groups to show. If empty, all groups are shown.
  | parent | The parent widget to use

__init__ | ( | self, |
|  | QString | caption,
|  | QString | text,
|  | QStringList | selectedMimeTypes,
|  | QString | defaultGroup,
|  | QWidget | parent=0
| ) |  |  |

KMimeTypeChooser chooser | ( |  | self ) |

Returns:
  a pointer to the KMimeTypeChooser widget