KDE 4.5 PyKDE API Reference

- KDE's Python API

# KFilePlacesModel Class Reference

`from PyKDE4.kio import *`

Inherits: QAbstractItemModel → QObject

## Detailed Description

This class is a list view model. Each entry represents a "place" where user can access files. Only revelant when used with QListView or QTableView.

## Enumerations
AdditionalRoles | { UrlRole, HiddenRole, SetupNeededRole, FixedDeviceRole, CapacityBarRecommendedRole }
## Signals
| errorMessage (QString message)
| setupDone (QModelIndex index, bool success)
## Methods
| __init__ (self, QObject parent=0)
| addPlace (self, QString text, KUrl url, QString iconName=QString(), QString appName=QString())
| addPlace (self, QString text, KUrl url, QString iconName, QString appName, QModelIndex after)
KBookmark | bookmarkForIndex (self, QModelIndex index)
QModelIndex | closestItem (self, KUrl url)
int | columnCount (self, QModelIndex parent=QModelIndex())
QVariant | data (self, QModelIndex index, int role)
Solid.Device | deviceForIndex (self, QModelIndex index)
bool | dropMimeData (self, QMimeData data, Qt::DropAction action, int row, int column, QModelIndex parent)
| editPlace (self, QModelIndex index, QString text, KUrl url, QString iconName=QString(), QString appName=QString())
QAction | ejectActionForIndex (self, QModelIndex index)
Qt::ItemFlags | flags (self, QModelIndex index)
int | hiddenCount (self)
KIcon | icon (self, QModelIndex index)
QModelIndex | index (self, int row, int column, QModelIndex parent=QModelIndex())
bool | isDevice (self, QModelIndex index)
bool | isHidden (self, QModelIndex index)
QMimeData | mimeData (self, [QModelIndex] indexes)
QStringList | mimeTypes (self)
QModelIndex | parent (self, QModelIndex child)
| removePlace (self, QModelIndex index)
| requestEject (self, QModelIndex index)
| requestSetup (self, QModelIndex index)
| requestTeardown (self, QModelIndex index)
int | rowCount (self, QModelIndex parent=QModelIndex())
| setPlaceHidden (self, QModelIndex index, bool hidden)
bool | setupNeeded (self, QModelIndex index)
Qt::DropActions | supportedDropActions (self)
QAction | teardownActionForIndex (self, QModelIndex index)
QString | text (self, QModelIndex index)
KUrl | url (self, QModelIndex index)

## Signal Documentation

errorMessage | ( | QString | message
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("errorMessage(const QString&)"), target_slot)`

setupDone | ( | QModelIndex | index,
|  | bool | success
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("setupDone(const QModelIndex&, bool)"), target_slot)`

## Method Documentation

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

addPlace | ( | self, |
|  | QString | text,
|  | KUrl | url,
|  | QString | iconName=QString(),
|  | QString | appName=QString()
| ) |  |  |

addPlace | ( | self, |
|  | QString | text,
|  | KUrl | url,
|  | QString | iconName,
|  | QString | appName,
|  | QModelIndex | after
| ) |  |  |

KBookmark bookmarkForIndex | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QModelIndex closestItem | ( | self, |
|  | KUrl | url
| ) |  |  |

Returns the closest item for the URL url. The closest item is defined as item which is equal to the URL or at least is a parent URL. If there are more than one possible parent URL candidates, the item which covers the bigger range of the URL is returned.

Example: the url is '/home/peter/Documents/Music'. Available items are: - /home/peter - /home/peter/Documents

The returned item will the one for '/home/peter/Documents'.

int columnCount | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Get the number of columns for a model index.

QVariant data | ( | self, |
|  | QModelIndex | index,
|  | int | role
| ) |  |  |

Get a visible data based on Qt role for the given index. Return the device information for the give index.

Parameters:

  | index | The QModelIndex which contains the row, column to fetch the data.
  | role | The Interview data role(ex: Qt.DisplayRole).

Returns:
  the data for the given index and role.

Solid.Device deviceForIndex | ( | self, |
|  | QModelIndex | index
| ) |  |  |

bool dropMimeData | ( | self, |
|  | QMimeData | data,
|  | Qt::DropAction | action,
|  | int | row,
|  | int | column,
|  | QModelIndex | parent
| ) |  |  |

editPlace | ( | self, |
|  | QModelIndex | index,
|  | QString | text,
|  | KUrl | url,
|  | QString | iconName=QString(),
|  | QString | appName=QString()
| ) |  |  |

QAction ejectActionForIndex | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Qt::ItemFlags flags | ( | self, |
|  | QModelIndex | index
| ) |  |  |

int hiddenCount | ( |  | self ) |

KIcon icon | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QModelIndex index | ( | self, |
|  | int | row,
|  | int | column,
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Get the children model index for the given row and column.

bool isDevice | ( | self, |
|  | QModelIndex | index
| ) |  |  |

bool isHidden | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QMimeData mimeData | ( | self, |
|  | [QModelIndex] | indexes
| ) |  |  |

QStringList mimeTypes | ( |  | self ) |

QModelIndex parent | ( | self, |
|  | QModelIndex | child
| ) |  |  |

Get the parent QModelIndex for the given model child.

removePlace | ( | self, |
|  | QModelIndex | index
| ) |  |  |

requestEject | ( | self, |
|  | QModelIndex | index
| ) |  |  |

requestSetup | ( | self, |
|  | QModelIndex | index
| ) |  |  |

requestTeardown | ( | self, |
|  | QModelIndex | index
| ) |  |  |

int rowCount | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

Get the number of rows for a model index.

setPlaceHidden | ( | self, |
|  | QModelIndex | index,
|  | bool | hidden
| ) |  |  |

bool setupNeeded | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Qt::DropActions supportedDropActions | ( |  | self ) |

QAction teardownActionForIndex | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QString text | ( | self, |
|  | QModelIndex | index
| ) |  |  |

KUrl url | ( | self, |
|  | QModelIndex | index
| ) |  |  |

## Enumeration Documentation

AdditionalRoles

Enumerator:

  FileItemRole = 0x07A263FF |
  ChildCountRole = 0x2C4D0A40 |
  HasJobRole = 0x01E555A5 |