KDE 4.9 PyKDE API Reference

- KDE's Python API

# KDirSelectDialog Class Reference

`from PyKDE4.kio import *`

Inherits: KDialog → QDialog → QWidget → QObject

## Detailed Description

A pretty dialog for a KDirSelect control for selecting directories.

Author:
  Michael Jarrett <michaelj@corel.com>

See also:
  KFileDialog

## Methods

| __init__ (self, KUrl startDir=KUrl(), bool localOnly=0, QWidget parent=0)
| accept (self)
| hideEvent (self, QHideEvent event)
bool | localOnly (self)
| setCurrentUrl (self, KUrl url)
KUrl | startDir (self)
KUrl | url (self)
QAbstractItemView | view (self)

## Static Methods

KUrl | selectDirectory (KUrl startDir=KUrl(), bool localOnly=0, QWidget parent=0, QString caption=QString())

## Method Documentation

__init__ | ( | self, |
|  | KUrl | startDir=KUrl(),
|  | bool | localOnly=0,
|  | QWidget | parent=0
| ) |  |  |

Creates a new directory selection dialog.

Internal:
  use the static selectDirectory function

Parameters:

  | startDir | the directory, initially shown
  | localOnly | unused. You can only select paths below the startDir
  | parent | the parent for the dialog, usually 0L

accept | ( |  | self ) |

hideEvent | ( | self, |
|  | QHideEvent | event
| ) |  |  |

Reimplemented for saving the dialog geometry.

bool localOnly | ( |  | self ) |

Returns whether only local directories can be selected.

setCurrentUrl | ( | self, |
|  | KUrl | url
| ) |  |  |

Sets the current url in the dialog.

KUrl startDir | ( |  | self ) |

Returns:
  The path for the root node

KUrl url | ( |  | self ) |

Returns the currently selected URL, or an empty one if no item is selected.

If the URL entered in the combobox is valid and exists, it is returned. Otherwise, the URL selected in the treeview is returned instead.

QAbstractItemView view | ( |  | self ) |

Returns a pointer to the view which is used for displaying the directories.

## Static Method Documentation

KUrl selectDirectory | ( | KUrl | startDir=KUrl(),
|  | bool | localOnly=0,
|  | QWidget | parent=0,
|  | QString | caption=QString()
| ) |  |  |

Creates a KDirSelectDialog, and returns the result.

Parameters:

  | startDir | the directory, initially shown The tree will display this directory and subdirectories of it.
  | localOnly | unused. You can only select paths below the startDir
  | parent | the parent widget to use for the dialog, or NULL to create a parent-less dialog
  | caption | the caption to use for the dialog, or QString() for the default caption

Returns:
  The URL selected, or an empty URL if the user canceled or no URL was selected.

NOTE: if you use this method and nothing else from libkfile, then you can use KFileDialog.getExistingDirectory (if localOnly was true) or KFileDialog.getExistingDirectoryUrl (if localOnly was false), and then you can link to libkio only instead of libkfile.