KDE 4.7 PyKDE API Reference

- KDE's Python API

# KEncodingFileDialog Class Reference

`from PyKDE4.kio import *`

Inherits: KFileDialog → KDialog → QDialog → QWidget → QObject

## Detailed Description

Provides a user (and developer) friendly way to select files with support for choosing encoding

The dialog has been designed to allow applications to customize it by subclassing. It uses geometry management to ensure that subclasses can easily add children that will be incorporated into the layout.

## Methods
| __init__ (self, QString startDir=QString(), QString encoding=QString(), QString filter=QString(), QString caption=QString(), KFileDialog.OperationMode type=KFileDialog.Opening, QWidget parent=0)
QString | selectedEncoding (self)
## Static Methods
KEncodingFileDialog.Result | getOpenFileNameAndEncoding (QString encoding=QString(), QString startDir=QString(), QString filter=QString(), QWidget parent=0, QString caption=QString())
KEncodingFileDialog.Result | getOpenFileNamesAndEncoding (QString encoding=QString(), QString startDir=QString(), QString filter=QString(), QWidget parent=0, QString caption=QString())
KEncodingFileDialog.Result | getOpenUrlAndEncoding (QString encoding=QString(), QString startDir=QString(), QString filter=QString(), QWidget parent=0, QString caption=QString())
KEncodingFileDialog.Result | getOpenUrlsAndEncoding (QString encoding=QString(), QString startDir=QString(), QString filter=QString(), QWidget parent=0, QString caption=QString())
KEncodingFileDialog.Result | getSaveFileNameAndEncoding (QString encoding=QString(), QString startDir=QString(), QString filter=QString(), QWidget parent=0, QString caption=QString())
KEncodingFileDialog.Result | getSaveUrlAndEncoding (QString encoding=QString(), QString startDir=QString(), QString filter=QString(), QWidget parent=0, QString caption=QString())

## Method Documentation

__init__ | ( | self, |
|  | QString | startDir=QString(),
|  | QString | encoding=QString(),
|  | QString | filter=QString(),
|  | QString | caption=QString(),
|  | KFileDialog.OperationMode | type=KFileDialog.Opening,
|  | QWidget | parent=0
| ) |  |  |

Constructs a file dialog for text files with encoding selection possibility.

Parameters:

  | startDir | This can either be

- The URL of the directory to start in.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | encoding | The encoding shown in the encoding combo. If it's QString(), the global default encoding will be shown.
  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | caption | The caption of the dialog
  | type | This can either be

- Opening (open dialog, the default setting)
- Saving

Parameters:

  | parent | The parent widget of this dialog

QString selectedEncoding | ( |  | self ) |

Returns:
  The selected encoding if the constructor with the encoding parameter was used, otherwise QString().

## Static Method Documentation

KEncodingFileDialog.Result getOpenFileNameAndEncoding | ( | QString | encoding=QString(),
|  | QString | startDir=QString(),
|  | QString | filter=QString(),
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a modal file dialog and return the selected filename or an empty string if none was chosen additionally a chosen encoding value is returned.

Note that with this method the user must select an existing filename.

Parameters:

  | encoding | The encoding shown in the encoding combo.
  | startDir | This can either be

- The URL of the directory to start in.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | parent | The widget the dialog will be centered on initially.
  | caption | The name of the dialog widget.

KEncodingFileDialog.Result getOpenFileNamesAndEncoding | ( | QString | encoding=QString(),
|  | QString | startDir=QString(),
|  | QString | filter=QString(),
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a modal file dialog and returns the selected encoding and the selected filenames or an empty list if none was chosen.

Note that with this method the user must select an existing filename.

Parameters:

  | encoding | The encoding shown in the encoding combo.
  | startDir | This can either be

- The URL of the directory to start in.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | parent | The widget the dialog will be centered on initially.
  | caption | The name of the dialog widget.

KEncodingFileDialog.Result getOpenUrlAndEncoding | ( | QString | encoding=QString(),
|  | QString | startDir=QString(),
|  | QString | filter=QString(),
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a modal file dialog and returns the selected encoding and URL or an empty string if none was chosen.

Note that with this method the user must select an existing URL.

Parameters:

  | encoding | The encoding shown in the encoding combo.
  | startDir | This can either be

- The URL of the directory to start in.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | parent | The widget the dialog will be centered on initially.
  | caption | The name of the dialog widget.

KEncodingFileDialog.Result getOpenUrlsAndEncoding | ( | QString | encoding=QString(),
|  | QString | startDir=QString(),
|  | QString | filter=QString(),
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a modal file dialog and returns the selected encoding URLs or an empty list if none was chosen.

Note that with this method the user must select an existing filename.

Parameters:

  | encoding | The encoding shown in the encoding combo.
  | startDir | This can either be

- The URL of the directory to start in.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | parent | The widget the dialog will be centered on initially.
  | caption | The name of the dialog widget.

KEncodingFileDialog.Result getSaveFileNameAndEncoding | ( | QString | encoding=QString(),
|  | QString | startDir=QString(),
|  | QString | filter=QString(),
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a modal file dialog and returns the selected encoding and filename or an empty string if none was chosen.

Note that with this method the user need not select an existing filename.

Parameters:

  | encoding | The encoding shown in the encoding combo.
  | startDir | This can either be

- The URL of the directory to start in.
- a relative path or a filename determining the
directory to start in and the file to be selected.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | parent | The widget the dialog will be centered on initially.
  | caption | The name of the dialog widget.

KEncodingFileDialog.Result getSaveUrlAndEncoding | ( | QString | encoding=QString(),
|  | QString | startDir=QString(),
|  | QString | filter=QString(),
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a modal file dialog and returns the selected encoding and filename or an empty string if none was chosen.

Note that with this method the user need not select an existing filename.

Parameters:

  | encoding | The encoding shown in the encoding combo.
  | startDir | This can either be

- The URL of the directory to start in.
- a relative path or a filename determining the
directory to start in and the file to be selected.
- QString() to start in the current working
directory, or the last directory where a file has been selected.
- ':&lt;keyword&gt;' to start in the directory last used
by a filedialog in the same application that specified the same keyword.
- '.&lt;keyword&gt;' to start in the directory last used
by a filedialog in any application that specified the same keyword.

Parameters:

  | filter | A shell glob or a mime-type-filter that specifies which files to display. The preferred option is to set a list of mimetype names, see setMimeFilter() for details. Otherwise you can set the text to be displayed for the each glob, and provide multiple globs, see setFilter() for details.
  | parent | The widget the dialog will be centered on initially.
  | caption | The name of the dialog widget.